Package org.atmosphere.cpr
Class DefaultAtmosphereResourceFactory
- java.lang.Object
-
- org.atmosphere.cpr.DefaultAtmosphereResourceFactory
-
- All Implemented Interfaces:
AtmosphereResourceFactory,AtmosphereConfigAware
public class DefaultAtmosphereResourceFactory extends java.lang.Object implements AtmosphereResourceFactory
A Factory used to manageAtmosphereResourceinstances. You can use this factory to create, remove and findAtmosphereResourceinstances that are associated with one or severalBroadcasters.- Author:
- Jeanfrancois Arcand
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.atmosphere.cpr.AtmosphereResourceFactory
AtmosphereResourceFactory.Async
-
-
Constructor Summary
Constructors Constructor Description DefaultAtmosphereResourceFactory()
-
Method Summary
-
-
-
Method Detail
-
configure
public void configure(AtmosphereConfig config)
Description copied from interface:AtmosphereConfigAwareConfigure an AtmosphereFramework object.- Specified by:
configurein interfaceAtmosphereConfigAware- Specified by:
configurein interfaceAtmosphereResourceFactory- Parameters:
config-AtmosphereConfig
-
create
public AtmosphereResource create(AtmosphereConfig config, AtmosphereRequest request, AtmosphereResponse response, AsyncSupport<?> a)
Create anAtmosphereResourceImpl- Specified by:
createin interfaceAtmosphereResourceFactory- Parameters:
config- anAtmosphereConfigrequest- anAtmosphereResponsea-AsyncSupport- Returns:
- an
AtmosphereResourceImpl
-
create
public AtmosphereResource create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereRequest request, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler)
Create anAtmosphereResourceImpl.- Specified by:
createin interfaceAtmosphereResourceFactory- Parameters:
config- anAtmosphereConfigbroadcaster- aBroadcasterresponse- anAtmosphereResponsea-AsyncSupporthandler- anAtmosphereHandler- Returns:
- an
AtmosphereResourceImpl
-
create
public AtmosphereResource create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereRequest request, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler, AtmosphereResource.TRANSPORT t)
Create anAtmosphereResourceImpl.- Specified by:
createin interfaceAtmosphereResourceFactory- Parameters:
config- anAtmosphereConfigbroadcaster- aBroadcasterresponse- anAtmosphereResponsea-AsyncSupporthandler- anAtmosphereHandlert- anAtmosphereResource.TRANSPORT- Returns:
- an
AtmosphereResourceImpl
-
create
public AtmosphereResource create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler)
Create anAtmosphereResourceImpl.- Specified by:
createin interfaceAtmosphereResourceFactory- Parameters:
config- anAtmosphereConfigbroadcaster- aBroadcasterresponse- anAtmosphereResponsea-AsyncSupporthandler- anAtmosphereHandler- Returns:
- an
AtmosphereResourceImpl
-
create
public AtmosphereResource create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler, AtmosphereResource.TRANSPORT t)
- Specified by:
createin interfaceAtmosphereResourceFactory
-
create
public AtmosphereResource create(AtmosphereConfig config, AtmosphereResponse response, AsyncSupport<?> a)
Create anAtmosphereResourceImpl.- Specified by:
createin interfaceAtmosphereResourceFactory- Parameters:
config- anAtmosphereConfigresponse- anAtmosphereResponsea-AsyncSupport- Returns:
- an
AtmosphereResourceImpl
-
create
public AtmosphereResource create(AtmosphereConfig config, java.lang.String uuid)
Create anAtmosphereResourceassociated with the uuid.- Specified by:
createin interfaceAtmosphereResourceFactory- Parameters:
config- anAtmosphereConfiguuid- a String representing a UUID- Returns:
-
create
public AtmosphereResource create(AtmosphereConfig config, java.lang.String uuid, AtmosphereRequest request)
Create anAtmosphereResourceassociated with the uuid.- Specified by:
createin interfaceAtmosphereResourceFactory- Parameters:
config- anAtmosphereConfiguuid- a String representing a UUIDrequest- aAtmosphereRequest- Returns:
-
remove
public AtmosphereResource remove(java.lang.String uuid)
Remove theAtmosphereResourcefrom all instances ofBroadcaster.- Specified by:
removein interfaceAtmosphereResourceFactory- Parameters:
uuid- theAtmosphereResource.uuid()- Returns:
- the
AtmosphereResource, or null if not found.
-
find
public AtmosphereResource find(java.lang.String uuid)
Find anAtmosphereResourcebased on itsAtmosphereResource.uuid().- Specified by:
findin interfaceAtmosphereResourceFactory- Parameters:
uuid- theAtmosphereResource.uuid()- Returns:
- the
AtmosphereResource, or null if not found.
-
locate
public void locate(java.lang.String uuid, AtmosphereResourceFactory.Async async)Description copied from interface:AtmosphereResourceFactoryLocate anAtmosphereResource, based on itsAtmosphereResource.uuid(), in a cluster. If theAtmosphereResourceis available in the cluster, theAtmosphereResourceFactory.Async.available(org.atmosphere.cpr.AtmosphereResource)callback will be invoked. If not, theorg.atmosphere.cpr.AtmosphereResourceFactory.Async#notAvailable- Specified by:
locatein interfaceAtmosphereResourceFactory- Parameters:
uuid- theAtmosphereResource.uuid()async- anAtmosphereResourceFactory.Async
-
broadcasters
@Deprecated public java.util.Set<Broadcaster> broadcasters(java.lang.String uuid)
Deprecated.UseAtmosphereResourceFactory.find(String).broadcasters() insteadReturn allBroadcasterassociated with aAtmosphereResource.uuid(), e.g for whichBroadcaster.addAtmosphereResource(AtmosphereResource)has been called. Note that this method is not synchronized and may not return all theBroadcasterin caseBroadcaster.addAtmosphereResource(AtmosphereResource)is being called concurrently.- Specified by:
broadcastersin interfaceAtmosphereResourceFactory- Parameters:
uuid- theAtmosphereResource.uuid()- Returns:
- all
Broadcasterassociated with aAtmosphereResource.uuid()
-
registerUuidForFindCandidate
public void registerUuidForFindCandidate(AtmosphereResource r)
Register anAtmosphereResourcefor being a candidate tofind(String)operation.- Specified by:
registerUuidForFindCandidatein interfaceAtmosphereResourceFactory- Parameters:
r-AtmosphereResource
-
unRegisterUuidForFindCandidate
public void unRegisterUuidForFindCandidate(AtmosphereResource r)
Un register anAtmosphereResourcefor being a candidate tofind(String)operation.- Specified by:
unRegisterUuidForFindCandidatein interfaceAtmosphereResourceFactory- Parameters:
r-AtmosphereResource
-
destroy
public void destroy()
- Specified by:
destroyin interfaceAtmosphereResourceFactory
-
resources
public java.util.concurrent.ConcurrentMap<java.lang.String,AtmosphereResource> resources()
- Specified by:
resourcesin interfaceAtmosphereResourceFactory
-
findAll
public java.util.Collection<AtmosphereResource> findAll()
- Specified by:
findAllin interfaceAtmosphereResourceFactory
-
-