org.atmosphere.container
Class BlockingIOCometSupport

java.lang.Object
  extended by org.atmosphere.cpr.AsynchronousProcessor
      extended by org.atmosphere.container.BlockingIOCometSupport
All Implemented Interfaces:
CometSupport<AtmosphereResourceImpl>
Direct Known Subclasses:
GoogleAppEngineCometSupport

public class BlockingIOCometSupport
extends AsynchronousProcessor
implements CometSupport<AtmosphereResourceImpl>

This class gets used when the AtmosphereServlet fails to autodetect the Servlet Container we are running on. This CometSupport implementation uses a blocking approach, meaning the request thread will be blocked until another Thread invoke the Broadcaster.broadcast(java.lang.Object)

Author:
Jeanfrancois Arcand

Field Summary
protected static String LATCH
           
protected  ConcurrentHashMap<Integer,CountDownLatch> latchs
           
 
Fields inherited from class org.atmosphere.cpr.AsynchronousProcessor
aliveRequests, logger, RESOURCE_EVENT, SUPPORT_SESSION
 
Constructor Summary
BlockingIOCometSupport(AtmosphereServlet.AtmosphereConfig config)
           
 
Method Summary
 void action(AtmosphereResourceImpl actionEvent)
          Process an AtmosphereServlet.Action from an ActionEvent operation like suspend, resume or timed out.
 AtmosphereServlet.Action service(HttpServletRequest req, HttpServletResponse res)
          Serve the HttpServletRequest and the HttpServletResponse and return the appropriate AtmosphereServlet.Action.
protected  void suspend(AtmosphereServlet.Action action, HttpServletRequest req, HttpServletResponse res)
          Suspend the connection by blocking the current Thread
 
Methods inherited from class org.atmosphere.cpr.AsynchronousProcessor
cancelled, getContainerName, init, resumed, supportSession, suspended, timedout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.atmosphere.cpr.CometSupport
getContainerName, init
 

Field Detail

LATCH

protected static final String LATCH
See Also:
Constant Field Values

latchs

protected ConcurrentHashMap<Integer,CountDownLatch> latchs
Constructor Detail

BlockingIOCometSupport

public BlockingIOCometSupport(AtmosphereServlet.AtmosphereConfig config)
Method Detail

service

public AtmosphereServlet.Action service(HttpServletRequest req,
                                        HttpServletResponse res)
                                 throws IOException,
                                        ServletException
Serve the HttpServletRequest and the HttpServletResponse and return the appropriate AtmosphereServlet.Action.

Specified by:
service in interface CometSupport<AtmosphereResourceImpl>
Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Returns:
the AtmosphereServlet.Action that was manipulated by the AtmosphereHandler
Throws:
IOException
ServletException

suspend

protected void suspend(AtmosphereServlet.Action action,
                       HttpServletRequest req,
                       HttpServletResponse res)
                throws IOException,
                       ServletException
Suspend the connection by blocking the current Thread

Parameters:
action - The AtmosphereServlet.Action
req - the HttpServletRequest
res - the HttpServletResponse
Throws:
IOException
ServletException

action

public void action(AtmosphereResourceImpl actionEvent)
Process an AtmosphereServlet.Action from an ActionEvent operation like suspend, resume or timed out.

Specified by:
action in interface CometSupport<AtmosphereResourceImpl>
Overrides:
action in class AsynchronousProcessor
Parameters:
actionEvent - An instance of AtmosphereServlet.Action


Copyright © 2010 SUN Microsystems. All Rights Reserved.