Class Controller

The controller object cannot be manually created. It is automatically created when an interpret-er is obtained from a knowledge base, and it is shared when an interpreter is forked from an interpreter. The controller carries the basic input/output streams and thread local predicates of an interpreter. For an instrumented interpreter it might also carry spy points and break points.

The methods setInuse() and getInuse() can be used to set and retrieve the interpreter object a controller is currently in use. Further the methods setFence() and currentController() can be used to set and retrieve the thread a controller occupies. Both information pieces are automati-cally tracked by the call-in interactor, so that the application programmer usually doesn’t have to bother with these methods.

The controller also houses the threads local predicates. We provide statistics about them. The method getThreadLocalClauses() can be used to retrieve snapshot of the total number of clauses over all thread local predicates. This statistic is currently used by the memory thresh-old to decide which thread to abort.

package jekpro.tools.call;

public final class Controller {
public final Interpreter getInuse();
public final Interpreter setInuse(Interpreter e);

public static Controller currentController(Thread t);
public final Thread setFence(Thread t);

public long getThreadLocalClauses();
}

Kommentare