com.sun.grizzly.comet
Class DefaultNotificationHandler

java.lang.Object
  extended by com.sun.grizzly.comet.DefaultNotificationHandler
All Implemented Interfaces:
NotificationHandler
Direct Known Subclasses:
CometdNotificationHandler, DefaultNotificationHandler

public class DefaultNotificationHandler
extends Object
implements NotificationHandler

Default Notificationhandler that uses the same a Grizzly Pipeline to execute the notification process.

Author:
Jeanfrancois Arcand

Field Summary
protected  boolean blockingNotification
          true if the caller of CometContext.notify should block when notifying other CometHandler.
protected  Pipeline pipeline
          The Pipeline used to execute threaded notification.
 
Constructor Summary
DefaultNotificationHandler()
           
 
Method Summary
 boolean isBlockingNotification()
          Return true if the invoker of notify() should block when notifying Comet Handlers.
 void notify(CometEvent cometEvent, CometHandler cometHandler)
          Notify a single CometHandler.
 void notify(CometEvent cometEvent, Iterator<CometHandler> iteratorHandlers)
          Notify all CometHandler.
protected  void notify0(CometEvent cometEvent, CometHandler cometHandler)
          Notify a CometHandler.
protected  void notify0(CometEvent cometEvent, Iterator<CometHandler> iteratorHandlers)
           
 void setBlockingNotification(boolean blockingNotification)
          Set to true if the invoker of notify() should block when notifying Comet Handlers.
protected  void setPipeline(Pipeline pipeline)
          Set the Pipeline used for notifying the CometHandler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pipeline

protected Pipeline pipeline
The Pipeline used to execute threaded notification.


blockingNotification

protected boolean blockingNotification
true if the caller of CometContext.notify should block when notifying other CometHandler.

Constructor Detail

DefaultNotificationHandler

public DefaultNotificationHandler()
Method Detail

setPipeline

protected void setPipeline(Pipeline pipeline)
Set the Pipeline used for notifying the CometHandler.


isBlockingNotification

public boolean isBlockingNotification()
Return true if the invoker of notify() should block when notifying Comet Handlers.

Specified by:
isBlockingNotification in interface NotificationHandler

setBlockingNotification

public void setBlockingNotification(boolean blockingNotification)
Set to true if the invoker of notify() should block when notifying Comet Handlers.

Specified by:
setBlockingNotification in interface NotificationHandler

notify

public void notify(CometEvent cometEvent,
                   Iterator<CometHandler> iteratorHandlers)
            throws IOException
Notify all CometHandler.

Specified by:
notify in interface NotificationHandler
Parameters:
cometEvent - the CometEvent used to notify CometHandler
iteratorHandlers - An iterator over a list of CometHandler
Throws:
IOException

notify0

protected void notify0(CometEvent cometEvent,
                       Iterator<CometHandler> iteratorHandlers)
                throws IOException
Throws:
IOException

notify

public void notify(CometEvent cometEvent,
                   CometHandler cometHandler)
            throws IOException
Notify a single CometHandler.

Specified by:
notify in interface NotificationHandler
Parameters:
cometEvent - the CometEvent used to notify CometHandler
cometHandler - a CometHandler
Throws:
IOException

notify0

protected void notify0(CometEvent cometEvent,
                       CometHandler cometHandler)
                throws IOException
Notify a CometHandler. CometEvent.INTERRUPT -> CometHandler.onInterrupt CometEvent.NOTIFY -> CometHandler.onEvent CometEvent.INITIALIZE -> CometHandler.onInitialize CometEvent.TERMINATE -> CometHandler.onTerminate CometEvent.READ -> CometHandler.onEvent CometEvent.WRITE -> CometHandler.onEvent

Parameters:
attachment - An object shared amongst CometHandler.
cometHandler - The CometHandler to invoke.
Throws:
IOException


Copyright © 2009 SUN Microsystems. All Rights Reserved.