com.hammurapi.eventbus.local
Class LocalEventBusBase<E,P extends Comparable<P>,C,S extends EventStore<E,P,C,AbstractEventBus.Handle<E,P,C,Long>,S>>

Show UML class diagram
java.lang.Object
  extended by com.hammurapi.eventbus.AbstractEventBus<E,P,C,Long,AbstractEventBus.Handle<E,P,C,Long>,S>
      extended by com.hammurapi.eventbus.local.LocalEventBusBase<E,P,C,S>
Type Parameters:
E - Event type.
P - Handler priority type.
C - Context type.
K - Registration key type.
All Implemented Interfaces:
EventBus<E,P,C,Long,AbstractEventBus.Handle<E,P,C,Long>,S>
Direct Known Subclasses:
LocalEventBus

public class LocalEventBusBase<E,P extends Comparable<P>,C,S extends EventStore<E,P,C,AbstractEventBus.Handle<E,P,C,Long>,S>>
extends AbstractEventBus<E,P,C,Long,AbstractEventBus.Handle<E,P,C,Long>,S>

Base class for event bus which functions within JVM boundaries.


Nested Class Summary
static class LocalEventBusBase.Config<E,P extends Comparable<P>,C,S extends EventStore<E,P,C,AbstractEventBus.Handle<E,P,C,Long>,S>>
          Bus configurator.
 
Nested classes/interfaces inherited from class com.hammurapi.eventbus.AbstractEventBus
AbstractEventBus.CreateMasterHandleResult, AbstractEventBus.DerivationEx<K>, AbstractEventBus.Handle<E,P extends Comparable<P>,C,K>, AbstractEventBus.Snapshot<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>, AbstractEventBus.StateSnapshot<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>, AbstractEventBus.StoreEntry<E,P extends Comparable<P>,C,K>
 
Constructor Summary
LocalEventBusBase(LocalEventBusBase.Config<E,P,C,S> config)
           
 
Method Summary
protected  TrackingExecutorService createExecutorService(boolean oneOff, String name)
          Create a wrapper around the root executor service for task tracking purposes.
protected  TrackingExecutorService createExecutorService(ExecutorService master, boolean oneOff, String name)
          Creates a wrapper around the master executor service for task tracking purposes.
protected  InferenceContext<E,P,C,Long,AbstractEventBus.Handle<E,P,C,Long>,S> createInferenceContext()
          Creates inference context with zero chain length and no root handle.
protected  TrackingExecutorService getExecutorService()
          Returns "root" executor service to submit predicate evaluation and handler execution tasks to.
 int getMaxDerivationDepth()
           
protected  Lock getRtcLock()
           
protected  AbstractEventBus.Handle<E,P,C,Long> newMasterHandle(PostCommand<E,P,C,Long,AbstractEventBus.Handle<E,P,C,Long>,S> postCommand)
          Instantiates master handle.
protected  Long nextId()
          Generates handler ID.
protected  AbstractEventBus.Handle<E,P,C,Long> processInferenceCommand(InferenceCommand<E,P,C,Long,AbstractEventBus.Handle<E,P,C,Long>,S> command)
          To make it visible to local classes.
protected  void processRemoveCommand(RemoveCommand<E,P,C,Long,AbstractEventBus.Handle<E,P,C,Long>,S> command)
           
 void remove(E event)
          Removes event from the bus.
 void setMaxDerivationDepth(int maxDerivationDepth)
           
 
Methods inherited from class com.hammurapi.eventbus.AbstractEventBus
addHandler, createMasterHandle, getDerivations, getEventType, getExceptionHandler, getInferencePolicy, getStore, join, join, manageHandlers, post, removeHandlers, removeHandlers, reset, setExceptionHandler, takeSnapshot, workingMemorySnapshot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalEventBusBase

public LocalEventBusBase(LocalEventBusBase.Config<E,P,C,S> config)
Method Detail

getMaxDerivationDepth

public int getMaxDerivationDepth()

setMaxDerivationDepth

public void setMaxDerivationDepth(int maxDerivationDepth)

createExecutorService

protected TrackingExecutorService createExecutorService(ExecutorService master,
                                                        boolean oneOff,
                                                        String name)
Description copied from class: AbstractEventBus
Creates a wrapper around the master executor service for task tracking purposes.

