@ComponentProfile(summary="A Service that refers to another Service configured elsewhere", tag="service") public class DynamicSharedService extends SharedServiceImpl
A Service instance that references a Service made available via SharedComponentList.getServices()
.
This differs from a normal SharedService
in that it allows you to resolve
the lookup name using
InterlokMessage.resolve(String)
. This reference will then be looked up and used for processing. A small cache (currently
16 items) is used to avoid excessive lifecycle overhead for looked up services.
In the adapter configuration file this class is aliased as dynamic-shared-service which is the preferred alternative to the fully qualified classname when building your configuration.
eventHandler, log
Constructor and Description |
---|
DynamicSharedService() |
DynamicSharedService(java.lang.String lookupName) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the component.
|
void |
doService(AdaptrisMessage msg)
Apply the service to the message.
|
protected long |
expirationMillis() |
protected java.util.Map<java.lang.String,Service> |
getCache() |
TimeInterval |
getExpiration()
Time (LRU) before expiration.
|
java.lang.String |
getLookupName()
Set the name of the service that will be looked up from
SharedComponentList.getServices() , |
java.lang.Integer |
getMaxEntries()
Max entries to store in the internal cache.
|
void |
init()
Initialises the component.
|
boolean |
isBranching()
Returns true if the implementation supports branching.
|
protected int |
maxEntries() |
void |
prepare()
Prepare for initialisation.
|
void |
setExpiration(TimeInterval expiration)
Time (LRU) before expiration.
|
void |
setLookupName(java.lang.String lookupName)
Set the name of the service that will be looked up from
SharedComponentList.getServices() , |
void |
setMaxEntries(java.lang.Integer maxEntries)
Max entries to store in the internal cache.
|
<T extends DynamicSharedService> |
withExpiration(TimeInterval i) |
<T extends DynamicSharedService> |
withMaxEntries(java.lang.Integer i) |
applyService, changeState, continueOnFailure, createName, createQualifier, deepClone, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, isTrackingEndpoint, registerEventHandler, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId
triggerJndiLookup
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
start, stop
public DynamicSharedService()
public DynamicSharedService(java.lang.String lookupName)
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
CoreException
- wrapping any underlying Exception
spublic void close()
ComponentLifecycle
A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException
may
cause unintended consequences
public void prepare() throws CoreException
ComponentLifecycleExtension
CoreException
public void doService(AdaptrisMessage msg) throws ServiceException
Service
Apply the service to the message.
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
spublic boolean isBranching()
Service
Returns true if the implementation supports branching.
BranchingServiceCollection
protected java.util.Map<java.lang.String,Service> getCache()
protected int maxEntries()
public <T extends DynamicSharedService> T withMaxEntries(java.lang.Integer i)
public <T extends DynamicSharedService> T withExpiration(TimeInterval i)
protected long expirationMillis()
public java.lang.Integer getMaxEntries()
public void setMaxEntries(java.lang.Integer maxEntries)
public TimeInterval getExpiration()
public void setExpiration(TimeInterval expiration)
public java.lang.String getLookupName()
SharedComponentList.getServices()
,
allows you to resolve
the lookup name using InterlokMessage.resolve(String)
.
This reference will then be looked up and used for processing. A cache is used to avoid
excessive lifecycle overhead for looked up services.
public void setLookupName(java.lang.String lookupName)
SharedComponentList.getServices()
,
allows you to resolve
the lookup name using InterlokMessage.resolve(String)
.
This reference will then be looked up and used for processing. A cache is used to avoid
excessive lifecycle overhead for looked up services.