gate.creole
Class RealtimeCorpusController

java.lang.Object
  extended by gate.util.AbstractFeatureBearer
      extended by gate.creole.AbstractResource
          extended by gate.creole.AbstractController
              extended by gate.creole.SerialController
                  extended by gate.creole.SerialAnalyserController
                      extended by gate.creole.RealtimeCorpusController
All Implemented Interfaces:
Controller, CorpusController, CustomDuplication, CreoleListener, Executable, LanguageAnalyser, ProcessingResource, Resource, Benchmarkable, FeatureBearer, NameBearer, Serializable, EventListener

@CreoleResource(name="Real-Time Corpus Pipeline",
                comment="A serial controller for PR pipelines over corpora which limits the run time of each PR.",
                icon="application-realtime",
                helpURL="http://gate.ac.uk/userguide/sec:creole-model:applications")
public class RealtimeCorpusController
extends SerialAnalyserController

A custom GATE controller that interrupts the execution over a document when a specified amount of time has elapsed. It also ignores all errors/exceptions that may occur during execution and simply carries on with the next document when that happens.

See Also:
Serialized Form

Nested Class Summary
protected  class RealtimeCorpusController.DocRunner
           
 
Nested classes/interfaces inherited from class gate.creole.AbstractController
AbstractController.InternalStatusListener, AbstractController.IntervalProgressListener
 
Field Summary
protected  Thread currentWorkingThread
          The tread currently running the document processing.
protected  Long graceful
          The timeout in milliseconds before execution on a document is gracefully stopped.
protected  Profiler prof
          Profiler to track PR execute time
protected  ExecutorService threadSource
          An executor service used to execute the PRs over the document .
protected  HashMap<String,Long> timeMap
           
protected  Long timeout
          The timeout in milliseconds before execution on a document is forcibly stopped (forcibly stopping execution may result in memory leaks and/or unexpected behaviour).
 
Fields inherited from class gate.creole.SerialAnalyserController
corpus, document
 
Fields inherited from class gate.creole.SerialController
log, prList, prTimeMap, sListener
 
Fields inherited from class gate.creole.AbstractController
benchmarkFeatures, benchmarkID, interrupted
 
Fields inherited from class gate.creole.AbstractResource
name
 
Fields inherited from class gate.util.AbstractFeatureBearer
features
 
Constructor Summary
RealtimeCorpusController()
           
 
Method Summary
 void cleanup()
          Cleans the internal data and prepares this object to be collected
 void executeImpl()
          Run the Processing Resources in sequence.
 Long getGracefulTimeout()
          Gets the timeout in milliseconds before execution on a document is gracefully stopped.
 Long getTimeout()
          Gets the timeout in milliseconds before execution on a document is forcibly stopped (forcibly stopping execution may result in memory leaks and/or unexpected behaviour).
 Resource init()
          Initialise this resource, and return it.
 void setGracefulTimeout(Long graceful)
          Sets the timeout in milliseconds before execution on a document is gracefully stopped.
 void setTimeout(Long timeout)
          Sets the timeout in milliseconds before execution on a document is forcibly stopped (forcibly stopping execution may result in memory leaks and/or unexpected behaviour).
 
Methods inherited from class gate.creole.SerialAnalyserController
add, add, checkLanguageAnalyser, getCorpus, getDocument, getOffendingPocessingResources, resourceUnloaded, setCorpus, setDocToPrs, setDocument
 
Methods inherited from class gate.creole.SerialController
checkParameters, datastoreClosed, datastoreCreated, datastoreOpened, duplicate, getPRs, getPrTimeMap, remove, remove, resetPrTimeMap, resourceLoaded, resourceRenamed, runComponent, set, setPRs
 
Methods inherited from class gate.creole.AbstractController
addControllerListener, addProgressListener, addStatusListener, execute, fireProcessFinished, fireProgressChanged, fireResourceAdded, fireResourceRemoved, fireStatusChanged, getBenchmarkId, getControllerAwarePRs, interrupt, isInterrupted, reInit, removeControllerListener, removeProgressListener, removeStatusListener, setBenchmarkId
 
Methods inherited from class gate.creole.AbstractResource
checkParameterValues, getBeanInfo, getInitParameterValues, getInitParameterValues, getName, getParameterValue, getParameterValue, getParameterValues, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners
 
Methods inherited from class gate.util.AbstractFeatureBearer
getFeatures, setFeatures
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gate.Controller
execute, getPRs, setPRs
 
Methods inherited from interface gate.ProcessingResource
reInit
 
Methods inherited from interface gate.Resource
getParameterValue, setParameterValue, setParameterValues
 
Methods inherited from interface gate.Executable
interrupt, isInterrupted
 

Field Detail

prof

protected Profiler prof
Profiler to track PR execute time


timeMap

protected HashMap<String,Long> timeMap

threadSource

protected ExecutorService threadSource
An executor service used to execute the PRs over the document .


currentWorkingThread

protected volatile Thread currentWorkingThread
The tread currently running the document processing.


timeout

protected Long timeout
The timeout in milliseconds before execution on a document is forcibly stopped (forcibly stopping execution may result in memory leaks and/or unexpected behaviour).


graceful

protected Long graceful
The timeout in milliseconds before execution on a document is gracefully stopped. Defaults to -1 which disables this functionality and relies, as previously, on forcibly stopping execution.

Constructor Detail

RealtimeCorpusController

public RealtimeCorpusController()
Method Detail

cleanup

public void cleanup()
Description copied from class: SerialController
Cleans the internal data and prepares this object to be collected

Specified by:
cleanup in interface Resource
Overrides:
cleanup in class SerialController

init

public Resource init()
              throws ResourceInstantiationException
Description copied from class: AbstractController
Initialise this resource, and return it.

Specified by:
init in interface Resource
Overrides:
init in class AbstractController
Throws:
ResourceInstantiationException

executeImpl

public void executeImpl()
                 throws ExecutionException
Run the Processing Resources in sequence.

Overrides:
executeImpl in class SerialAnalyserController
Throws:
ExecutionException

getTimeout

public Long getTimeout()
Gets the timeout in milliseconds before execution on a document is forcibly stopped (forcibly stopping execution may result in memory leaks and/or unexpected behaviour).


setTimeout

@CreoleParameter(defaultValue="60000",
                 comment="Timeout in milliseconds before execution on a document is forcibly stopped (forcibly stopping execution may result in memory leaks and/or unexpected behaviour)")
public void setTimeout(Long timeout)
Sets the timeout in milliseconds before execution on a document is forcibly stopped (forcibly stopping execution may result in memory leaks and/or unexpected behaviour).

Parameters:
timeout - in milliseconds before execution is forcibly stopped

getGracefulTimeout

public Long getGracefulTimeout()
Gets the timeout in milliseconds before execution on a document is gracefully stopped. Defaults to -1 which disables this functionality and relies, as previously, on forcibly stopping execution.


setGracefulTimeout

@CreoleParameter(defaultValue="-1",
                 comment="Timeout in milliseconds before execution on a document is gracefully stopped. Defaults to -1 which disables this functionality and relies, as previously, on forcibly stoping execution.")
public void setGracefulTimeout(Long graceful)
Sets the timeout in milliseconds before execution on a document is gracefully stopped. Defaults to -1 which disables this functionality and relies, as previously, on forcibly stopping execution.

Parameters:
graceful - timeout in milliseconds before execution is gracefully stopped