com.googlecode.mobilityrpc.controller
Interface MobilityController

All Superinterfaces:
Destroyable
All Known Subinterfaces:
MobilityControllerInternal
All Known Implementing Classes:
MobilityControllerImpl

public interface MobilityController
extends Destroyable

Manages an instance of the Mobility-RPC library and provides access to its main APIs.

Provides access to MobilitySession objects, the gateway through which the application can send objects to remote machines.

Provides access to a ConnectionManager object, allowing the application to request the library to bind/unbind from ports/network interfaces to listen for incoming connections and receive objects from remote machines.

Author:
Niall Gallagher

Method Summary
 void destroy()
          Destroys (closes/shuts down) the resources managed by the controller, closing connections, stopping threads, releasing all sessions etc.
 ConnectionManager getConnectionManager()
          Returns the ConnectionManager which manages connections for this controller.
 MobilitySession getSession(UUID sessionId)
          Returns the existing session with the specified id, or if no such session with the id exists, (re)creates a new session with the same id and adds it to the session registry.
 MobilitySession newSession()
          Creates a new session, with a newly generated UUID, and adds it to the session registry.
 void releaseSession(UUID sessionId)
          Releases the given session immediately, if it is registered.
 

Method Detail

getConnectionManager

ConnectionManager getConnectionManager()
Returns the ConnectionManager which manages connections for this controller.

Returns:
The ConnectionManager which manages connections for this controller

getSession

MobilitySession getSession(UUID sessionId)
Returns the existing session with the specified id, or if no such session with the id exists, (re)creates a new session with the same id and adds it to the session registry.

Parameters:
sessionId - The session id of the session to return
Returns:
The existing session with the specified id, or a new session initialised with this same id

newSession

MobilitySession newSession()
Creates a new session, with a newly generated UUID, and adds it to the session registry.

Returns:
A new session

releaseSession

void releaseSession(UUID sessionId)
Releases the given session immediately, if it is registered. If not registered, does nothing.

Note: the preferred way to release a session is via MobilitySession.release(), which includes logic to gracefully release sessions after threads which are using them have finished. This method would release sessions while they are in use, which could cause errors for requests executing in those sessions.

Parameters:
sessionId - The session id to release

destroy

void destroy()
Destroys (closes/shuts down) the resources managed by the controller, closing connections, stopping threads, releasing all sessions etc.

Specified by:
destroy in interface Destroyable


Copyright © 2016. All rights reserved.