Class FilteredSharedComponentStart
- java.lang.Object
-
- com.adaptris.core.lifecycle.FilteredSharedComponentStart
-
- All Implemented Interfaces:
SharedComponentLifecycleStrategy
public class FilteredSharedComponentStart extends java.lang.Object implements SharedComponentLifecycleStrategy
Filtered start strategy forSharedComponentList
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
andexclude-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 Summary
Constructors Constructor Description FilteredSharedComponentStart()
FilteredSharedComponentStart(java.lang.Boolean threaded)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 ofExecutorService
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.
-
-
-
Method Detail
-
init
public void init(java.util.Collection<AdaptrisConnection> conns) throws CoreException
Description copied from interface:SharedComponentLifecycleStrategy
Initialise a list of channels.- Specified by:
init
in interfaceSharedComponentLifecycleStrategy
- Parameters:
conns
- a list of channels that require initialising.- Throws:
CoreException
- wrapping any underlying exception.
-
start
public void start(java.util.Collection<AdaptrisConnection> conns) throws CoreException
Description copied from interface:SharedComponentLifecycleStrategy
Start a list of connections.- Specified by:
start
in interfaceSharedComponentLifecycleStrategy
- Parameters:
conns
- a list of connections that have already been initialised.- Throws:
CoreException
- wrapping any underlying exception.
-
stop
public void stop(java.util.Collection<AdaptrisConnection> conns)
Description copied from interface:SharedComponentLifecycleStrategy
Stop a list of connections.- Specified by:
stop
in interfaceSharedComponentLifecycleStrategy
- Parameters:
conns
- a list of channels that have previously been started.
-
close
public void close(java.util.Collection<AdaptrisConnection> conns)
Description copied from interface:SharedComponentLifecycleStrategy
Close a list of connections.- Specified by:
close
in interfaceSharedComponentLifecycleStrategy
- Parameters:
conns
- a list of connections.
-
getThreadedStart
public java.lang.Boolean getThreadedStart()
-
setThreadedStart
public void setThreadedStart(java.lang.Boolean b)
Enable use ofExecutorService
to start connections.- Parameters:
b
- true to start all connections in their own thread default is null (false).
-
getIncludes
public java.util.List<java.lang.String> getIncludes()
-
setIncludes
public void setIncludes(java.util.List<java.lang.String> l)
Set the list of connection ids to start.- Parameters:
l
- the list of connection unique ids to include, defaults to an empty list.
-
getExcludes
public java.util.List<java.lang.String> getExcludes()
-
setExcludes
public void setExcludes(java.util.List<java.lang.String> l)
Set the list of connection ids to exclude.- Parameters:
l
- the list of connection unique ids to exclude, defaults to an empty list.
-
addInclude
public void addInclude(java.lang.String pattern)
-
addExclude
public void addExclude(java.lang.String pattern)
-
filter
public java.util.Collection<AdaptrisConnection> filter(java.util.Collection<AdaptrisConnection> original)
-
-