bexee.core
Class Dispatcher

java.lang.Object
  extended byjava.lang.Thread
      extended bybexee.core.Dispatcher
All Implemented Interfaces:
java.lang.Runnable

public class Dispatcher
extends java.lang.Thread

This class is used to lookup or create a ProcessInstance given an inbound BexeeMessage and dispatch the message to the ProcessControllereither synchronously or asynchronoulsy.

To do this, create the object and then use its dispatch()method.

When the Dispatcher kicks off the ProcessController it will know, whether a synchronous or asynchronous BPEL process is to be started. Depending on that it will either return right away after starting the process for an asynchronous BPEL process or it will wait until the result is available for a synchronous BPEL process.

Either way the ProcessController's processMessage() method is started in a new Thread, but in case of a synchronous BPEL process the Dispatcher will wait until the result is available. This happens by obtaining a lock on the ProcessContext, which will notify the Dispatcher when the result is available.

Version:
$Revision: 1.1 $, $Date: 2004/12/15 14:18:10 $
Author:
Patric Fornasier, Pawel Kowalski

Field Summary
static java.lang.String ASYNC_RESULT
          Result when processing an asynchronous result.
protected  ProcessController controller
           
protected  ProcessInstance instance
           
protected  BexeeMessage message
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Dispatcher(BexeeMessage message)
          Creates a new Dispatcher object.
 
Method Summary
 java.lang.Object dispatch()
          Calls the ProcessControllers ProcessController.processMessage(ProcessInstance, BexeeMessage) method either synchronously or asynchronously.
protected  BPELProcess getBPELProcess(BexeeMessage message)
          Gets the BPELProcess belonging to the incoming message.
protected  ProcessContext getProcessContext(BexeeMessage message)
          Gets the ProcessContext belonging to the incoming message.
 void run()
          Do not use this method directly.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ASYNC_RESULT

public static final java.lang.String ASYNC_RESULT
Result when processing an asynchronous result. This might change in future versions.

See Also:
Constant Field Values

controller

protected ProcessController controller

instance

protected ProcessInstance instance

message

protected BexeeMessage message
Constructor Detail

Dispatcher

public Dispatcher(BexeeMessage message)
Creates a new Dispatcher object.

Parameters:
message - the incoming message
Method Detail

dispatch

public java.lang.Object dispatch()
                          throws DispatcherException
Calls the ProcessControllers ProcessController.processMessage(ProcessInstance, BexeeMessage) method either synchronously or asynchronously.

Note that this method may take minutes or hours for long-running synchronous processes.

Returns:
the result
Throws:
DispatcherException - If something went wrong dispatching the message. This can happen for example if the BPELProcess or the ProcessContext can't be found or created or if something went wrong processing the message in the ProcessController.

run

public void run()
Do not use this method directly. Use dispatch()instead.


getProcessContext

protected ProcessContext getProcessContext(BexeeMessage message)
Gets the ProcessContext belonging to the incoming message.

Parameters:
message - the incoming message
Returns:
a new ProcessContext if there is currently no process running or the ProcessContext instance belonging to the incoming message if there is a process running already.

getBPELProcess

protected BPELProcess getBPELProcess(BexeeMessage message)
Gets the BPELProcess belonging to the incoming message.

Parameters:
message - the incoming message
Returns:
the BPELProcess that will be identified by the incoming message or null if it can't be found.


Copyright © 2004 Berne University of Applied Sciences. All Rights Reserved.