org.apache.uima.adapter.jms.client
Class BaseUIMAAsynchronousEngineCommon_impl

java.lang.Object
  extended by org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
All Implemented Interfaces:
javax.jms.MessageListener, UimaAsynchronousEngine
Direct Known Subclasses:
BaseUIMAAsynchronousEngine_impl

public abstract class BaseUIMAAsynchronousEngineCommon_impl
extends java.lang.Object
implements UimaAsynchronousEngine, javax.jms.MessageListener


Nested Class Summary
 class BaseUIMAAsynchronousEngineCommon_impl.ClientRequest
           
static class BaseUIMAAsynchronousEngineCommon_impl.ClientState
           
static class BaseUIMAAsynchronousEngineCommon_impl.SharedConnection
           
protected static class BaseUIMAAsynchronousEngineCommon_impl.ThreadMonitor
           
 class BaseUIMAAsynchronousEngineCommon_impl.UimaASShutdownHook
           
 
Field Summary
protected  boolean abort
           
protected  AsynchAECasManager asynchManager
           
protected  java.util.concurrent.ConcurrentHashMap<java.lang.String,BaseUIMAAsynchronousEngineCommon_impl.ClientRequest> clientCache
           
protected  UimaASClientInfoMBean clientSideJmxStats
           
protected  org.apache.uima.collection.CollectionReader collectionReader
           
protected  javax.jms.MessageConsumer consumer
           
protected  java.util.concurrent.Semaphore cpcReadySemaphore
           
protected  java.util.concurrent.Semaphore cpcReplySemaphore
           
protected  java.util.concurrent.Semaphore cpcSemaphore
           
protected  int cpcTimeout
           
protected static int CpCTimeout
           
protected  java.lang.Exception exc
           
protected  java.util.concurrent.Semaphore getMetaSemaphore
           
protected  UIDGenerator idGenerator
           
protected  boolean initialized
           
protected  java.util.List listeners
           
protected  int metadataTimeout
           
protected static int MetadataTimeout
           
protected  java.util.concurrent.atomic.AtomicLong outstandingCasRequests
           
protected  java.util.concurrent.BlockingQueue<PendingMessage> pendingMessageQueue
           
protected static int PingTimeout
           
protected  int processTimeout
           
protected static int ProcessTimeout
           
protected  boolean producerInitialized
           
protected  java.util.concurrent.Semaphore producerSemaphore
           
protected  boolean remoteService
           
protected  org.apache.uima.resource.metadata.ProcessingResourceMetaData resourceMetadata
           
protected  boolean running
           
protected  org.apache.uima.cas.CAS sendAndReceiveCAS
           
protected  java.lang.String serializationStrategy
           
protected  ClientServiceDelegate serviceDelegate
           
protected static java.lang.String SHADOW_CAS_POOL
           
protected static BaseUIMAAsynchronousEngineCommon_impl.SharedConnection sharedConnection
           
protected  java.lang.Thread shutdownHookThread
           
protected  java.util.concurrent.ConcurrentHashMap springContainerRegistry
           
protected  BaseUIMAAsynchronousEngineCommon_impl.ClientState state
           
protected  java.util.concurrent.ConcurrentHashMap<java.lang.Long,BaseUIMAAsynchronousEngineCommon_impl.ThreadMonitor> threadMonitorMap
           
protected  java.util.concurrent.atomic.AtomicLong totalCasRequestsSentBetweenCpCs
           
protected static java.lang.String uniqueIdentifier
           
 
Fields inherited from interface org.apache.uima.aae.client.UimaAsynchronousEngine
ApplicationContext, ApplicationName, CasPoolSize, CpcTimeout, DD2SpringXsltFilePath, Endpoint, GetMetaTimeout, ReplyWindow, SaxonClasspath, SerializationStrategy, ServerUri, ShadowCasPoolSize, SharedConnection, Timeout, UimaEeDebug
 
Constructor Summary
BaseUIMAAsynchronousEngineCommon_impl()
           
 
Method Summary
protected  void acquireCpcReadySemaphore()
           
 void addStatusCallbackListener(UimaAsBaseCallbackListener aListener)
          Registers application specific listener.
