com.sun.grizzly.filter
Class MessageDispatcher
java.lang.Object
com.sun.grizzly.filter.MessageDispatcher
- All Implemented Interfaces:
- ProtocolFilter
public abstract class MessageDispatcher
- extends Object
- implements ProtocolFilter
Filter which dispatches parsed fully constructed Messages.
This could be a plugin point to write business logic which
handles requests made by some Endpoit.
Note:
Messages are taken from Grizzly WorkerThread
and dispatched to a new Thread Instance of an configurable ThreadPool.
This enables the new Threads for example to be put in blocking mode and
not hurting the Grizzly Selection loop.
- Version:
- 1.0
- Author:
- John Vieten 22.06.2008
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
needMoreDataMessageMapKey
public static final String needMoreDataMessageMapKey
- See Also:
- Constant Field Values
threadCounter
protected int threadCounter
threadGroup
protected final ThreadGroup threadGroup
MessageDispatcher
public MessageDispatcher()
setExecutorService
public void setExecutorService(ExecutorService executorService)
postExecute
public boolean postExecute(Context ctx)
throws IOException
- Description copied from interface:
ProtocolFilter
- Execute any cleanup activities, such as releasing resources that were
acquired during the execute() method of this ProtocolFilter instance.
- Specified by:
postExecute
in interface ProtocolFilter
- Parameters:
ctx
- Context
- Returns:
-
- Throws:
IOException
stop
public void stop()
execute
public boolean execute(Context ctx)
throws IOException
- Description copied from interface:
ProtocolFilter
- Execute a unit of processing work to be performed. This ProtocolFilter
may either complete the required processing and return false,
or delegate remaining processing to the next ProtocolFilter in a
ProtocolChain containing this ProtocolFilter by returning true.
- Specified by:
execute
in interface ProtocolFilter
- Parameters:
ctx
- Context
- Returns:
-
- Throws:
IOException
onRequestMessage
public abstract void onRequestMessage(RequestMessage msg,
Context ctx)
- Pluginpoint to handle an Message received from some Endpoint
- Parameters:
msg
- RequestMessage the message received from an Endpointctx
- MessageContext Simple API for writing,quering the connection.
onMessageError
public abstract void onMessageError(MessageError msg,
Context ctx)
Copyright © 2012 Oracle Corporation. All Rights Reserved.