org.omegahat.Environment.Interpreter
Class SignallableEvaluator

java.lang.Object
  |
  +--org.omegahat.Environment.Interpreter.BasicEvaluator
        |
        +--org.omegahat.Environment.Interpreter.UtilityEvaluator
              |
              +--org.omegahat.Environment.Interpreter.UserClassEvaluator
                    |
                    +--org.omegahat.Environment.Interpreter.SignallableEvaluator
All Implemented Interfaces:
DatabaseCustomer, Evaluator, ManagedEvaluatorInt, java.lang.Runnable, java.io.Serializable, kh.signal.SignalListener
Direct Known Subclasses:
UserLevelSignalHandler

public class SignallableEvaluator
extends UserClassEvaluator
implements kh.signal.SignalListener

This is a version of the evaluator that is capable of catching UNIX-style interrupts (Ctrl-C, for example). This can be used to conclude the evaluation of top-level tasks prematurely. This class has not been used extensively but could become necessary to interrupt long-running tasks. Alternatively, we can have another thread (or GUI button) that controls the (default) evaluator.

This uses JNI (Java Native Interface) code to implement the signal catching and so is not portable and requires a C-level library to be installed. Additionally, it requires a few additional Java classes to be in the classpath. That code is written by Kevin Hester.

See Also:
Serialized Form

Fields inherited from class org.omegahat.Environment.Interpreter.UserClassEvaluator
classManager
 
Fields inherited from class org.omegahat.Environment.Interpreter.BasicEvaluator
allowUnrestrictedAccess, class_lists, currentExpression, data, databases, debugger, DefaultAttachIndex, defaultDatabase, dynamicClassLoader, errorHandler, evaluationEvent, evaluationListeners, initialized, internalFunctionTables, internalPrimitiveClassNames, internalPrimitiveClassTable, lexer, localClasses, manager, options, output, parser, primitive_classes, primitiveClasses, PrimitiveClassNames, primitiveTypeNames, primitiveTypes, reversePrimitiveTypes, ShowMultipleClasses, sourceStack, stderr, stdout, SubEvaluationListeners, taskHistory, toplevelExpression, warningMessages
 
Fields inherited from interface kh.signal.SignalListener
SIG_MAX, SIG_MIN, SIGFPE, SIGHUP, SIGILL, SIGINT, SIGKILL, SIGQUIT, SIGTERM, SIGTRAP
 
Fields inherited from interface org.omegahat.Environment.Interpreter.Evaluator
ThisVariableName
 
Constructor Summary
SignallableEvaluator()
           
SignallableEvaluator(EvaluatorManager mgr)
           
SignallableEvaluator(Options opts)
           
 
Method Summary
 boolean isInterested(int signalNum)
           
 boolean registerForSignals()
          Register an interest in being informed about signals.
 void signalReceived(int signalNum)
          Method that is invoked by the signal administrator when it detects a signal has been raised.
 
Methods inherited from class org.omegahat.Environment.Interpreter.UserClassEvaluator
addMethod, classManager, classManager, createInstance, createInstance, createInstance, defineClass, defineClass, defineClass, defineClass, defineClass, defineClass, DefineUserClass, DefineUserClass, DefineUserClass, findUserClass, findUserClass, parseClass, parser
 
Methods inherited from class org.omegahat.Environment.Interpreter.UtilityEvaluator
evaluator, exec, exec, findFile, getEvaluator, setProperty, setProperty
 
Methods inherited from class org.omegahat.Environment.Interpreter.BasicEvaluator
addEvaluationListener, addFunctionTable, addFunctionTable, addSourceInput, addToHistory, allowUnrestrictedAccess, allowUnrestrictedAccess, asObject, asObject, asObject, asObjectName, asPrimitiveClass, assign, assign, assign, asWriter, attach, attach, attach, attach, attach, attach, attach, classInit, classLists, classLists, classPath, classPath, commandLine, convertPrimitive, copy, copy, copyByConstructor, copyBySerialization, createClassLists, currentExpression, currentExpression, data, data, database, database, database, Debug, Debug, Debug, Debug, Debug, debugger, debugger, defaultDatabase, defaultDatabase, defaultDatabase, defaultErrorHandler, detach, detach, displayTask, displayTask, displayWarnings, displayWarnings, dynamicClassLoader, dynamicClassLoader, endSource, endSource, endSource, endTaskEvaluation, error, error, errorHandler, errorHandler, evaluate, evaluate, evaluate, evaluate, evaluationError, evaluationListeners, evaluationListeners, evaluationListeners, exists, exit, exit, expandClassName, expandedClassPathElement, find, findAsField, findClass, findClass, findClass, findClass, findFunction, findFunctionOrMethod, functionTableList, get, get, get, get, get, get, get, get, get, getBaseURL, getEvaluationEvent, getEvaluationListeners, getField, getSubEvaluationListeners, help, Import, Import, Import, init, initialize, initTaskEvaluation, internalFunctionTables, isPrimitive, isPrimitive, javaVersion, lexer, lexer, lexer, localClasses, localClasses, manager, manager, newDatabase, newDatabase, notifyListeners, notifyListeners, objects, objects, objects, options, options, output, output, output, parse, parse, parse, parse, primitiveClass, q, q, remove, remove, remove, removeFunctionTable, run, same, searchForClass, searchPath, searchPath, searchPath, searchPath, setEvaluationEvent, setEvaluationListeners, setSubEvaluationListeners, show, show, show, source, source, source, source, source, source, source, source, source, sourceStack, stderr, stderr, stdout, stdout, taskHistory, taskHistory, toplevelExpression, toplevelExpression, useLazyEvaluation, warning, warning, warning, warnings, warnings, where, which, which
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SignallableEvaluator

public SignallableEvaluator(Options opts)

SignallableEvaluator

public SignallableEvaluator()

SignallableEvaluator

public SignallableEvaluator(EvaluatorManager mgr)
Method Detail

signalReceived

public void signalReceived(int signalNum)
Method that is invoked by the signal administrator when it detects a signal has been raised. Here we could remove the top-level task and terminate evaluating any more of its sub-expressions.
Specified by:
signalReceived in interface kh.signal.SignalListener
Parameters:
signalNum - indicator of what type of signal was raised.

isInterested

public boolean isInterested(int signalNum)
Specified by:
isInterested in interface kh.signal.SignalListener

registerForSignals

public boolean registerForSignals()
Register an interest in being informed about signals.