public class AtmosphereSession extends Object
AtmosphereResource will be created every time a
reconnect occurs. If an application has a reference to the AtmosphereResource, the object will become
out of scope, or unusable, after the reconnection. To fix this problem, you can use this class to track and invoke
tryAcquire() ()} or acquire()} in order to get the AtmosphereResource.
AtmosphereResource are tracked using the list of associated Broadcaster, e.g you must make sure the AtmosphereResource
has called Broadcaster.addAtmosphereResource(AtmosphereResource) once if you want this class to work.| Constructor and Description |
|---|
AtmosphereSession(AtmosphereResource resource)
Track the current
AtmosphereResource with all created Broadcaster |
AtmosphereSession(AtmosphereResource r,
Broadcaster... broadcasters) |
| Modifier and Type | Method and Description |
|---|---|
AtmosphereResource |
acquire()
Retrieve the
AtmosphereResource associated with this session. |
void |
close() |
AtmosphereResource |
tryAcquire()
Retrieve the
AtmosphereResource associated with this session. |
AtmosphereResource |
tryAcquire(int timeInSecond)
Retrieve the
AtmosphereResource associated with this session. |
String |
uuid() |
public AtmosphereSession(AtmosphereResource r, Broadcaster... broadcasters)
public AtmosphereSession(AtmosphereResource resource)
AtmosphereResource with all created Broadcasterresource - an AtmosphereResourcepublic AtmosphereResource acquire()
AtmosphereResource associated with this session. If there is no AtmosphereResource
associated, return null.AtmosphereResourcepublic AtmosphereResource tryAcquire() throws InterruptedException
AtmosphereResource associated with this session. If there is no AtmosphereResource
associated, wait until the AtmosphereResource is retrieved. This method will wait 60 seconds and then return.AtmosphereResourceInterruptedExceptionpublic AtmosphereResource tryAcquire(int timeInSecond) throws InterruptedException
AtmosphereResource associated with this session. If there is no AtmosphereResource
associated, wait until the AtmosphereResource is retrieved.timeInSecond - The timeToWait before continuing the executionAtmosphereResourceInterruptedExceptionpublic void close()
public String uuid()
Copyright © 2014. All Rights Reserved.