public abstract class BaseUIMAAsynchronousEngineCommon_impl extends Object implements UimaAsynchronousEngine, javax.jms.MessageListener
Modifier and Type | Class and Description |
---|---|
class |
BaseUIMAAsynchronousEngineCommon_impl.ClientRequest |
static class |
BaseUIMAAsynchronousEngineCommon_impl.ClientState |
static class |
BaseUIMAAsynchronousEngineCommon_impl.SharedConnection |
protected static class |
BaseUIMAAsynchronousEngineCommon_impl.ThreadMonitor |
class |
BaseUIMAAsynchronousEngineCommon_impl.UimaASShutdownHook |
ApplicationContext, ApplicationName, CasPoolSize, CpcTimeout, DD2SpringXsltFilePath, Endpoint, GetMetaTimeout, ReplyWindow, SaxonClasspath, SerializationStrategy, ServerUri, ShadowCasPoolSize, SharedConnection, Timeout, UimaEeDebug
Constructor and Description |
---|
BaseUIMAAsynchronousEngineCommon_impl() |
Modifier and Type | Method and Description |
---|---|
protected void |
acquireCpcReadySemaphore() |
void |
addStatusCallbackListener(UimaAsBaseCallbackListener aListener)
Registers application specific listener.
|
protected void |
cancelTimer(String identifier) |
protected abstract void |
cleanup() |
void |
collectionProcessingComplete()
Sends a Collection Processing Complete (CPC) request to a UIMA AS Service and blocks waiting
for a reply.
|
boolean |
connectionOpen() |
protected abstract javax.jms.BytesMessage |
createBytesMessage() |
protected abstract javax.jms.TextMessage |
createTextMessage() |
protected void |
decrementOutstandingCasCounter() |
boolean |
delayCasIfDelegateInTimedOutState(String aCasReferenceId)
Checks the state of a delegate to see if it is in TIMEOUT State.
|
abstract String |
deploy(String[] aDeploymentDescriptorList,
Map anApplicationContext)
Deploys a single UIMA AS container and all services defined in provided deployment descriptors.
|
protected abstract String |
deploySpringContainer(String[] springContextFiles) |
protected org.apache.uima.cas.CAS |
deserialize(byte[] binaryData,
BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest) |
protected org.apache.uima.cas.CAS |
deserialize(String aSerializedCAS,
org.apache.uima.cas.CAS aCAS) |
protected org.apache.uima.cas.CAS |
deserialize(String aSerializedCAS,
org.apache.uima.cas.CAS aCAS,
org.apache.uima.cas.impl.XmiSerializationSharedData deserSharedData,
boolean deltaCas) |
protected org.apache.uima.cas.CAS |
deserializeCAS(byte[] aSerializedCAS,
BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest) |
protected org.apache.uima.cas.CAS |
deserializeCAS(byte[] aSerializedCAS,
org.apache.uima.cas.CAS aCas) |
protected org.apache.uima.cas.CAS |
deserializeCAS(byte[] aSerializedCAS,
String aCasPoolName) |
protected org.apache.uima.cas.CAS |
deserializeCAS(String aSerializedCAS,
BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest) |
protected org.apache.uima.cas.CAS |
deserializeCAS(String aSerializedCAS,
BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest,
boolean deltaCas) |
protected org.apache.uima.cas.CAS |
deserializeCAS(String aSerializedCAS,
String aCasPoolName) |
void |
doStop() |
protected ConcurrentHashMap |
getCache() |
org.apache.uima.cas.CAS |
getCAS()
Returns a CAS.
|
protected abstract MessageSender |
getDispatcher() |
abstract String |
getEndPointName() |
protected javax.jms.MessageProducer |
getMessageProducer(javax.jms.Destination destination) |
org.apache.uima.resource.metadata.ProcessingResourceMetaData |
getMetaData()
Gets the ProcessingResourceMetadata for the asynchronous AnalysisEngine.
|
String |
getPerformanceReport()
Not implemented
|
String |
getSerializationStrategy()
Returns serialization strategy for the remote service.
|
protected void |
handleCollectionProcessCompleteReply(javax.jms.Message message)
Handles response to CollectionProcessComplete request.
|
protected void |
handleException(Exception exception,
String casReferenceId,
String inputCasReferenceId,
BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest,
boolean doNotify) |
protected void |
handleException(Exception exception,
String casReferenceId,
String inputCasReferenceId,
BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest,
boolean doNotify,
boolean rethrow) |
protected void |
handleException(javax.jms.Message message,
BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest,
boolean doNotify) |
protected void |
handleMetadataReply(javax.jms.Message message)
Handles response to GetMeta Request.
|
protected void |
handleNonProcessException(Exception exception) |
protected void |
handleProcessReply(javax.jms.Message message,
boolean doNotify,
org.apache.uima.util.ProcessTrace pt)
Handles response to Process CAS request.
|
protected void |
handleServiceInfo(javax.jms.Message message)
Handles a ServiceInfo message returned from the Cas Multiplier.
|
abstract void |
initialize(Map anApplicationContext)
Initializes UIMA asynchronous client using configuration parameters provided in a Map object.
|
protected abstract void |
initializeConsumer(String aBrokerURI,
javax.jms.Connection connection) |
protected void |
notifyListeners(org.apache.uima.cas.CAS aCAS,
org.apache.uima.collection.EntityProcessStatus aStatus,
int aCommand) |
protected void |
notifyOnTimout(org.apache.uima.cas.CAS aCAS,
String anEndpoint,
int aTimeoutKind,
String casReferenceId) |
void |
onBeforeMessageSend(UimaASProcessStatus status) |
void |
onException(Exception aFailure,
String aDestination) |
void |
onMessage(javax.jms.Message message)
Listener method receiving JMS Messages from the response queue.
|
protected void |
onProducerInitialized()
Called when the producer thread is fully initialized
|
void |
process()
Initiates processing of a collection.
|
boolean |
recoverSharedConnectionIfClosed()
Continuously tries to recover connection a broker.
|
protected void |
removeFromCache(String aCasReferenceId) |
void |
removeStatusCallbackListener(UimaAsBaseCallbackListener aListener)
Unregisters named application listener.
|
protected void |
reset() |
String |
sendAndReceiveCAS(org.apache.uima.cas.CAS aCAS)
This synchronous method sends a given CAS to a UIMA AS service and waits for response.
|
String |
sendAndReceiveCAS(org.apache.uima.cas.CAS aCAS,
org.apache.uima.util.ProcessTrace pt)
This is a synchronous method which sends a message to a destination and blocks waiting for a
reply.
|
String |
sendCAS(org.apache.uima.cas.CAS aCAS)
Sends a given CAS for analysis to the UIMA EE Service.
|
protected void |
sendMetaRequest() |
protected String |
serializeCAS(org.apache.uima.cas.CAS aCAS) |
protected String |
serializeCAS(org.apache.uima.cas.CAS aCAS,
org.apache.uima.cas.impl.XmiSerializationSharedData serSharedData)
Serializes a given CAS.
|
protected abstract void |
setCASMessage(String casReferenceId,
byte[] aSerializedCAS,
javax.jms.Message msg) |
protected abstract void |
setCASMessage(String casReferenceId,
org.apache.uima.cas.CAS aCAS,
javax.jms.Message msg) |
protected abstract void |
setCASMessage(String casReferenceId,
String aSerializedCAS,
javax.jms.Message msg) |
void |
setCollectionReader(org.apache.uima.collection.CollectionReader aCollectionReader)
Registers a
CollectionReader instance to process a Collection. |
abstract void |
setCPCMessage(javax.jms.Message msg) |
protected abstract void |
setMetaRequestMessage(javax.jms.Message msg) |
protected void |
setReleaseCASMessage(javax.jms.TextMessage msg,
String aCasReferenceId) |
protected void |
setSerializationStrategy(String aSerializationStrategy) |
protected void |
waitForCpcReply() |
protected void |
waitForMetadataReply()
Blocks while trying to acquire a semaphore awaiting receipt of GetMeta Reply.
|
protected void |
wakeUpSendThread(BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deploy, stop, stopProducingCases, stopProducingCases, undeploy, undeploy
protected BaseUIMAAsynchronousEngineCommon_impl.ClientState state
protected static final String SHADOW_CAS_POOL
protected static final int MetadataTimeout
protected static final int CpCTimeout
protected static final int ProcessTimeout
protected static final int PingTimeout
protected volatile boolean initialized
protected List listeners
protected AsynchAECasManager asynchManager
protected boolean remoteService
protected org.apache.uima.collection.CollectionReader collectionReader
protected volatile boolean running
protected org.apache.uima.resource.metadata.ProcessingResourceMetaData resourceMetadata
protected org.apache.uima.cas.CAS sendAndReceiveCAS
protected UIDGenerator idGenerator
protected ConcurrentHashMap<String,BaseUIMAAsynchronousEngineCommon_impl.ClientRequest> clientCache
protected ConcurrentHashMap<Long,BaseUIMAAsynchronousEngineCommon_impl.ThreadMonitor> threadMonitorMap
protected int processTimeout
protected int metadataTimeout
protected int cpcTimeout
protected volatile boolean abort
protected static final String uniqueIdentifier
protected Exception exc
protected AtomicLong outstandingCasRequests
protected AtomicLong totalCasRequestsSentBetweenCpCs
protected ConcurrentHashMap springContainerRegistry
protected javax.jms.MessageConsumer consumer
protected String serializationStrategy
protected UimaASClientInfoMBean clientSideJmxStats
protected ClientServiceDelegate serviceDelegate
protected BlockingQueue<PendingMessage> pendingMessageQueue
protected Semaphore producerSemaphore
protected Semaphore cpcSemaphore
protected Semaphore getMetaSemaphore
protected Semaphore cpcReadySemaphore
protected Semaphore cpcReplySemaphore
protected volatile boolean producerInitialized
protected static BaseUIMAAsynchronousEngineCommon_impl.SharedConnection sharedConnection
protected Thread shutdownHookThread
public BaseUIMAAsynchronousEngineCommon_impl()
protected abstract javax.jms.TextMessage createTextMessage() throws Exception
Exception
protected abstract javax.jms.BytesMessage createBytesMessage() throws Exception
Exception
protected abstract void setMetaRequestMessage(javax.jms.Message msg) throws Exception
Exception
protected abstract void setCASMessage(String casReferenceId, org.apache.uima.cas.CAS aCAS, javax.jms.Message msg) throws Exception
Exception
protected abstract void setCASMessage(String casReferenceId, String aSerializedCAS, javax.jms.Message msg) throws Exception
Exception
protected abstract void setCASMessage(String casReferenceId, byte[] aSerializedCAS, javax.jms.Message msg) throws Exception
Exception
public abstract void setCPCMessage(javax.jms.Message msg) throws Exception
Exception
public abstract void initialize(Map anApplicationContext) throws org.apache.uima.resource.ResourceInitializationException
UimaAsynchronousEngine
UimaASStatusCallbackListener.initializationComplete(EntityProcessStatus)
on the application listener.initialize
in interface UimaAsynchronousEngine
anApplicationContext
- - configuration containing UIMA EE Service Broker URI, service queue name, timeout
value, reply window size, and CAS Pool size.org.apache.uima.resource.ResourceInitializationException
public abstract String deploy(String[] aDeploymentDescriptorList, Map anApplicationContext) throws Exception
UimaAsynchronousEngine
deploy
in interface UimaAsynchronousEngine
aDeploymentDescriptorList
- - a list of deployment descriptors to deploy in a container.anApplicationContext
- - initialization parameters needed to configure the client and servicesException
- - if there was a problem deploying the container or UIMA AS services.protected abstract String deploySpringContainer(String[] springContextFiles) throws org.apache.uima.resource.ResourceInitializationException
org.apache.uima.resource.ResourceInitializationException
protected abstract MessageSender getDispatcher()
protected abstract void initializeConsumer(String aBrokerURI, javax.jms.Connection connection) throws Exception
Exception
public void addStatusCallbackListener(UimaAsBaseCallbackListener aListener)
UimaAsynchronousEngine
addStatusCallbackListener
in interface UimaAsynchronousEngine
aListener
- - application listener object to addpublic String getSerializationStrategy()
UimaAsynchronousEngine
getSerializationStrategy
in interface UimaAsynchronousEngine
protected void setSerializationStrategy(String aSerializationStrategy)
protected String serializeCAS(org.apache.uima.cas.CAS aCAS, org.apache.uima.cas.impl.XmiSerializationSharedData serSharedData) throws Exception
aCAS
- - CAS to serializeException
protected String serializeCAS(org.apache.uima.cas.CAS aCAS) throws Exception
Exception
public void removeStatusCallbackListener(UimaAsBaseCallbackListener aListener)
UimaAsynchronousEngine
removeStatusCallbackListener
in interface UimaAsynchronousEngine
aListener
- - application listener to removepublic void onBeforeMessageSend(UimaASProcessStatus status)
public void setCollectionReader(org.apache.uima.collection.CollectionReader aCollectionReader) throws org.apache.uima.resource.ResourceInitializationException
UimaAsynchronousEngine
CollectionReader
instance to process a Collection. This method must be
called first, before calling UimaAsynchronousEngine.process()
method.setCollectionReader
in interface UimaAsynchronousEngine
aCollectionReader
- - instance of a CollectionReader
org.apache.uima.resource.ResourceInitializationException
protected void acquireCpcReadySemaphore()
public void collectionProcessingComplete() throws org.apache.uima.resource.ResourceProcessException
UimaAsynchronousEngine
collectionProcessingComplete
in interface UimaAsynchronousEngine
org.apache.uima.resource.ResourceProcessException
public void doStop()
public org.apache.uima.cas.CAS getCAS() throws Exception
getCAS
in interface UimaAsynchronousEngine
Exception
protected void reset()
protected void waitForCpcReply()
protected void waitForMetadataReply()
public String getPerformanceReport()
UimaAsynchronousEngine
getPerformanceReport
in interface UimaAsynchronousEngine
public void process() throws org.apache.uima.resource.ResourceProcessException
UimaAsynchronousEngine
CollectionReader
is provided via
UimaAsynchronousEngine.setCollectionReader(CollectionReader)
. This method blocks until the CollectionReader
finishes processing the entire collection. Status of the processing can be obtained by
registering a listener with the
UimaAsynchronousEngine.addStatusCallbackListener(UimaAsBaseCallbackListener)
method.
The method is synchronized to allow processing of only one collection at a time. The
application must wait with processing another collection until it receives notification via a
listener
UimaASStatusCallbackListener.collectionProcessComplete(EntityProcessStatus aStatus)
process
in interface UimaAsynchronousEngine
org.apache.uima.resource.ResourceProcessException
- - if there is a problem processing the Collectionprotected ConcurrentHashMap getCache()
public boolean delayCasIfDelegateInTimedOutState(String aCasReferenceId) throws AsynchAEException
AsynchAEException
public String sendCAS(org.apache.uima.cas.CAS aCAS) throws org.apache.uima.resource.ResourceProcessException
sendCAS
in interface UimaAsynchronousEngine
aCAS
- - a CAS to analyze.org.apache.uima.resource.ResourceProcessException
protected void handleCollectionProcessCompleteReply(javax.jms.Message message) throws Exception
Exception
protected void handleMetadataReply(javax.jms.Message message) throws Exception
message
- - jms message containing serialized ResourceMetaDataException
protected void notifyListeners(org.apache.uima.cas.CAS aCAS, org.apache.uima.collection.EntityProcessStatus aStatus, int aCommand)
protected void cancelTimer(String identifier)
protected void wakeUpSendThread(BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest) throws Exception
Exception
protected void handleServiceInfo(javax.jms.Message message) throws Exception
message
- - message received from a serviceException
protected void decrementOutstandingCasCounter()
protected void handleProcessReply(javax.jms.Message message, boolean doNotify, org.apache.uima.util.ProcessTrace pt) throws Exception
message
- - jms message containing serialized CASException
protected void handleNonProcessException(Exception exception) throws Exception
Exception
protected void handleException(Exception exception, String casReferenceId, String inputCasReferenceId, BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest, boolean doNotify) throws Exception
Exception
protected void handleException(Exception exception, String casReferenceId, String inputCasReferenceId, BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest, boolean doNotify, boolean rethrow) throws Exception
Exception
protected void handleException(javax.jms.Message message, BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest, boolean doNotify) throws Exception
Exception
protected void removeFromCache(String aCasReferenceId)
protected org.apache.uima.cas.CAS deserialize(String aSerializedCAS, org.apache.uima.cas.CAS aCAS) throws Exception
Exception
protected org.apache.uima.cas.CAS deserialize(String aSerializedCAS, org.apache.uima.cas.CAS aCAS, org.apache.uima.cas.impl.XmiSerializationSharedData deserSharedData, boolean deltaCas) throws Exception
Exception
protected org.apache.uima.cas.CAS deserialize(byte[] binaryData, BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest) throws Exception
Exception
protected org.apache.uima.cas.CAS deserializeCAS(String aSerializedCAS, BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest) throws Exception
Exception
protected org.apache.uima.cas.CAS deserializeCAS(byte[] aSerializedCAS, BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest) throws Exception
Exception
protected org.apache.uima.cas.CAS deserializeCAS(byte[] aSerializedCAS, org.apache.uima.cas.CAS aCas) throws Exception
Exception
protected org.apache.uima.cas.CAS deserializeCAS(String aSerializedCAS, BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest, boolean deltaCas) throws Exception
Exception
protected org.apache.uima.cas.CAS deserializeCAS(String aSerializedCAS, String aCasPoolName) throws Exception
Exception
protected org.apache.uima.cas.CAS deserializeCAS(byte[] aSerializedCAS, String aCasPoolName) throws Exception
Exception
public void onMessage(javax.jms.Message message)
onMessage
in interface javax.jms.MessageListener
public org.apache.uima.resource.metadata.ProcessingResourceMetaData getMetaData() throws org.apache.uima.resource.ResourceInitializationException
getMetaData
in interface UimaAsynchronousEngine
org.apache.uima.resource.ResourceInitializationException
public String sendAndReceiveCAS(org.apache.uima.cas.CAS aCAS, org.apache.uima.util.ProcessTrace pt) throws org.apache.uima.resource.ResourceProcessException
org.apache.uima.resource.ResourceProcessException
public String sendAndReceiveCAS(org.apache.uima.cas.CAS aCAS) throws org.apache.uima.resource.ResourceProcessException
UimaAsynchronousEngine
sendAndReceiveCAS
in interface UimaAsynchronousEngine
aCAS
- - a CAS to analyze.org.apache.uima.resource.ResourceProcessException
protected void notifyOnTimout(org.apache.uima.cas.CAS aCAS, String anEndpoint, int aTimeoutKind, String casReferenceId)
protected javax.jms.MessageProducer getMessageProducer(javax.jms.Destination destination) throws Exception
Exception
protected void onProducerInitialized()
public boolean connectionOpen()
public boolean recoverSharedConnectionIfClosed()
Copyright © 2016. All rights reserved.