com.googlecode.mobilityrpc.quickstart
Class EmbeddedMobilityServer

java.lang.Object
  extended by com.googlecode.mobilityrpc.quickstart.EmbeddedMobilityServer

public class EmbeddedMobilityServer
extends Object

A quick way to programmatically start the Mobility-RPC library to listen for incoming connections, using default settings. The library will listen for incoming connections on port 5739, on all network interfaces detected on the machine.

Usage
Usage of this class is fairly straightforward. The start() and stop() methods start the library listening for incoming connections, and shut it down, respectively. Once the library has been started, the getMobilityController() method returns the MobilityController object, which is responsible for managing all aspects of the library, and provides the main API of the library.

Applications which start the library via this class should remember to call stop() when the application is shutting down (or being undeployed/redeployed), to have the library stop any threads it started and unbind from network ports.

This class is provided for convenience. Applications needing to override default settings can initialize the library via the library's main API, through MobilityRPC, which allows custom settings to be specified.

Author:
Niall Gallagher

Field Summary
static int DEFAULT_PORT
           
 
Constructor Summary
EmbeddedMobilityServer()
           
 
Method Summary
static MobilityController getMobilityController()
           
static MobilityController start()
          Starts the Mobility-RPC library to listen for incoming connections on port 5739 on all network interfaces detected on the local machine.
static void stop()
          Shuts down the instance of the Mobility-RPC library which was created via the start() method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values
Constructor Detail

EmbeddedMobilityServer

public EmbeddedMobilityServer()
Method Detail

start

public static MobilityController start()
Starts the Mobility-RPC library to listen for incoming connections on port 5739 on all network interfaces detected on the local machine.

This method returns the MobilityController once initialised, the object responsible for managing all aspects of the library, and providing the main API of the library. This can also be accessed subsequently via the getMobilityController() method.

Returns:
The MobilityController object responsible for managing all aspects of the library, and providing the main API of the library
Throws:
IllegalStateException - If the library is already started

stop

public static void stop()
Shuts down the instance of the Mobility-RPC library which was created via the start() method. If the library was never initialized via that method, this method does nothing.


getMobilityController

public static MobilityController getMobilityController()
Returns:
the MobilityController object responsible for managing all aspects of the library instance started via thevstart() method, and providing the main API of the library
Throws:
IllegalStateException - If the library has not been started via the start() method


Copyright © 2016. All rights reserved.