Class ReteContainer
java.lang.Object
tools.refinery.interpreter.rete.network.ReteContainer
- Since:
- 2.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final IQueryBackendContext
protected LinkedList
<Clearable> protected Long
protected tools.refinery.interpreter.rete.network.ConnectionFactory
protected Thread
protected Set
<DelayedCommand> protected Set
<DelayedCommand> protected boolean
protected Object
protected Deque
<tools.refinery.interpreter.rete.network.UpdateMessage> protected Deque
<tools.refinery.interpreter.rete.network.UpdateMessage> protected boolean
protected final org.apache.log4j.Logger
protected Network
protected long
protected NodeProvisioner
protected Map
<ReteContainer, Long> protected final TimelyConfiguration
protected final CommunicationTracker
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
clearAll()
Clears all memory contents in the network.void
Connects a receiver to a suppliervoid
connectAndSynchronize
(Supplier supplier, Receiver receiver) Connects a receiver to a remote supplier, and synchronizes it to the current contents of the suppliervoid
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
connectRemoteSupplier
(Address<? extends Supplier> supplier, Receiver receiver, boolean synchronise) Establishes connection between a remote supplier and a local receiver node.void
Sends out all pending messages to their receivers.void
disconnect
(Supplier supplier, Receiver receiver) Disconnects a receiver from a suppliervoid
disconnectAndDesynchronize
(Supplier supplier, Receiver receiver) Disconnects a receiver from a suppliervoid
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.void
disconnectRemoteSupplier
(Address<? extends Supplier> supplier, Receiver receiver, boolean desynchronise) Severs connection between a remote supplier and a local receiver node.void
void
Finalises all update sequences and returns.Access all the Rete nodes inside this container.tools.refinery.interpreter.rete.network.ConnectionFactory
tools.refinery.interpreter.rete.network.NodeFactory
boolean
boolean
Checks whether a certain address points to a node at this container.boolean
void
kill()
Stops this container.makeAddress
(N node) Provides an external address for the selected node.pullContents
(Supplier supplier, boolean flush) Retrieves a safe copy of the contents of a supplier.pullContentsWithTimeline
(Supplier supplier, boolean flush) pullPropagatedContents
(SingleInputNode supplier, boolean flush) Retrieves the contents of a SingleInputNode's parentage.pullPropagatedContentsWithTimestamp
(SingleInputNode supplier, boolean flush) Retrieves the timestamp-aware contents of a SingleInputNode's parentage.void
Registers a pattern memory into the rete network.long
registerNode
(Node n) Registers a node into the rete network (should be called by constructor).remotePosMapping
(Address<? extends ProductionNode> production) Proxies for the getPosMapping() of Production nodes.remotePull
(Address<? extends Supplier> supplier, boolean flush) Retrieves the contents of a supplier for a remote caller.<N extends Node>
NresolveLocal
(Address<N> address) Returns an addressed node at this container.void
sendUpdateToRemoteAddress
(Address<? extends Receiver> address, Direction direction, Tuple updateElement) Sends an update message to a node in a different container.toString()
void
Unregisters a pattern memory from the rete network.void
Unregisters a node from the rete network.
-
Field Details
-
consumerThread
-
killed
protected boolean killed -
network
-
clearables
-
nodesById
-
nextId
protected long nextId -
connectionFactory
protected tools.refinery.interpreter.rete.network.ConnectionFactory connectionFactory -
nodeProvisioner
-
internalMessageQueue
-
externalMessageQueue
-
externalMessageLock
-
clock
-
terminationCriteria
-
logger
protected final org.apache.log4j.Logger logger -
tracker
-
backendContext
-
delayedCommandQueue
-
delayedCommandBuffer
-
executingDelayedCommands
protected boolean executingDelayedCommands -
timelyConfiguration
-
NAME_MAPPER
- Since:
- 1.6
-
-
Constructor Details
-
ReteContainer
- Parameters:
threaded
- false if operating in a single-threaded environment
-
-
Method Details
-
isTimelyEvaluation
public boolean isTimelyEvaluation()- Since:
- 2.4
-
getTimelyConfiguration
- Since:
- 2.4
-
getCommunicationTracker
- Returns:
- the communication graph of the nodes, incl. message scheduling
- Since:
- 1.6
-
kill
public void kill()Stops this container. To be called by Network.kill() -
connectRemoteNodes
public 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. Assumption is that this container is the home of the receiver, but it is not strictly necessary.- Parameters:
synchronise
- indicates whether the receiver should be synchronised to the current contents of the supplier
-
disconnectRemoteNodes
public 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. Assumption is that this container is the home of the receiver, but it is not strictly necessary.- Parameters:
desynchronise
- indicates whether the current contents of the supplier should be subtracted from the receiver
-
connectRemoteSupplier
public void connectRemoteSupplier(Address<? extends Supplier> supplier, Receiver receiver, boolean synchronise) Establishes connection between a remote supplier and a local receiver node.- Parameters:
synchronise
- indicates whether the receiver should be synchronised to the current contents of the supplier
-
disconnectRemoteSupplier
public void disconnectRemoteSupplier(Address<? extends Supplier> supplier, Receiver receiver, boolean desynchronise) Severs connection between a remote supplier and a local receiver node.- Parameters:
desynchronise
- indicates whether the current contents of the supplier should be subtracted from the receiver
-
connect
Connects a receiver to a supplier -
disconnect
Disconnects a receiver from a supplier -
isExecutingDelayedCommands
public boolean isExecutingDelayedCommands()- Since:
- 2.3
-
getDelayedCommandQueue
- Since:
- 2.3
-
connectAndSynchronize
Connects a receiver to a remote supplier, and synchronizes it to the current contents of the supplier -
disconnectAndDesynchronize
Disconnects a receiver from a supplier -
executeDelayedCommands
public void executeDelayedCommands()- Since:
- 2.3
-
sendUpdateToRemoteAddress
public void sendUpdateToRemoteAddress(Address<? extends Receiver> address, Direction direction, Tuple updateElement) Sends an update message to a node in a different container. The receiver is indicated by the Address. Designed to be called by RemoteReceivers, DO NOT use in any other way.- Since:
- 2.4
-
flushUpdates
public void flushUpdates()Finalises all update sequences and returns. To be called from user threads (e.g. network construction). -
pullContents
Retrieves a safe copy of the contents of a supplier.Note that there may be multiple copies of a Tuple in case of a
TrimmerNode
, so the result is not always a set.- Parameters:
flush
- if true, a flush is performed before pulling the contents- Since:
- 2.3
-
pullContentsWithTimeline
- Since:
- 2.4
-
pullPropagatedContents
Retrieves the contents of a SingleInputNode's parentage.- Since:
- 2.3
-
pullPropagatedContentsWithTimestamp
public Map<Tuple,Timeline<Timestamp>> pullPropagatedContentsWithTimestamp(SingleInputNode supplier, boolean flush) Retrieves the timestamp-aware contents of a SingleInputNode's parentage.- Since:
- 2.3
-
remotePull
Retrieves the contents of a supplier for a remote caller. Assumption is that this container is the home of the supplier, but it is not strictly necessary.- Parameters:
supplier
- the address of the supplier to be pulled.- Since:
- 2.3
-
remotePosMapping
Proxies for the getPosMapping() of Production nodes. Retrieves the posmapping of a remote or local Production to a remote or local caller. -
deliverMessagesSingleThreaded
public void deliverMessagesSingleThreaded()Sends out all pending messages to their receivers. The delivery is governed by the communication tracker.- Since:
- 1.6
-
makeAddress
Provides an external address for the selected node. -
isLocal
Checks whether a certain address points to a node at this container. -
resolveLocal
Returns an addressed node at this container.- Throws:
IllegalArgumentException
- if address is non-local
-
registerNode
Registers a node into the rete network (should be called by constructor). Every node MUST be registered by its constructor.- Returns:
- the unique nodeId issued to the node.
-
unregisterNode
Unregisters a node from the rete network. Do NOT call if node is still connected to other Nodes, or Adressed or otherwise referenced. -
registerClearable
Registers a pattern memory into the rete network. Every memory MUST be registered by its owner node. -
unregisterClearable
Unregisters a pattern memory from the rete network. -
clearAll
public void clearAll()Clears all memory contents in the network. Reverts to initial state. -
getNodeFactory
public tools.refinery.interpreter.rete.network.NodeFactory getNodeFactory() -
getConnectionFactory
public tools.refinery.interpreter.rete.network.ConnectionFactory getConnectionFactory() -
getProvisioner
-
getNetwork
-
toString
-
getAllNodes
Access all the Rete nodes inside this container.- Returns:
- the collection of
Node
instances
-
getInputConnectionFactory
-
checkCancelled
public void checkCancelled()
-