com.sun.grizzly.filter
Class MessageDispatcher

java.lang.Object
  extended by com.sun.grizzly.filter.MessageDispatcher
All Implemented Interfaces:
ProtocolFilter

public abstract class MessageDispatcher
extends java.lang.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

Field Summary
static java.lang.String needMoreDataMessageMapKey
           
protected  int threadCounter
           
protected  java.lang.ThreadGroup threadGroup
           
 
Fields inherited from interface com.sun.grizzly.ProtocolFilter
SUCCESSFUL_READ
 
Constructor Summary
MessageDispatcher()
           
 
Method Summary
 boolean execute(Context ctx)
           
abstract  void onMessageError(MessageError msg, Context ctx)
           
abstract  void onRequestMessage(RequestMessage msg, Context ctx)
          Pluginpoint to handle an Message received from some Endpoint
 boolean postExecute(Context ctx)
           
 void setExecutorService(java.util.concurrent.ExecutorService executorService)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

needMoreDataMessageMapKey

public static final java.lang.String needMoreDataMessageMapKey
See Also:
Constant Field Values

threadCounter

protected int threadCounter

threadGroup

protected final java.lang.ThreadGroup threadGroup
Constructor Detail

MessageDispatcher

public MessageDispatcher()
Method Detail

setExecutorService

public void setExecutorService(java.util.concurrent.ExecutorService executorService)

postExecute

public boolean postExecute(Context ctx)
                    throws java.io.IOException
Specified by:
postExecute in interface ProtocolFilter
Throws:
java.io.IOException

stop

public void stop()

execute

public boolean execute(Context ctx)
                throws java.io.IOException
Specified by:
execute in interface ProtocolFilter
Throws:
java.io.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 Endpoint
ctx - MessageContext Simple API for writing,quering the connection.

onMessageError

public abstract void onMessageError(MessageError msg,
                                    Context ctx)


Copyright © 2011 Oracle Corporation. All Rights Reserved.