|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlime.LimeServer
The runtime support needed to run Lime on a given host.
There can be multiple Lime servers running on a single host, as long as they are started on separate ports at least 3 apart. This is because (port+1) is used for loading agents, and (port+2) is used for the group manager's SinglePhaseDisseminator. Note that other (future) detectors/disseminators could use more ports.
The server must be
explicitly activated by
calling the boot
method.
The server also provides methods that allow an agent in it to engage the
corresponding host in the Lime community. Engagement takes place as a
distributed transaction that reconciles the state of the system by shuffling
misplaced tuples and installing weak reaction
operations among
the engaging host and those already in the system. Similarly, disengagement
removes a host from the community.
The server can be accessed from within a program, or started from command
line using the Launcher
.
Launcher
Field Summary | |
private java.lang.Object |
changingHostLock
This is used to ensure that the changingHost variable is set before retrieving it. |
private LimeServerID[] |
changingHosts
|
(package private) ConnectionMgr |
cmgr
This is the connection manager. |
private boolean |
connect
|
private static boolean |
debugON
|
protected static java.util.Properties |
defaultProperties
The default server properties. |
(package private) boolean |
disengaging
|
private boolean |
engage
Determines whether the LimeServer should engage immediately. |
private boolean |
engaged
|
private java.lang.String |
engMode
|
private static boolean |
errorsON
|
private GroupManager |
gm
|
(package private) java.lang.String |
gmDetector
A key that specifies the Detector that GroupManager should use. |
(package private) java.lang.String |
gmDisseminator
A key that specifies the Disseminator that GroupManager should use. |
(package private) double |
gmMaxSpeed
A key that specifies the maximum speed at which the host can be moving. |
(package private) double |
gmNetworkLatency
A key that specifies to GroupManager the latency of the network. |
(package private) int |
gmPeriod
A key that specified the period at which GroupManager broadcasts beacons. |
(package private) double |
gmRange
A key that specifies the broadcast range in meters of the wireless card. |
private int |
gpsBaud
|
private java.lang.String |
gpsPort
|
private java.util.Vector |
groupMembers
|
private LocationGenerator |
lg
|
private java.net.ServerSocket |
loadSS
|
private LimeServerID |
localServerID
|
private static java.util.Hashtable |
maxTIDServer
Records the highest tuple ID for each tuple space. |
private java.lang.String |
mcastaddr
|
private int |
mcastport
|
private LimeServerID |
mcastServerID
An ID prepresenting the multicast group this LIMEServer is part of. |
private static boolean |
messagesON
|
private int |
port
|
static java.util.Properties |
properties
The server properties. |
private static LimeServer |
server
|
private boolean |
shutdown
|
private static java.lang.Boolean |
shutdownLock
|
private java.lang.String |
tsfactory
|
Fields inherited from interface lime.PropertyKeys |
CONNECTkey, DEBUGkey, ENGAGEkey, ENGAGEMENT_MODEkey, ERRORSkey, GM_DETECTORkey, GM_DISSEMINATORkey, GM_MAX_SPEEDkey, GM_MCASTADDRkey, GM_MCASTPORTkey, GM_NETWORK_LATENCYkey, GM_PERIODkey, GM_RANGEkey, GPS_BAUDkey, GPS_PORTkey, LOADkey, MESSAGESkey, PORTkey, QUITkey, TSFACTORYkey |
Constructor Summary | |
private |
LimeServer()
The constructor of the LimeServer. |
Method Summary | |
void |
boot()
Activate the runtime support. |
private boolean |
createGroupManager()
Creates a GroupManager for this LimeServer if there is currently no group manager for this server. |
(package private) static void |
debug(java.lang.String msg)
|
(package private) static void |
debug(java.lang.String msg,
java.lang.Object obj)
|
void |
disengage()
Start the disengagement protocol needed to allow a host to depart from a community of mobile hosts. |
void |
engage()
Start the engagement protocol necessary to make this host part of a community of mobile hosts. |
(package private) static void |
error(java.lang.String msg,
java.lang.Throwable e,
boolean exit)
If errors are enabled, prints it to the screen. |
(package private) LimeServerID[] |
getChangingHosts()
Returns the hosts that are changing in this engagement or disengagement. |
private LimeServerID[] |
getLeavingHosts(java.util.Vector newGroupMembers)
This method returns the hosts that are leaving the group. |
int |
getLoadPort()
Returns the port used to load agents onto this LimeServer. |
LimeServerID |
getmcastServerID()
Returns the ID of the multicast server. |
private LimeServerID[] |
getNewHosts(java.util.Vector newGroupMembers)
This method returns the hosts that are new to the group. |
(package private) static long |
getNextTupleID(java.lang.String name)
Return the next tuple id for a given tuple space name. |
int |
getPort()
Returns the port being used by this LIMEServer. |
static LimeServer |
getServer()
Return a handle to the Lime server. |
LimeServerID |
getServerID()
Returns the ID of the local server. |
java.lang.String |
getTupleSpaceFactory()
Returns the tuple space factory |
void |
groupChanged(GroupChangedEvent gce)
The makeup of the group has changed. |
boolean |
isDebugOn()
Returns true if debug messages should be printed. |
boolean |
isEngaged()
Return true if the host is engaged, false otherwise |
boolean |
isErrorsOn()
Returns true if error messages should be printed. |
boolean |
isMessagesOn()
Returns true if messages should be printed. |
boolean |
isPermanentConnections()
Returns true if TCP connections are maintained. |
boolean |
isShuttingDown()
Returns whether shutdown has been called on this LimeServer. |
ILimeAgent |
loadAgent(java.lang.String classname,
java.io.Serializable[] parameters)
Load an agent into the Lime server. |
private void |
loadPropertyVars()
Initializes the property variables based on the values within properties. |
(package private) static void |
message(java.lang.String msg)
|
(package private) static void |
print(java.lang.String msg)
Prints string text to the screen. |
(package private) void |
releaseShutdownLock()
Releases the shutdown lock, allows thread that called shutdown to exit. |
(package private) void |
restartGM()
Restarts the GroupManager. |
void |
run()
Listens on the load port, when a client connects, it passes in the name of the agent that should be loaded into the LimeServer. |
void |
setProperty(java.lang.String key,
java.lang.String value)
|
void |
shutdown(boolean exit)
Shuts down the LimeServer. |
(package private) void |
shutdownGM()
Shuts down the GroupManager. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static java.util.Properties defaultProperties
public static java.util.Properties properties
private java.lang.String mcastaddr
private int mcastport
private int port
private boolean connect
private java.lang.String tsfactory
private static final LimeServer server
private static boolean errorsON
private static boolean debugON
private static boolean messagesON
private static java.lang.Boolean shutdownLock
private LimeServerID localServerID
private boolean engaged
private GroupManager gm
private java.util.Vector groupMembers
private LimeServerID[] changingHosts
private java.lang.String engMode
private java.lang.String gpsPort
private int gpsBaud
private boolean shutdown
private java.net.ServerSocket loadSS
int gmPeriod
double gmRange
double gmMaxSpeed
double gmNetworkLatency
java.lang.String gmDetector
java.lang.String gmDisseminator
private LocationGenerator lg
private LimeServerID mcastServerID
ConnectionMgr cmgr
private boolean engage
private static java.util.Hashtable maxTIDServer
private java.lang.Object changingHostLock
boolean disengaging
Constructor Detail |
private LimeServer()
Method Detail |
public void groupChanged(GroupChangedEvent gce)
groupChanged
in interface GroupChangedListener
gce
- the GroupChangedEventvoid releaseShutdownLock()
private LimeServerID[] getNewHosts(java.util.Vector newGroupMembers)
newGroupMembers
- The complete new group (groupmgmt.Members).
private LimeServerID[] getLeavingHosts(java.util.Vector newGroupMembers)
newGroupMembers
- the complete new group (groupmgmt.Members)
LimeServerID[] getChangingHosts()
void restartGM()
void shutdownGM()
public void setProperty(java.lang.String key, java.lang.String value)
private void loadPropertyVars()
public static LimeServer getServer()
public java.lang.String getTupleSpaceFactory()
public LimeServerID getServerID()
public LimeServerID getmcastServerID()
public int getPort()
public int getLoadPort()
public boolean isPermanentConnections()
public boolean isDebugOn()
public boolean isErrorsOn()
public boolean isMessagesOn()
public void engage()
public void disengage()
public boolean isEngaged()
true
if the host is engaged, false otherwise
public ILimeAgent loadAgent(java.lang.String classname, java.io.Serializable[] parameters) throws AgentCreationException
.class
files) for
this class and all the other classes needed by the agent must be in a
directory in the same CLASSPATH
available to the Lime server
(and to the tuple space engine, if the latter employs user-defined
classes). If the Agent
subclass has a constructor with
parameters, it is possible to create the agent by supplying parameters in
the method call. The correct constructor is automatically retrieved by
the system based on the signature.
classname
- the fully specified name of the agent's class.parameters
- the parameters for instantiating the agent. Their type
must match the type of a constructor of classname
.
ILimeAgent
.
AgentCreationException
- if it is impossible to create the
agent, e.g., because classname
is not a subclass of
ILimeAgent
, or the corresponding classes cannot be found.private boolean createGroupManager()
public void boot()
public void shutdown(boolean exit)
exit
- true if the method should system.exitpublic boolean isShuttingDown()
public void run()
run
in interface java.lang.Runnable
static void print(java.lang.String msg)
static void message(java.lang.String msg)
static void debug(java.lang.String msg)
static void debug(java.lang.String msg, java.lang.Object obj)
static void error(java.lang.String msg, java.lang.Throwable e, boolean exit)
msg
- the message to print.static long getNextTupleID(java.lang.String name)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |