Class JMSJobExecutionContext
- java.lang.Object
-
- com.levigo.jadice.server.jms.core.JMSJobExecutionContext
-
- All Implemented Interfaces:
JobExecutionContext
,com.levigo.jadice.server.jms.shared.internal.MessageProcessor
,com.levigo.jadice.server.shared.watchdog.internal.WatchdogListener
public class JMSJobExecutionContext extends Object implements JobExecutionContext, com.levigo.jadice.server.shared.watchdog.internal.WatchdogListener, com.levigo.jadice.server.jms.shared.internal.MessageProcessor
The JMS specific implementation of aJMSJobExecutionContext
- Since:
- jadice server 5.5.0.0
-
-
Constructor Summary
Constructors Constructor Description JMSJobExecutionContext(com.levigo.jadice.server.client.internal.DefaultJobInternalImpl clientJob, JobScheduler scheduler, JMSRequestEndpoint requestEndpoint, StreamTransportFactory transport, javax.jms.Message initMessage, javax.jms.QueueConnection queueConnection, javax.jms.QueueSession session, com.levigo.jadice.server.jms.shared.internal.MessageDispatcher messageDispatcher, javax.jms.Queue rxQueue, javax.jms.Queue txQueue, String correlationId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
announceSubPipelineCreation(Node parent, Set<? extends Node> createdNodes)
Notify the client that aSubPipeline
has been created on the server sideboolean
bark(long delay, TimeUnit unit, String watchdogID)
AWatchdogTimer
barks.Job
getClientJob()
String
getCorrelationId()
javax.jms.Message
getInitMessage()
com.levigo.jadice.server.jms.shared.internal.MessageDispatcher
getMessageDispatcher()
javax.jms.QueueSender
getQueueSender()
javax.jms.Queue
getRxQueue()
ServerJob
getServerJob()
javax.jms.QueueSession
getSession()
javax.jms.Queue
getTxQueue()
void
init(ServerJob serverJob)
void
messageReceived(javax.jms.Message message, com.levigo.jadice.server.jms.shared.internal.ServerMessage.MessageType type)
Receive notification about a message of the given type.void
notifyJobLaunchFailed(org.jadice.util.log.qualified.MessageID messageID, Throwable cause)
Notify the client that an error occurred while launching this jobvoid
sendLogMessage(NodeWorker<?> worker, org.jadice.util.log.qualified.QualifiedLogEvent event)
Send a log message to the client.void
sendLogMessage(NodeWorker<?> worker, org.jadice.util.log.qualified.QualifiedLogEvent event, org.jadice.util.log.Level level)
Send a log message to the client with a specific logLevel
void
sendStateUpdate(Job.State state)
void
shutdown()
Shuts down this context and close the connection to the client.
-
-
-
Constructor Detail
-
JMSJobExecutionContext
public JMSJobExecutionContext(com.levigo.jadice.server.client.internal.DefaultJobInternalImpl clientJob, JobScheduler scheduler, JMSRequestEndpoint requestEndpoint, StreamTransportFactory transport, javax.jms.Message initMessage, javax.jms.QueueConnection queueConnection, javax.jms.QueueSession session, com.levigo.jadice.server.jms.shared.internal.MessageDispatcher messageDispatcher, javax.jms.Queue rxQueue, javax.jms.Queue txQueue, String correlationId) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
-
Method Detail
-
getClientJob
public Job getClientJob()
- Specified by:
getClientJob
in interfaceJobExecutionContext
- Returns:
- The
Job
which is being executed in this context.
-
getServerJob
public ServerJob getServerJob() throws IllegalStateException
- Specified by:
getServerJob
in interfaceJobExecutionContext
- Returns:
- the
ServerJob
which is being executed in this context. - Throws:
IllegalStateException
- if this method is called before init.
-
getMessageDispatcher
public com.levigo.jadice.server.jms.shared.internal.MessageDispatcher getMessageDispatcher()
-
getRxQueue
public javax.jms.Queue getRxQueue()
-
getTxQueue
public javax.jms.Queue getTxQueue()
-
getCorrelationId
public String getCorrelationId()
-
getInitMessage
public javax.jms.Message getInitMessage()
-
getSession
public javax.jms.QueueSession getSession()
-
init
public void init(ServerJob serverJob) throws JobException
Description copied from interface:JobExecutionContext
- Specified by:
init
in interfaceJobExecutionContext
- Parameters:
serverJob
- TheServerJob
that will perform the work- Throws:
JobException
- if an error occurred while initializing this context.
-
sendLogMessage
public void sendLogMessage(NodeWorker<?> worker, org.jadice.util.log.qualified.QualifiedLogEvent event, org.jadice.util.log.Level level)
Description copied from interface:JobExecutionContext
Send a log message to the client with a specific logLevel
- Specified by:
sendLogMessage
in interfaceJobExecutionContext
- Parameters:
worker
- TheNodeWorker
that caused that eventevent
- The event itselflevel
- TheLevel
of that event
-
sendLogMessage
public void sendLogMessage(NodeWorker<?> worker, org.jadice.util.log.qualified.QualifiedLogEvent event)
Description copied from interface:JobExecutionContext
Send a log message to the client.- Specified by:
sendLogMessage
in interfaceJobExecutionContext
- Parameters:
worker
- TheNodeWorker
that caused that eventevent
- The event itself
-
getQueueSender
public javax.jms.QueueSender getQueueSender()
-
sendStateUpdate
public void sendStateUpdate(Job.State state)
Description copied from interface:JobExecutionContext
- Specified by:
sendStateUpdate
in interfaceJobExecutionContext
- Parameters:
state
- the new state- See Also:
Job.getState()
-
announceSubPipelineCreation
public void announceSubPipelineCreation(Node parent, Set<? extends Node> createdNodes)
Description copied from interface:JobExecutionContext
Notify the client that aSubPipeline
has been created on the server side- Specified by:
announceSubPipelineCreation
in interfaceJobExecutionContext
- Parameters:
parent
- TheNode
that is responsible for the new sub pipelinecreatedNodes
- TheNode
s which build the sub pipeline
-
shutdown
public void shutdown()
Description copied from interface:JobExecutionContext
Shuts down this context and close the connection to the client.- Specified by:
shutdown
in interfaceJobExecutionContext
-
bark
public boolean bark(long delay, TimeUnit unit, String watchdogID)
Description copied from interface:com.levigo.jadice.server.shared.watchdog.internal.WatchdogListener
AWatchdogTimer
barks.- Specified by:
bark
in interfacecom.levigo.jadice.server.shared.watchdog.internal.WatchdogListener
watchdogID
- TODO- Returns:
true
, to instruct the watchdog to bark again (after the prescribed delay) as if nothing had happened,false
to make it stop barking.
-
messageReceived
public void messageReceived(javax.jms.Message message, com.levigo.jadice.server.jms.shared.internal.ServerMessage.MessageType type)
Description copied from interface:com.levigo.jadice.server.jms.shared.internal.MessageProcessor
Receive notification about a message of the given type.- Specified by:
messageReceived
in interfacecom.levigo.jadice.server.jms.shared.internal.MessageProcessor
-
notifyJobLaunchFailed
public void notifyJobLaunchFailed(org.jadice.util.log.qualified.MessageID messageID, Throwable cause)
Description copied from interface:JobExecutionContext
Notify the client that an error occurred while launching this job- Specified by:
notifyJobLaunchFailed
in interfaceJobExecutionContext
- Parameters:
messageID
- TheMessageID
of the error that prevents the successful job launchingcause
- (optional) The Exception that has occurred
-
-