public class ReteEngine extends java.lang.Object implements IQueryBackend
Constructor and Description |
---|
ReteEngine(org.apache.log4j.Logger logger,
IQueryRuntimeContext runtimeContext,
int reteThreads) |
Modifier and Type | Method and Description |
---|---|
RetePatternMatcher |
accessMatcher(PQuery query)
Accesses the patternmatcher for a given pattern, constructs one if a matcher is not available yet.
|
void |
addDisconnectable(Disconnectable disc) |
void |
buildMatchersCoalesced(java.util.Collection<PQuery> specifications)
Constructs RETE pattern matchers for a collection of patterns, if they are not available yet.
|
void |
dispose()
Disposes the query backend.
|
ReteBoundary |
getBoundary() |
ReteRecipeCompiler |
getCompiler() |
org.apache.log4j.Logger |
getLogger() |
IQueryResultProvider |
getResultProvider(PQuery query)
Returns a result provider for a given query.
|
Network |
getReteNet() |
IQueryRuntimeContext |
getRuntimeContext() |
boolean |
isCaching() |
boolean |
isParallelExecutionEnabled() |
void |
killEngine()
Deconstructs the engine to get rid of it finally
|
IQueryResultProvider |
peekExistingResultProvider(PQuery query)
Returns an existing result provider for a given query, if it was previously constructed, returns null otherwise.
|
void |
reset()
Resets the engine to an after-initialization phase
|
void |
setCompiler(ReteRecipeCompiler builder) |
void |
settle()
Waits until the pattern matcher is in a steady state and output can be retrieved.
|
void |
settle(java.lang.Runnable action)
Waits until the pattern matcher is in a steady state and output can be retrieved.
|
public ReteEngine(org.apache.log4j.Logger logger, IQueryRuntimeContext runtimeContext, int reteThreads)
context
- the context of the pattern matcher, conveying all information from the outside world.reteThreads
- the number of threads to operate the RETE network with; 0 means single-threaded operation, 1 starts an
asynchronous thread to operate the RETE net, >1 uses multiple RETE containers.public void killEngine()
public void reset()
public RetePatternMatcher accessMatcher(PQuery query) throws QueryProcessingException
query
- the pattern to be matched.RetePatternBuildException
- if construction fails.QueryProcessingException
public void buildMatchersCoalesced(java.util.Collection<PQuery> specifications) throws QueryProcessingException
specifications
- the patterns to be matched.RetePatternBuildException
- if construction fails.QueryProcessingException
public void settle()
public void settle(java.lang.Runnable action)
action
- the action to be run when reaching the steady-state.public Network getReteNet()
public ReteBoundary getBoundary()
public void setCompiler(ReteRecipeCompiler builder)
builder
- the pattern matcher builder to setpublic void addDisconnectable(Disconnectable disc)
disc
- the new Disconnectable adapter.public boolean isParallelExecutionEnabled()
public org.apache.log4j.Logger getLogger()
public IQueryRuntimeContext getRuntimeContext()
public ReteRecipeCompiler getCompiler()
public IQueryResultProvider getResultProvider(PQuery query) throws QueryProcessingException
IQueryBackend
getResultProvider
in interface IQueryBackend
QueryProcessingException
public IQueryResultProvider peekExistingResultProvider(PQuery query)
IQueryBackend
peekExistingResultProvider
in interface IQueryBackend
public void dispose()
IQueryBackend
dispose
in interface IQueryBackend
public boolean isCaching()
isCaching
in interface IQueryBackend