Specified by:
createExecutorService in class AbstractEventBus<E,P extends Comparable<P>,C,Long,AbstractEventBus.Handle<E,P extends Comparable<P>,C,Long>,S extends EventStore<E,P,C,AbstractEventBus.Handle<E,P,C,Long>,S>>
Parameters:
master - Master executor service
Returns:

createExecutorService

protected TrackingExecutorService createExecutorService(boolean oneOff,
                                                        String name)
Description copied from class: AbstractEventBus
Create a wrapper around the root executor service for task tracking purposes.

Specified by:
createExecutorService in class AbstractEventBus<E,P extends Comparable<P>,C,Long,AbstractEventBus.Handle<E,P extends Comparable<P>,C,Long>,S extends EventStore<E,P,C,AbstractEventBus.Handle<E,P,C,Long>,S>>
Returns:
executor service or null for the synchronous mode.

getExecutorService

protected TrackingExecutorService getExecutorService()
Description copied from class: AbstractEventBus
Returns "root" executor service to submit predicate evaluation and handler execution tasks to.

Specified by:
getExecutorService in class AbstractEventBus<E,P extends Comparable<P>,C,Long,AbstractEventBus.Handle<E,P extends Comparable<P>,C,Long>,S extends EventStore<E,P,C,AbstractEventBus.Handle<E,P,C,Long>,S>>

nextId

protected Long nextId()
Description copied from class: AbstractEventBus
Generates handler ID.

Specified by:
nextId in class AbstractEventBus<E,P extends Comparable<P>,C,Long,AbstractEventBus.Handle<E,P extends Comparable<P>,C,Long>,S extends EventStore<E,P,C,AbstractEventBus.Handle<E,P,C,Long>,S>>
Returns:

newMasterHandle

protected AbstractEventBus.Handle<E,P,C,Long> newMasterHandle(PostCommand<E,P,C,Long,AbstractEventBus.Handle<E,P,C,Long>,S> postCommand)
Description copied from class: AbstractEventBus
Instantiates master handle.

Specified by:
newMasterHandle in class AbstractEventBus<E,P extends Comparable<P>,C,Long,AbstractEventBus.Handle<E,P extends Comparable<P>,C,Long>,S extends EventStore<E,P,C,AbstractEventBus.Handle<E,P,C,Long>,S>>
Returns:

remove

public void remove(E event)
Description copied from interface: EventBus
Removes event from the bus.


getRtcLock

protected Lock getRtcLock()
Specified by:
getRtcLock in class AbstractEventBus<E,P extends Comparable<P>,C,Long,AbstractEventBus.Handle<E,P extends Comparable<P>,C,Long>,S extends EventStore<E,P,C,AbstractEventBus.Handle<E,P,C,Long>,S>>

processInferenceCommand

protected AbstractEventBus.Handle<E,P,C,Long> processInferenceCommand(InferenceCommand<E,P,C,Long,AbstractEventBus.Handle<E,P,C,Long>,S> command)
To make it visible to local classes.

Overrides:
processInferenceCommand in class AbstractEventBus<E,P extends Comparable<P>,C,Long,AbstractEventBus.Handle<E,P extends Comparable<P>,C,Long>,S extends EventStore<E,P,C,AbstractEventBus.Handle<E,P,C,Long>,S>>
Parameters:
command - command to be processed

createInferenceContext

protected InferenceContext<E,P,C,Long,AbstractEventBus.Handle<E,P,C,Long>,S> createInferenceContext()
Description copied from class: AbstractEventBus
Creates inference context with zero chain length and no root handle. Inference queue is supplied with AFTER_EVENT, AFTER_ROOT_EVENT and EXCLUSIVE policies. Use this method to create initial/root inference context.

Specified by:
createInferenceContext in class AbstractEventBus<E,P extends Comparable<P>,C,Long,AbstractEventBus.Handle<E,P extends Comparable<P>,C,Long>,S extends EventStore<E,P,C,AbstractEventBus.Handle<E,P,C,Long>,S>>
Returns:

processRemoveCommand

protected void processRemoveCommand(RemoveCommand<E,P,C,Long,AbstractEventBus.Handle<E,P,C,Long>,S> command)
Specified by:
processRemoveCommand in class AbstractEventBus<E,P extends Comparable<P>,C,Long,AbstractEventBus.Handle<E,P extends Comparable<P>,C,Long>,S extends EventStore<E,P,C,AbstractEventBus.Handle<E,P,C,Long>,S>>