public class DefaultAtmosphereResourceFactory extends Object implements AtmosphereResourceFactory
AtmosphereResource
instances. You can use this factory to create, remove and find
AtmosphereResource
instances that are associated with one or several Broadcaster
s.AtmosphereResourceFactory.Async
Constructor and Description |
---|
DefaultAtmosphereResourceFactory() |
public void configure(AtmosphereConfig config)
AtmosphereConfigAware
configure
in interface AtmosphereResourceFactory
configure
in interface AtmosphereConfigAware
config
- AtmosphereConfig
public AtmosphereResource create(AtmosphereConfig config, AtmosphereRequest request, AtmosphereResponse response, AsyncSupport<?> a)
AtmosphereResourceImpl
create
in interface AtmosphereResourceFactory
config
- an AtmosphereConfig
request
- an AtmosphereResponse
a
- AsyncSupport
AtmosphereResourceImpl
public AtmosphereResource create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereRequest request, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler)
AtmosphereResourceImpl
.create
in interface AtmosphereResourceFactory
config
- an AtmosphereConfig
broadcaster
- a Broadcaster
response
- an AtmosphereResponse
a
- AsyncSupport
handler
- an AtmosphereHandler
AtmosphereResourceImpl
public AtmosphereResource create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereRequest request, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler, AtmosphereResource.TRANSPORT t)
AtmosphereResourceImpl
.create
in interface AtmosphereResourceFactory
config
- an AtmosphereConfig
broadcaster
- a Broadcaster
response
- an AtmosphereResponse
a
- AsyncSupport
handler
- an AtmosphereHandler
t
- an AtmosphereResource.TRANSPORT
AtmosphereResourceImpl
public AtmosphereResource create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler)
AtmosphereResourceImpl
.create
in interface AtmosphereResourceFactory
config
- an AtmosphereConfig
broadcaster
- a Broadcaster
response
- an AtmosphereResponse
a
- AsyncSupport
handler
- an AtmosphereHandler
AtmosphereResourceImpl
public AtmosphereResource create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler, AtmosphereResource.TRANSPORT t)
create
in interface AtmosphereResourceFactory
public AtmosphereResource create(AtmosphereConfig config, AtmosphereResponse response, AsyncSupport<?> a)
AtmosphereResourceImpl
.create
in interface AtmosphereResourceFactory
config
- an AtmosphereConfig
response
- an AtmosphereResponse
a
- AsyncSupport
AtmosphereResourceImpl
public AtmosphereResource create(AtmosphereConfig config, String uuid)
AtmosphereResource
associated with the uuid.create
in interface AtmosphereResourceFactory
config
- an AtmosphereConfig
uuid
- a String representing a UUIDpublic AtmosphereResource create(AtmosphereConfig config, String uuid, AtmosphereRequest request)
AtmosphereResource
associated with the uuid.create
in interface AtmosphereResourceFactory
config
- an AtmosphereConfig
uuid
- a String representing a UUIDrequest
- a AtmosphereRequest
public AtmosphereResource remove(String uuid)
AtmosphereResource
from all instances of Broadcaster
.remove
in interface AtmosphereResourceFactory
uuid
- the AtmosphereResource.uuid()
AtmosphereResource
, or null if not found.public AtmosphereResource find(String uuid)
AtmosphereResource
based on its AtmosphereResource.uuid()
.find
in interface AtmosphereResourceFactory
uuid
- the AtmosphereResource.uuid()
AtmosphereResource
, or null if not found.public void locate(String uuid, AtmosphereResourceFactory.Async async)
AtmosphereResourceFactory
AtmosphereResource
, based on its AtmosphereResource.uuid()
, in a
cluster. If the AtmosphereResource
is available in the cluster, the AtmosphereResourceFactory.Async.available(org.atmosphere.cpr.AtmosphereResource)
callback will be invoked. If not, the org.atmosphere.cpr.AtmosphereResourceFactory.Async#notAvailable
locate
in interface AtmosphereResourceFactory
uuid
- the AtmosphereResource.uuid()
async
- an AtmosphereResourceFactory.Async
@Deprecated public Set<Broadcaster> broadcasters(String uuid)
AtmosphereResourceFactory.find(String)
.broadcasters() insteadBroadcaster
associated with a AtmosphereResource.uuid()
, e.g for which
Broadcaster.addAtmosphereResource(AtmosphereResource)
has been called. Note that this
method is not synchronized and may not return all the Broadcaster
in case
Broadcaster.addAtmosphereResource(AtmosphereResource)
is being called concurrently.broadcasters
in interface AtmosphereResourceFactory
uuid
- the AtmosphereResource.uuid()
Broadcaster
associated with a AtmosphereResource.uuid()
public void registerUuidForFindCandidate(AtmosphereResource r)
AtmosphereResource
for being a candidate to find(String)
operation.registerUuidForFindCandidate
in interface AtmosphereResourceFactory
r
- AtmosphereResource
public void unRegisterUuidForFindCandidate(AtmosphereResource r)
AtmosphereResource
for being a candidate to find(String)
operation.unRegisterUuidForFindCandidate
in interface AtmosphereResourceFactory
r
- AtmosphereResource
public void destroy()
destroy
in interface AtmosphereResourceFactory
public ConcurrentMap<String,AtmosphereResource> resources()
resources
in interface AtmosphereResourceFactory
public Collection<AtmosphereResource> findAll()
findAll
in interface AtmosphereResourceFactory
Copyright © 2016. All rights reserved.