Class DynamicSharedService
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,EventHandlerAware
,MessageEventGenerator
,Service
,StateManagedComponent
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.
-
Field Summary
Fields inherited from class com.adaptris.core.SharedServiceImpl
eventHandler, log
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the component.void
doService
(AdaptrisMessage msg) Apply the service to the message.protected long
getCache()
Time (LRU) before expiration.Set the name of the service that will be looked up fromSharedComponentList.getServices()
,Max entries to store in the internal cache.void
init()
Initialises the component.boolean
Returns true if the implementation supports branching.protected int
void
prepare()
Prepare for initialisation.void
setExpiration
(TimeInterval expiration) Time (LRU) before expiration.void
setLookupName
(String lookupName) Set the name of the service that will be looked up fromSharedComponentList.getServices()
,void
setMaxEntries
(Integer maxEntries) Max entries to store in the internal cache.<T extends DynamicSharedService>
T<T extends DynamicSharedService>
TMethods inherited from class com.adaptris.core.SharedServiceImpl
applyService, changeState, continueOnFailure, createName, createQualifier, deepClone, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, isTrackingEndpoint, registerEventHandler, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId
Methods inherited from class com.adaptris.core.SharedComponent
triggerJndiLookup
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.adaptris.core.ComponentLifecycle
start, stop
-
Constructor Details
-
DynamicSharedService
public DynamicSharedService() -
DynamicSharedService
-
-
Method Details
-
init
Description copied from interface:ComponentLifecycle
Initialises the component.Component initialisation includes config verification, creation of connections etc.
- Throws:
CoreException
- wrapping any underlyingException
s
-
close
public void close()Description copied from interface:ComponentLifecycle
Closes the component.A closed component should release any connections it uses, etc. and clean up completely. Throwing a
RuntimeException
may cause unintended consequences -
prepare
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Throws:
CoreException
-
doService
Description copied from interface:Service
Apply the service to the message.
- Parameters:
msg
- theAdaptrisMessage
to process- Throws:
ServiceException
- wrapping any underlyingException
s
-
isBranching
public boolean isBranching()Description copied from interface:Service
Returns true if the implementation supports branching.
- Returns:
- true if the implementation supports branching
- See Also:
-
getCache
-
maxEntries
protected int maxEntries() -
withMaxEntries
-
withExpiration
-
expirationMillis
protected long expirationMillis() -
getMaxEntries
Max entries to store in the internal cache. -
setMaxEntries
Max entries to store in the internal cache. -
getExpiration
Time (LRU) before expiration. -
setExpiration
Time (LRU) before expiration. -
getLookupName
Set the name of the service that will be looked up fromSharedComponentList.getServices()
,allows you to
resolve
the lookup name usingInterlokMessage.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. -
setLookupName
Set the name of the service that will be looked up fromSharedComponentList.getServices()
,allows you to
resolve
the lookup name usingInterlokMessage.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.
-