protected  void cancelTimer(java.lang.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(java.lang.String aCasReferenceId)
          Checks the state of a delegate to see if it is in TIMEOUT State.
abstract  java.lang.String deploy(java.lang.String[] aDeploymentDescriptorList, java.util.Map anApplicationContext)
          Deploys a single UIMA AS container and all services defined in provided deployment descriptors.
protected abstract  java.lang.String deploySpringContainer(java.lang.String[] springContextFiles)
           
protected  org.apache.uima.cas.CAS deserialize(byte[] binaryData, BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest)
           
protected  org.apache.uima.cas.CAS deserialize(java.lang.String aSerializedCAS, org.apache.uima.cas.CAS aCAS)
           
protected  org.apache.uima.cas.CAS deserialize(java.lang.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, java.lang.String aCasPoolName)
           
protected  org.apache.uima.cas.CAS deserializeCAS(java.lang.String aSerializedCAS, BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest)
           
protected  org.apache.uima.cas.CAS deserializeCAS(java.lang.String aSerializedCAS, BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest, boolean deltaCas)
           
protected  org.apache.uima.cas.CAS deserializeCAS(java.lang.String aSerializedCAS, java.lang.String aCasPoolName)
           
 void doStop()
           
protected  java.util.concurrent.ConcurrentHashMap getCache()
           
 org.apache.uima.cas.CAS getCAS()
          Returns a CAS.
protected abstract  MessageSender getDispatcher()
           
abstract  java.lang.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.
 java.lang.String getPerformanceReport()
          Not implemented
 java.lang.String getSerializationStrategy()
          Returns serialization strategy for the remote service.
protected  void handleCollectionProcessCompleteReply(javax.jms.Message message)
          Handles response to CollectionProcessComplete request.
protected  void handleException(java.lang.Exception exception, java.lang.String casReferenceId, java.lang.String inputCasReferenceId, BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest, boolean doNotify)
           
protected  void handleException(java.lang.Exception exception, java.lang.String casReferenceId, java.lang.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(java.lang.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(java.util.Map anApplicationContext)
          Initializes UIMA asynchronous client using configuration parameters provided in a Map object.
protected abstract  void initializeConsumer(java.lang.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, java.lang.String anEndpoint, int aTimeoutKind, java.lang.String casReferenceId)
           
 void onBeforeMessageSend(UimaASProcessStatus status)
           
 void onException(java.lang.Exception aFailure, java.lang.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(java.lang.String aCasReferenceId)
           
 void removeStatusCallbackListener(UimaAsBaseCallbackListener aListener)
          Unregisters named application listener.
protected  void reset()
           
 java.lang.String sendAndReceiveCAS(org.apache.uima.cas.CAS aCAS)
          This synchronous method sends a given CAS to a UIMA AS service and waits for response.
 java.lang.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.
 java.lang.String sendCAS(org.apache.uima.cas.CAS aCAS)
          Sends a given CAS for analysis to the UIMA EE Service.
protected  void sendMetaRequest()
           
protected  java.lang.String serializeCAS(org.apache.uima.cas.CAS aCAS)
           
protected  java.lang.String serializeCAS(org.apache.uima.cas.CAS aCAS, org.apache.uima.cas.impl.XmiSerializationSharedData serSharedData)
          Serializes a given CAS.
protected abstract  void setCASMessage(java.lang.String casReferenceId, byte[] aSerializedCAS, javax.jms.Message msg)
           
protected abstract  void setCASMessage(java.lang.String casReferenceId, org.apache.uima.cas.CAS aCAS, javax.jms.Message msg)
           
protected abstract  void setCASMessage(java.lang.String casReferenceId, java.lang.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, java.lang.String aCasReferenceId)
           
protected  void setSerializationStrategy(java.lang.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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.uima.aae.client.UimaAsynchronousEngine
deploy, stop, stopProducingCases, stopProducingCases, undeploy, undeploy
 

Field Detail

state

protected BaseUIMAAsynchronousEngineCommon_impl.ClientState state

SHADOW_CAS_POOL

protected static final java.lang.String SHADOW_CAS_POOL
See Also:
Constant Field Values

MetadataTimeout

protected static final int MetadataTimeout
See Also:
Constant Field Values

CpCTimeout

protected static final int CpCTimeout
See Also:
Constant Field Values

ProcessTimeout

protected static final int ProcessTimeout
See Also:
Constant Field Values

PingTimeout

protected static final int PingTimeout
See Also:
Constant Field Values

initialized

protected volatile boolean initialized

listeners

protected java.util.List listeners

asynchManager

protected AsynchAECasManager asynchManager

remoteService

protected boolean remoteService

collectionReader

protected org.apache.uima.collection.CollectionReader collectionReader

running

protected volatile boolean running

resourceMetadata

protected org.apache.uima.resource.metadata.ProcessingResourceMetaData resourceMetadata

sendAndReceiveCAS

protected org.apache.uima.cas.CAS sendAndReceiveCAS

idGenerator

protected UIDGenerator idGenerator

clientCache

protected java.util.concurrent.ConcurrentHashMap<java.lang.String,BaseUIMAAsynchronousEngineCommon_impl.ClientRequest> clientCache

threadMonitorMap

protected java.util.concurrent.ConcurrentHashMap<java.lang.Long,BaseUIMAAsynchronousEngineCommon_impl.ThreadMonitor> threadMonitorMap

processTimeout

protected int processTimeout

metadataTimeout

protected int metadataTimeout

cpcTimeout

protected int cpcTimeout

abort

protected volatile boolean abort

uniqueIdentifier

protected static final java.lang.String uniqueIdentifier

exc

protected java.lang.Exception exc

outstandingCasRequests

protected java.util.concurrent.atomic.AtomicLong outstandingCasRequests

totalCasRequestsSentBetweenCpCs

protected java.util.concurrent.atomic.AtomicLong totalCasRequestsSentBetweenCpCs

springContainerRegistry

protected java.util.concurrent.ConcurrentHashMap springContainerRegistry

consumer

protected javax.jms.MessageConsumer consumer

serializationStrategy

protected java.lang.String serializationStrategy

clientSideJmxStats

protected UimaASClientInfoMBean clientSideJmxStats

serviceDelegate

protected ClientServiceDelegate serviceDelegate

pendingMessageQueue

protected java.util.concurrent.BlockingQueue<PendingMessage> pendingMessageQueue

producerSemaphore

protected java.util.concurrent.Semaphore producerSemaphore

cpcSemaphore

protected java.util.concurrent.Semaphore cpcSemaphore

getMetaSemaphore

protected java.util.concurrent.Semaphore getMetaSemaphore

cpcReadySemaphore

protected java.util.concurrent.Semaphore cpcReadySemaphore

cpcReplySemaphore

protected java.util.concurrent.Semaphore cpcReplySemaphore

producerInitialized

protected volatile boolean producerInitialized

sharedConnection

protected static BaseUIMAAsynchronousEngineCommon_impl.SharedConnection sharedConnection

shutdownHookThread

protected java.lang.Thread shutdownHookThread
Constructor Detail

BaseUIMAAsynchronousEngineCommon_impl

public BaseUIMAAsynchronousEngineCommon_impl()
Method Detail

getEndPointName

public abstract java.lang.String getEndPointName()
                                          throws java.lang.Exception
Throws:
java.lang.Exception

createTextMessage

protected abstract javax.jms.TextMessage createTextMessage()
                                                    throws java.lang.Exception
Throws:
java.lang.Exception

createBytesMessage

protected abstract javax.jms.BytesMessage createBytesMessage()
                                                      throws java.lang.Exception
Throws:
java.lang.Exception

setMetaRequestMessage

protected abstract void setMetaRequestMessage(javax.jms.Message msg)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

setCASMessage

protected abstract void setCASMessage(java.lang.String casReferenceId,
                                      org.apache.uima.cas.CAS aCAS,
                                      javax.jms.Message msg)
                               throws java.lang.Exception
Throws:
java.lang.Exception

setCASMessage

protected abstract void setCASMessage(java.lang.String casReferenceId,
                                      java.lang.String aSerializedCAS,
                                      javax.jms.Message msg)
                               throws java.lang.Exception
Throws:
java.lang.Exception

setCASMessage

protected abstract void setCASMessage(java.lang.String casReferenceId,
                                      byte[] aSerializedCAS,
                                      javax.jms.Message msg)
                               throws java.lang.Exception
Throws:
java.lang.Exception

setCPCMessage

public abstract void setCPCMessage(javax.jms.Message msg)
                            throws java.lang.Exception
Throws:
java.lang.Exception

initialize

public abstract void initialize(java.util.Map anApplicationContext)
                         throws org.apache.uima.resource.ResourceInitializationException
Description copied from interface: UimaAsynchronousEngine
Initializes UIMA asynchronous client using configuration parameters provided in a Map object. It creates a connection to a service queue managed by a Broker as specified in the parameters. A temporary reply queue is also created with a JMS listener attached to it. Once the connections are made and the listener is started the method sends getMeta request to the UIMA AS service and waits for a response. When the reply to getMeta is received the UIMA AS client is fully initialized and notifies an application by calling UimaASStatusCallbackListener.initializationComplete(EntityProcessStatus) on the application listener.

Specified by:
initialize in interface UimaAsynchronousEngine
Parameters:
anApplicationContext - - configuration containing UIMA EE Service Broker URI, service queue name, timeout value, reply window size, and CAS Pool size.
Throws:
org.apache.uima.resource.ResourceInitializationException

cleanup

protected abstract void cleanup()
                         throws java.lang.Exception
Throws:
java.lang.Exception

deploy

public abstract java.lang.String deploy(java.lang.String[] aDeploymentDescriptorList,
                                        java.util.Map anApplicationContext)
                                 throws java.lang.Exception
Description copied from interface: UimaAsynchronousEngine
Deploys a single UIMA AS container and all services defined in provided deployment descriptors. Each deployment descriptor contains an assembly of related UIMA AS services. This method is synchronous and will block until all UIMA AS services are completely deployed and initialized. If there is a problem deploying any of the UIMA AS services the container is destroyed and exception thrown.

Specified by:
deploy in interface UimaAsynchronousEngine
Parameters:
aDeploymentDescriptorList - - a list of deployment descriptors to deploy in a container.
anApplicationContext - - initialization parameters needed to configure the client and services
Returns:
- the id of the container in which the UIMA AS services were deployed
Throws:
java.lang.Exception - - if there was a problem deploying the container or UIMA AS services.

deploySpringContainer

protected abstract java.lang.String deploySpringContainer(java.lang.String[] springContextFiles)
                                                   throws org.apache.uima.resource.ResourceInitializationException
Throws:
org.apache.uima.resource.ResourceInitializationException

getDispatcher

protected abstract MessageSender getDispatcher()

initializeConsumer

protected abstract void initializeConsumer(java.lang.String aBrokerURI,
                                           javax.jms.Connection connection)
                                    throws java.lang.Exception
Throws:
java.lang.Exception

addStatusCallbackListener

public void addStatusCallbackListener(UimaAsBaseCallbackListener aListener)
Description copied from interface: UimaAsynchronousEngine
Registers application specific listener. Via this listener the application receives call-backs. More than one listener can be added.

Specified by:
addStatusCallbackListener in interface UimaAsynchronousEngine
Parameters:
aListener - - application listener object to add

getSerializationStrategy

public java.lang.String getSerializationStrategy()
Description copied from interface: UimaAsynchronousEngine
Returns serialization strategy for the remote service. All CASes will be serialized according to the specified serialization. Either xmi or binary

Specified by:
getSerializationStrategy in interface UimaAsynchronousEngine
Returns:
String type of serialization for CASes

setSerializationStrategy

protected void setSerializationStrategy(java.lang.String aSerializationStrategy)

serializeCAS

protected java.lang.String serializeCAS(org.apache.uima.cas.CAS aCAS,
                                        org.apache.uima.cas.impl.XmiSerializationSharedData serSharedData)
                                 throws java.lang.Exception
Serializes a given CAS.

Parameters:
aCAS - - CAS to serialize
Returns:
- serialized CAS
Throws:
java.lang.Exception

serializeCAS

protected java.lang.String serializeCAS(org.apache.uima.cas.CAS aCAS)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

removeStatusCallbackListener

public void removeStatusCallbackListener(UimaAsBaseCallbackListener aListener)
Description copied from interface: UimaAsynchronousEngine
Unregisters named application listener.

Specified by:
removeStatusCallbackListener in interface UimaAsynchronousEngine
Parameters:
aListener - - application listener to remove

onBeforeMessageSend

public void onBeforeMessageSend(UimaASProcessStatus status)

setCollectionReader

public void setCollectionReader(org.apache.uima.collection.CollectionReader aCollectionReader)
                         throws org.apache.uima.resource.ResourceInitializationException
Description copied from interface: UimaAsynchronousEngine
Registers a CollectionReader instance to process a Collection. This method must be called first, before calling UimaAsynchronousEngine.process() method.

Specified by:
setCollectionReader in interface UimaAsynchronousEngine
Parameters:
aCollectionReader - - instance of a CollectionReader
Throws:
org.apache.uima.resource.ResourceInitializationException

acquireCpcReadySemaphore

protected void acquireCpcReadySemaphore()

collectionProcessingComplete

public void collectionProcessingComplete()
                                  throws org.apache.uima.resource.ResourceProcessException
Description copied from interface: UimaAsynchronousEngine
Sends a Collection Processing Complete (CPC) request to a UIMA AS Service and blocks waiting for a reply. The method blocks until the service replies or a timeout occurs. Before returning, this method will notify an application of completing the Collection Processing Complete request using registered listener

Specified by:
collectionProcessingComplete in interface UimaAsynchronousEngine
Throws:
org.apache.uima.resource.ResourceProcessException

doStop

public void doStop()

getCAS

public org.apache.uima.cas.CAS getCAS()
                               throws java.lang.Exception
Returns a CAS. If multiple threads call this method, the order of each request is preserved. The oldest waiting thread receives the CAS. Each request for a CAS is queued, and when the CAS becomes available the oldest waiting thread will receive it for processing.

Specified by:
getCAS in interface UimaAsynchronousEngine
Returns:
- new CAS instance fetched from the CAS pool
Throws:
java.lang.Exception

reset

protected void reset()

sendMetaRequest

protected void sendMetaRequest()
                        throws java.lang.Exception
Throws:
java.lang.Exception

waitForCpcReply

protected void waitForCpcReply()

waitForMetadataReply

protected void waitForMetadataReply()
Blocks while trying to acquire a semaphore awaiting receipt of GetMeta Reply. When the GetMeta is received, or there is a timeout, or the client stops the semaphore will be released.


getPerformanceReport

public java.lang.String getPerformanceReport()
Description copied from interface: UimaAsynchronousEngine
Not implemented

Specified by:
getPerformanceReport in interface UimaAsynchronousEngine
Returns:
null

process

public void process()
             throws org.apache.uima.resource.ResourceProcessException
Description copied from interface: UimaAsynchronousEngine
Initiates processing of a collection. This method should be only called after initialize() has been called and an instance of a 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)

Specified by:
process in interface UimaAsynchronousEngine
Throws:
org.apache.uima.resource.ResourceProcessException - - if there is a problem processing the Collection

getCache

protected java.util.concurrent.ConcurrentHashMap getCache()

delayCasIfDelegateInTimedOutState

public boolean delayCasIfDelegateInTimedOutState(java.lang.String aCasReferenceId)
                                          throws AsynchAEException
Checks the state of a delegate to see if it is in TIMEOUT State. If it is, push the CAS id onto a list of CASes pending dispatch. The delegate is in a questionable state and the aggregate sends a ping message to check delegate's availability. If the delegate responds to the ping, all CASes in the pending dispatch list will be immediately dispatched.

Throws:
AsynchAEException

sendCAS

public java.lang.String sendCAS(org.apache.uima.cas.CAS aCAS)
                         throws org.apache.uima.resource.ResourceProcessException
Sends a given CAS for analysis to the UIMA EE Service.

Specified by:
sendCAS in interface UimaAsynchronousEngine
Parameters:
aCAS - - a CAS to analyze.
Returns:
- returns a unique identifier associated with the sent CAS
Throws:
org.apache.uima.resource.ResourceProcessException

handleCollectionProcessCompleteReply

protected void handleCollectionProcessCompleteReply(javax.jms.Message message)
                                             throws java.lang.Exception
Handles response to CollectionProcessComplete request.

Throws:
java.lang.Exception

handleMetadataReply

protected void handleMetadataReply(javax.jms.Message message)
                            throws java.lang.Exception
Handles response to GetMeta Request. Deserializes ResourceMetaData and initializes CasManager.

Parameters:
message - - jms message containing serialized ResourceMetaData
Throws:
java.lang.Exception

notifyListeners

protected void notifyListeners(org.apache.uima.cas.CAS aCAS,
                               org.apache.uima.collection.EntityProcessStatus aStatus,
                               int aCommand)

cancelTimer

protected void cancelTimer(java.lang.String identifier)

wakeUpSendThread

protected void wakeUpSendThread(BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest)
                         throws java.lang.Exception
Throws:
java.lang.Exception

handleServiceInfo

protected void handleServiceInfo(javax.jms.Message message)
                          throws java.lang.Exception
Handles a ServiceInfo message returned from the Cas Multiplier. The primary purpose of this message is to provide the client with a dedicated queue object where the client may send messages to the specific CM service instance. An example of this would be a stop request that client needs to send to the specific Cas Multiplier.

Parameters:
message - - message received from a service
Throws:
java.lang.Exception

decrementOutstandingCasCounter

protected void decrementOutstandingCasCounter()

handleProcessReply

protected void handleProcessReply(javax.jms.Message message,
                                  boolean doNotify,
                                  org.apache.uima.util.ProcessTrace pt)
                           throws java.lang.Exception
Handles response to Process CAS request. If the message originated in a service that is running in a separate jvm (remote), deserialize the CAS and notify the application of the completed analysis via application listener.

Parameters:
message - - jms message containing serialized CAS
Throws:
java.lang.Exception

handleNonProcessException

protected void handleNonProcessException(java.lang.Exception exception)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

handleException

protected void handleException(java.lang.Exception exception,
                               java.lang.String casReferenceId,
                               java.lang.String inputCasReferenceId,
                               BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest,
                               boolean doNotify)
                        throws java.lang.Exception
Throws:
java.lang.Exception

handleException

protected void handleException(java.lang.Exception exception,
                               java.lang.String casReferenceId,
                               java.lang.String inputCasReferenceId,
                               BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest,
                               boolean doNotify,
                               boolean rethrow)
                        throws java.lang.Exception
Throws:
java.lang.Exception

handleException

protected void handleException(javax.jms.Message message,
                               BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest,
                               boolean doNotify)
                        throws java.lang.Exception
Throws:
java.lang.Exception

removeFromCache

protected void removeFromCache(java.lang.String aCasReferenceId)

deserialize

protected org.apache.uima.cas.CAS deserialize(java.lang.String aSerializedCAS,
                                              org.apache.uima.cas.CAS aCAS)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

deserialize

protected org.apache.uima.cas.CAS deserialize(java.lang.String aSerializedCAS,
                                              org.apache.uima.cas.CAS aCAS,
                                              org.apache.uima.cas.impl.XmiSerializationSharedData deserSharedData,
                                              boolean deltaCas)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

deserialize

protected org.apache.uima.cas.CAS deserialize(byte[] binaryData,
                                              BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

deserializeCAS

protected org.apache.uima.cas.CAS deserializeCAS(java.lang.String aSerializedCAS,
                                                 BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest)
                                          throws java.lang.Exception
Throws:
java.lang.Exception

deserializeCAS

protected org.apache.uima.cas.CAS deserializeCAS(byte[] aSerializedCAS,
                                                 BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest)
                                          throws java.lang.Exception
Throws:
java.lang.Exception

deserializeCAS

protected org.apache.uima.cas.CAS deserializeCAS(byte[] aSerializedCAS,
                                                 org.apache.uima.cas.CAS aCas)
                                          throws java.lang.Exception
Throws:
java.lang.Exception

deserializeCAS

protected org.apache.uima.cas.CAS deserializeCAS(java.lang.String aSerializedCAS,
                                                 BaseUIMAAsynchronousEngineCommon_impl.ClientRequest cachedRequest,
                                                 boolean deltaCas)
                                          throws java.lang.Exception
Throws:
java.lang.Exception

deserializeCAS

protected org.apache.uima.cas.CAS deserializeCAS(java.lang.String aSerializedCAS,
                                                 java.lang.String aCasPoolName)
                                          throws java.lang.Exception
Throws:
java.lang.Exception

deserializeCAS

protected org.apache.uima.cas.CAS deserializeCAS(byte[] aSerializedCAS,
                                                 java.lang.String aCasPoolName)
                                          throws java.lang.Exception
Throws:
java.lang.Exception

onMessage

public void onMessage(javax.jms.Message message)
Listener method receiving JMS Messages from the response queue.

Specified by:
onMessage in interface javax.jms.MessageListener

getMetaData

public org.apache.uima.resource.metadata.ProcessingResourceMetaData getMetaData()
                                                                         throws org.apache.uima.resource.ResourceInitializationException
Gets the ProcessingResourceMetadata for the asynchronous AnalysisEngine.

Specified by:
getMetaData in interface UimaAsynchronousEngine
Throws:
org.apache.uima.resource.ResourceInitializationException

sendAndReceiveCAS

public java.lang.String sendAndReceiveCAS(org.apache.uima.cas.CAS aCAS,
                                          org.apache.uima.util.ProcessTrace pt)
                                   throws org.apache.uima.resource.ResourceProcessException
This is a synchronous method which sends a message to a destination and blocks waiting for a reply.

Throws:
org.apache.uima.resource.ResourceProcessException

sendAndReceiveCAS

public java.lang.String sendAndReceiveCAS(org.apache.uima.cas.CAS aCAS)
                                   throws org.apache.uima.resource.ResourceProcessException
Description copied from interface: UimaAsynchronousEngine
This synchronous method sends a given CAS to a UIMA AS service and waits for response. The method either returns a CAS with the result of analysis or throws an exception. It doesn't use call-backs through a registered application listener.

Specified by:
sendAndReceiveCAS in interface UimaAsynchronousEngine
Parameters:
aCAS - - a CAS to analyze.
Returns:
- a unique id assigned to the CAS
Throws:
org.apache.uima.resource.ResourceProcessException

notifyOnTimout

protected void notifyOnTimout(org.apache.uima.cas.CAS aCAS,
                              java.lang.String anEndpoint,
                              int aTimeoutKind,
                              java.lang.String casReferenceId)

getMessageProducer

protected javax.jms.MessageProducer getMessageProducer(javax.jms.Destination destination)
                                                throws java.lang.Exception
Throws:
java.lang.Exception

onProducerInitialized

protected void onProducerInitialized()
Called when the producer thread is fully initialized


connectionOpen

public boolean connectionOpen()

recoverSharedConnectionIfClosed

public boolean recoverSharedConnectionIfClosed()
Continuously tries to recover connection a broker. it gives up when the client is stopped or the connection is recovered.


onException

public void onException(java.lang.Exception aFailure,
                        java.lang.String aDestination)

setReleaseCASMessage

protected void setReleaseCASMessage(javax.jms.TextMessage msg,
                                    java.lang.String aCasReferenceId)
                             throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2011. All Rights Reserved.