Package org.atmosphere.container
Class BlockingIOCometSupport
- java.lang.Object
-
- org.atmosphere.cpr.AsynchronousProcessor
-
- org.atmosphere.container.BlockingIOCometSupport
-
- All Implemented Interfaces:
AsyncSupport<AtmosphereResourceImpl>
- Direct Known Subclasses:
Tomcat7BIOSupportWithWebSocket
public class BlockingIOCometSupport extends AsynchronousProcessor
This class is used when theAtmosphereFrameworkfails to autodetect the Servlet Container we are running on. ThisAsyncSupportimplementation uses a blocking approach, meaning the request thread will be blocked until another Thread invoke theBroadcaster.broadcast(java.lang.Object).- Author:
- Jeanfrancois Arcand
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringLATCH-
Fields inherited from class org.atmosphere.cpr.AsynchronousProcessor
cancelledAction, config, timedoutAction
-
-
Constructor Summary
Constructors Constructor Description BlockingIOCometSupport(AtmosphereConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaction(AtmosphereResourceImpl r)Process anActionfrom anActionEventoperation like suspend, resume or timed out.Actioncancelled(AtmosphereRequest req, AtmosphereResponse res)All proprietary Comet basedServletmust invoke the cancelled method when the underlying WebServer detect that the client closed the connection.AsyncSupportcomplete(AtmosphereResourceImpl r)Complete and close the connection associated with an implementation ofAtmosphereResourceActionservice(AtmosphereRequest req, AtmosphereResponse res)protected voidsuspend(Action action, AtmosphereRequest req, AtmosphereResponse res)Suspend the connection by blocking the currentThread-
Methods inherited from class org.atmosphere.cpr.AsynchronousProcessor
allowSessionTimeoutRemoval, completeLifecycle, endRequest, getContainerName, init, invokeAtmosphereHandler, invokeInterceptors, map, postInterceptors, resumed, shutdown, supportSession, supportWebSocket, suspended, timedout
-
-
-
-
Constructor Detail
-
BlockingIOCometSupport
public BlockingIOCometSupport(AtmosphereConfig config)
-
-
Method Detail
-
service
public Action service(AtmosphereRequest req, AtmosphereResponse res) throws java.io.IOException, javax.servlet.ServletException
Description copied from interface:AsyncSupport- Parameters:
req- theAtmosphereRequestres- theAtmosphereResponse- Returns:
- the
Actionthat was manipulated by theAtmosphereHandler - Throws:
java.io.IOExceptionjavax.servlet.ServletException
-
suspend
protected void suspend(Action action, AtmosphereRequest req, AtmosphereResponse res) throws java.io.IOException, javax.servlet.ServletException
Suspend the connection by blocking the currentThread- Parameters:
action- TheActionreq- theAtmosphereRequestres- theAtmosphereResponse- Throws:
java.io.IOExceptionjavax.servlet.ServletException
-
cancelled
public Action cancelled(AtmosphereRequest req, AtmosphereResponse res) throws java.io.IOException, javax.servlet.ServletException
Description copied from class:AsynchronousProcessorAll proprietary Comet basedServletmust invoke the cancelled method when the underlying WebServer detect that the client closed the connection.- Overrides:
cancelledin classAsynchronousProcessor- Parameters:
req- theAtmosphereRequestres- theAtmosphereResponse- Returns:
- action the Action operation.
- Throws:
java.io.IOExceptionjavax.servlet.ServletException
-
action
public void action(AtmosphereResourceImpl r)
Description copied from interface:AsyncSupportProcess anActionfrom anActionEventoperation like suspend, resume or timed out.- Specified by:
actionin interfaceAsyncSupport<AtmosphereResourceImpl>- Overrides:
actionin classAsynchronousProcessor- Parameters:
r- An instance ofAction
-
complete
public AsyncSupport complete(AtmosphereResourceImpl r)
Description copied from interface:AsyncSupportComplete and close the connection associated with an implementation ofAtmosphereResource- Specified by:
completein interfaceAsyncSupport<AtmosphereResourceImpl>- Overrides:
completein classAsynchronousProcessor- Parameters:
r-AtmosphereResource- Returns:
- this
-
-