public class Network
extends java.lang.Object
Constructor and Description |
---|
Network(int threads,
ReteEngine engine) |
Modifier and Type | Method and Description |
---|---|
void |
connectRemoteNodes(Address<? extends Supplier> supplier,
Address<? extends Receiver> receiver,
boolean synchronise)
Establishes connection between a supplier and a receiver node, regardless which container they are in.
|
void |
disconnectRemoteNodes(Address<? extends Supplier> supplier,
Address<? extends Receiver> receiver,
boolean desynchronise)
Severs connection between a supplier and a receiver node, regardless which container they are in.
|
java.util.List<ReteContainer> |
getContainers() |
ReteEngine |
getEngine() |
Address<? extends Node> |
getExistingNodeByRecipe(ReteNodeRecipe recipe) |
ReteContainer |
getHeadContainer()
Returns the head container, that is guaranteed to reside in the same JVM as the Network object.
|
InputConnector |
getInputConnector() |
ReteContainer |
getNextContainer()
Returns the next container in round-robin fashion.
|
Address<? extends Node> |
getNodeByRecipeIfExists(ReteNodeRecipe recipe) |
org.eclipse.incquery.runtime.rete.network.NodeFactory |
getNodeFactory() |
java.util.Set<RecipeTraceInfo> |
getRecipeTraces() |
java.util.concurrent.locks.Lock |
getStructuralChangeLock() |
void |
kill()
Kills this Network along with all containers and message consumption cycles.
|
void |
sendConstructionUpdate(Address<? extends Receiver> receiver,
Direction direction,
Tuple updateElement)
Sends an update message to the receiver node, indicating a newly found or lost partial matching.
|
void |
sendConstructionUpdates(Address<? extends Receiver> receiver,
Direction direction,
java.util.Collection<Tuple> updateElements)
Sends multiple update messages atomically to the receiver node, indicating a newly found or lost partial
matching.
|
void |
sendExternalUpdate(Address<? extends Receiver> receiver,
Direction direction,
Tuple updateElement)
Sends an update message to the receiver node, indicating a newly found or lost partial matching.
|
void |
waitForReteTermination()
Waits until all rete update operations are settled in all containers.
|
void |
waitForReteTermination(java.lang.Runnable action)
Waits to execute action until all rete update operations are settled in all containers.
|
public Network(int threads, ReteEngine engine)
threads
- the number of threads to operate the network with; 0 means single-threaded operation, 1 starts an
asynchronous thread to operate the RETE net, >1 uses multiple RETE containers.public Address<? extends Node> getExistingNodeByRecipe(ReteNodeRecipe recipe)
java.lang.IllegalStateException
- if no node has been constructed for the recipepublic Address<? extends Node> getNodeByRecipeIfExists(ReteNodeRecipe recipe)
public void kill()
public ReteContainer getHeadContainer()
public ReteContainer getNextContainer()
public void sendExternalUpdate(Address<? extends Receiver> receiver, Direction direction, Tuple updateElement)
public void sendConstructionUpdate(Address<? extends Receiver> receiver, Direction direction, Tuple updateElement)
public void sendConstructionUpdates(Address<? extends Receiver> receiver, Direction direction, java.util.Collection<Tuple> updateElements)
public void connectRemoteNodes(Address<? extends Supplier> supplier, Address<? extends Receiver> receiver, boolean synchronise)
supplier
- receiver
- synchronise
- indicates whether the receiver should be synchronised to the current contents of the supplierpublic void disconnectRemoteNodes(Address<? extends Supplier> supplier, Address<? extends Receiver> receiver, boolean desynchronise)
supplier
- receiver
- desynchronise
- indicates whether the current contents of the supplier should be subtracted from the receiverpublic void waitForReteTermination()
public void waitForReteTermination(java.lang.Runnable action)
action
- the action to be run when reaching the steady-state.
To be called from any user thread.public java.util.Set<RecipeTraceInfo> getRecipeTraces()
public java.util.List<ReteContainer> getContainers()
public java.util.concurrent.locks.Lock getStructuralChangeLock()
public org.eclipse.incquery.runtime.rete.network.NodeFactory getNodeFactory()
public InputConnector getInputConnector()
public ReteEngine getEngine()