Package org.atmosphere.cpr
Interface AtmosphereResourceFactory
- All Superinterfaces:
AtmosphereConfigAware
- All Known Implementing Classes:
DefaultAtmosphereResourceFactory
A Factory used to manage
AtmosphereResource instances. You can use this factory to create, remove and find
AtmosphereResource instances that are associated with one or several Broadcasters.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAn interface to use in order to retrieve anAtmosphereResourceinside a cluster. -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(AtmosphereConfig config) Configure an AtmosphereFramework object.create(AtmosphereConfig config, String uuid) Create anAtmosphereResourceassociated with the uuid.create(AtmosphereConfig config, String uuid, AtmosphereRequest request) Create anAtmosphereResourceassociated with the uuid.create(AtmosphereConfig config, AtmosphereRequest request, AtmosphereResponse response, AsyncSupport<?> a) Create anAtmosphereResourceImplcreate(AtmosphereConfig config, AtmosphereResponse response, AsyncSupport<?> a) Create anAtmosphereResourceImpl.create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereRequest request, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler) Create anAtmosphereResourceImpl.create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereRequest request, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler, AtmosphereResource.TRANSPORT t) Create anAtmosphereResourceImpl.create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler) Create anAtmosphereResourceImpl.create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler, AtmosphereResource.TRANSPORT t) voiddestroy()Deprecated.findAll()default Optional<AtmosphereResource> findResource(String uuid) Find anAtmosphereResourcebased on itsAtmosphereResource.uuid().voidlocate(String uuid, AtmosphereResourceFactory.Async async) Locate anAtmosphereResource, based on itsAtmosphereResource.uuid(), in a cluster.voidRegister anAtmosphereResourcefor being a candidate tofind(String)operation.Remove theAtmosphereResourcefrom all instances ofBroadcaster.voidUn register anAtmosphereResourcefor being a candidate tofind(String)operation.
-
Method Details
-
configure
Description copied from interface:AtmosphereConfigAwareConfigure an AtmosphereFramework object.- Specified by:
configurein interfaceAtmosphereConfigAware- Parameters:
config-AtmosphereConfig
-
create
AtmosphereResource create(AtmosphereConfig config, AtmosphereRequest request, AtmosphereResponse response, AsyncSupport<?> a) Create anAtmosphereResourceImpl- Parameters:
config- anAtmosphereConfigrequest- anAtmosphereResponsea-AsyncSupport- Returns:
- an
AtmosphereResourceImpl
-
create
AtmosphereResource create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereRequest request, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler) Create anAtmosphereResourceImpl.- Parameters:
config- anAtmosphereConfigbroadcaster- aBroadcasterresponse- anAtmosphereResponsea-AsyncSupporthandler- anAtmosphereHandler- Returns:
- an
AtmosphereResourceImpl
-
create
AtmosphereResource create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereRequest request, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler, AtmosphereResource.TRANSPORT t) Create anAtmosphereResourceImpl.- Parameters:
config- anAtmosphereConfigbroadcaster- aBroadcasterresponse- anAtmosphereResponsea-AsyncSupporthandler- anAtmosphereHandlert- anAtmosphereResource.TRANSPORT- Returns:
- an
AtmosphereResourceImpl
-
create
AtmosphereResource create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler) Create anAtmosphereResourceImpl.- Parameters:
config- anAtmosphereConfigbroadcaster- aBroadcasterresponse- anAtmosphereResponsea-AsyncSupporthandler- anAtmosphereHandler- Returns:
- an
AtmosphereResourceImpl
-
create
AtmosphereResource create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler, AtmosphereResource.TRANSPORT t) -
create
Create anAtmosphereResourceImpl.- Parameters:
config- anAtmosphereConfigresponse- anAtmosphereResponsea-AsyncSupport- Returns:
- an
AtmosphereResourceImpl
-
create
Create anAtmosphereResourceassociated with the uuid.- Parameters:
config- anAtmosphereConfiguuid- a String representing a UUID- Returns:
-
create
Create anAtmosphereResourceassociated with the uuid.- Parameters:
config- anAtmosphereConfiguuid- a String representing a UUIDrequest- aAtmosphereRequest- Returns:
-
remove
Remove theAtmosphereResourcefrom all instances ofBroadcaster.- Parameters:
uuid- theAtmosphereResource.uuid()- Returns:
- the
AtmosphereResource, or null if not found.
-
find
Deprecated.UsefindResource(String)which returnsOptionalinstead of null.Find anAtmosphereResourcebased on itsAtmosphereResource.uuid().- Parameters:
uuid- theAtmosphereResource.uuid()- Returns:
- the
AtmosphereResource, or null if not found.
-
findResource
Find anAtmosphereResourcebased on itsAtmosphereResource.uuid().This is the preferred alternative to
find(String)as it returns anOptionalinstead of null, making the absent-resource case explicit at the call site.- Parameters:
uuid- theAtmosphereResource.uuid()- Returns:
- an
Optionalcontaining theAtmosphereResource, or empty if not found.
-
locate
Locate 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, theinvalid reference
org.atmosphere.cpr.AtmosphereResourceFactory.Async#notAvailable- Parameters:
uuid- theAtmosphereResource.uuid()async- anAtmosphereResourceFactory.Async
-
registerUuidForFindCandidate
Register anAtmosphereResourcefor being a candidate tofind(String)operation.- Parameters:
r-AtmosphereResource
-
unRegisterUuidForFindCandidate
Un register anAtmosphereResourcefor being a candidate tofind(String)operation.- Parameters:
r-AtmosphereResource
-
destroy
void destroy() -
resources
ConcurrentMap<String,AtmosphereResource> resources() -
findAll
Collection<AtmosphereResource> findAll()
-
findResource(String)which returnsOptionalinstead of null.