public class FilteredSharedComponentStart extends java.lang.Object implements SharedComponentLifecycleStrategy
SharedComponentList
In a standard Adapter lifecycle; all shared connections are started before any channels are started. If a connection is referenced by a Channel that is not set to auto-start; then this can cause a connection to be made which would waste resources. Use this strategy to only start specific named connections. In any event, if a connection is not started when a channel or service that requires it is started, it will be started.
All the includes are processed first to generate a subset of connections that is then used to process any exclusions. The
include-connection-id
and exclude-connection-id
should be a String that will be treated as a regular
expression format. If you do not specify any includes, then this implicitly means all elements are included. If you do not
specify any excludes then nothing is excluded from the inclusion subset.
Typically, you shouldn't need both includes and excludes because your skill with regular expressions mean that you can handle everything you need in either block. It is processed this way for completeness.
In the adapter configuration file this class is aliased as filtered-shared-component-start which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
FilteredSharedComponentStart() |
FilteredSharedComponentStart(java.lang.Boolean threaded) |
Modifier and Type | Method and Description |
---|---|
void |
addExclude(java.lang.String pattern) |
void |
addInclude(java.lang.String pattern) |
void |
close(java.util.Collection<AdaptrisConnection> conns)
Close a list of connections.
|
java.util.Collection<AdaptrisConnection> |
filter(java.util.Collection<AdaptrisConnection> original) |
java.util.List<java.lang.String> |
getExcludes() |
java.util.List<java.lang.String> |
getIncludes() |
java.lang.Boolean |
getThreadedStart() |
void |
init(java.util.Collection<AdaptrisConnection> conns)
Initialise a list of channels.
|
void |
setExcludes(java.util.List<java.lang.String> l)
Set the list of connection ids to exclude.
|
void |
setIncludes(java.util.List<java.lang.String> l)
Set the list of connection ids to start.
|
void |
setThreadedStart(java.lang.Boolean b)
Enable use of
ExecutorService to start connections. |
void |
start(java.util.Collection<AdaptrisConnection> conns)
Start a list of connections.
|
void |
stop(java.util.Collection<AdaptrisConnection> conns)
Stop a list of connections.
|
public FilteredSharedComponentStart()
public FilteredSharedComponentStart(java.lang.Boolean threaded)
public void init(java.util.Collection<AdaptrisConnection> conns) throws CoreException
SharedComponentLifecycleStrategy
init
in interface SharedComponentLifecycleStrategy
conns
- a list of channels that require initialising.CoreException
- wrapping any underlying exception.public void start(java.util.Collection<AdaptrisConnection> conns) throws CoreException
SharedComponentLifecycleStrategy
start
in interface SharedComponentLifecycleStrategy
conns
- a list of connections that have already been initialised.CoreException
- wrapping any underlying exception.public void stop(java.util.Collection<AdaptrisConnection> conns)
SharedComponentLifecycleStrategy
stop
in interface SharedComponentLifecycleStrategy
conns
- a list of channels that have previously been started.public void close(java.util.Collection<AdaptrisConnection> conns)
SharedComponentLifecycleStrategy
close
in interface SharedComponentLifecycleStrategy
conns
- a list of connections.public java.lang.Boolean getThreadedStart()
public void setThreadedStart(java.lang.Boolean b)
ExecutorService
to start connections.b
- true to start all connections in their own thread default is null (false).public java.util.List<java.lang.String> getIncludes()
public void setIncludes(java.util.List<java.lang.String> l)
l
- the list of connection unique ids to include, defaults to an empty list.public java.util.List<java.lang.String> getExcludes()
public void setExcludes(java.util.List<java.lang.String> l)
l
- the list of connection unique ids to exclude, defaults to an empty list.public void addInclude(java.lang.String pattern)
public void addExclude(java.lang.String pattern)
public java.util.Collection<AdaptrisConnection> filter(java.util.Collection<AdaptrisConnection> original)