Package org.astrogrid.samp.hub
Interface HubService
- All Known Implementing Classes:
BasicHubService
,FacadeHubService
,GuiHubService
,MessageTrackerHubService
public interface HubService
Interface defining the work that the hub has to do.
This is independent of profile or transport, and just concerns
keeping track of clients and routing messages between them.
- Since:
- 15 Jul 2008
- Author:
- Mark Taylor
-
Method Summary
Modifier and TypeMethodDescriptionvoid
disconnectAll
(ProfileToken profileToken) Forcibly terminates any connections created by a previous call ofregister(org.astrogrid.samp.hub.ProfileToken)
with a particularprofileToken
.boolean
Indicates whether this hub service is currently open for operations.register
(ProfileToken profileToken) Creates a new connection to this hub service, thereby initiating a new registered client.void
shutdown()
Tidies up any resources owned by this object.void
start()
Begin operation.
-
Method Details
-
start
void start()Begin operation. Theregister(org.astrogrid.samp.hub.ProfileToken)
method should not be called until the hub has been started. -
register
Creates a new connection to this hub service, thereby initiating a new registered client.It is the responsibility of the returned connection, not the user of that connection, to broadcast the various
samp.hub.event.*
notifications at the appropriate times.Most of the
HubConnection
methods are declared to throwSampException
, however, implementations may throw unchecked exceptions if that is more convenient; users of the connection should be prepared to catch these if they occur.- Parameters:
profileToken
- identifier for the profile acting as gatekeeper for this connection- Returns:
- new hub connection representing registration of a new client
- Throws:
SampException
-
disconnectAll
Forcibly terminates any connections created by a previous call ofregister(org.astrogrid.samp.hub.ProfileToken)
with a particularprofileToken
. Any necessary hub events will be sent.- Parameters:
profileToken
- previous argument toregister
-
isHubRunning
boolean isHubRunning()Indicates whether this hub service is currently open for operations.- Returns:
- true iff called between
start()
andshutdown()
-
shutdown
void shutdown()Tidies up any resources owned by this object. Should be called when no longer required.
-