inpro.sphinx.instrumentation
Class ThreadingListener
java.lang.Object
inpro.sphinx.instrumentation.ThreadingListener
- All Implemented Interfaces:
- edu.cmu.sphinx.decoder.ResultListener, edu.cmu.sphinx.decoder.ResultProducer, edu.cmu.sphinx.instrumentation.Monitor, edu.cmu.sphinx.recognizer.StateListener, edu.cmu.sphinx.util.props.Configurable, java.util.EventListener
public class ThreadingListener
- extends java.lang.Object
- implements edu.cmu.sphinx.decoder.ResultListener, edu.cmu.sphinx.decoder.ResultProducer, edu.cmu.sphinx.recognizer.StateListener, edu.cmu.sphinx.instrumentation.Monitor
read listeners from configuration, listen in on Recognizer,
then dispatch resultListeners on separate threads on newResult
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PROP_RECOGNIZER
@S4Component(type=edu.cmu.sphinx.decoder.ResultProducer.class)
public static final java.lang.String PROP_RECOGNIZER
- See Also:
- Constant Field Values
PROP_LISTENERS
@S4ComponentList(type=edu.cmu.sphinx.decoder.ResultListener.class)
public static final java.lang.String PROP_LISTENERS
- See Also:
- Constant Field Values
PROP_QUEUE_SIZE
@S4Integer(range={1,2147483647},
defaultValue=2147483647)
public static final java.lang.String PROP_QUEUE_SIZE
- See Also:
- Constant Field Values
recognizer
private edu.cmu.sphinx.decoder.ResultProducer recognizer
resultQueues
protected java.util.Map<edu.cmu.sphinx.decoder.ResultListener,java.util.concurrent.LinkedBlockingQueue<edu.cmu.sphinx.result.Result>> resultQueues
listenerThreads
protected java.util.Map<edu.cmu.sphinx.decoder.ResultListener,ThreadingListener.DispatchThread> listenerThreads
queueSize
protected int queueSize
logger
static org.apache.log4j.Logger logger
ThreadingListener
public ThreadingListener()
newResult
public void newResult(edu.cmu.sphinx.result.Result result)
- Specified by:
newResult
in interface edu.cmu.sphinx.decoder.ResultListener
newProperties
public void newProperties(edu.cmu.sphinx.util.props.PropertySheet ps)
throws edu.cmu.sphinx.util.props.PropertyException
- Specified by:
newProperties
in interface edu.cmu.sphinx.util.props.Configurable
- Throws:
edu.cmu.sphinx.util.props.PropertyException
addResultListener
public void addResultListener(edu.cmu.sphinx.decoder.ResultListener resultListener)
- Specified by:
addResultListener
in interface edu.cmu.sphinx.decoder.ResultProducer
removeResultListener
public void removeResultListener(edu.cmu.sphinx.decoder.ResultListener resultListener)
- Specified by:
removeResultListener
in interface edu.cmu.sphinx.decoder.ResultProducer
statusChanged
public void statusChanged(edu.cmu.sphinx.recognizer.Recognizer.State status)
- Specified by:
statusChanged
in interface edu.cmu.sphinx.recognizer.StateListener