|
|||||||||
| Home >> All >> [ mucode overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
mucode
Class MuServer

java.lang.Objectjava.lang.Thread
mucode.MuServer
- All Implemented Interfaces:
- MuConstants, java.lang.Runnable
- public class MuServer
- extends java.lang.Thread
- implements MuConstants
- extends java.lang.Thread
Provides an abstraction of the run-time support needed to receive and/or
execute mobile code.
A MuServer object does not enable per se the handling of
incoming mobile code, rather they provide only the capability to ship
mobile code to other µServers. In order to accept incoming
mobile code, a thread listening for incoming groups must be explicitly
started in the µServer by calling the boot() 55
method. This choice minimizes the overhead introduced by the run-time
support, wasting a thread only when really needed. Multiple servers can be
started on the same Java VM or on different Java VMs on the same host, as
long as their are given different port numbers. However, the name spaces
defined by their (shared) class spaces are disjoint, and
their sets of ubiquitous classes (see isUbiquitous(java.lang.String) 55 and MuClassLoader) may be different.
- Version:
- 1.0
| Nested Class Summary |
| Nested classes inherited from class java.lang.Thread |
java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
private static java.lang.String |
builtinUbiPackages
|
(package private) static java.lang.String[] |
classpath
Contains all the directories listed in the CLASSPATH system
variable. |
private boolean |
compressionON
|
private boolean |
debugON
|
protected static MuClassLoader |
defaultLoader
The class loader for all non-mobile threads. |
protected static java.util.Properties |
defaultProperties
The default properties. |
(package private) static java.lang.String |
ERRMSG
|
private boolean |
errorsON
|
protected MuClassLoader |
incomingLoader
The class loader used to handle incoming groups. |
protected static java.util.Hashtable |
loaders
The "persistency root" for class loaders. |
private boolean |
messagesON
|
private int |
port
|
java.util.Properties |
properties
The properties of this µServer. |
private java.lang.Thread |
serverThread
Needed to perform the shutdown of the server. |
protected ClassSpace |
sharedSpace
The class space visible outside the server. |
private long |
timeout
|
private java.util.Vector |
ubiquitousClasses
Holds the list of ubiquitous classes that are not in ubiquitous packages. |
private java.util.Vector |
ubiquitousPackagePrefixes
Holds the list of packages that are ubiquitous, and whose subpackages are considered ubiquitous as well. |
private java.util.Vector |
ubiquitousPackages
Holds the list of ubiquitous packages. |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Fields inherited from interface mucode.MuConstants |
COMPRESSIONkey, DEBUGkey, DYN_LINK, ERRORSkey, GROUP, MESSAGESkey, OK, PACKAGE_NAME, PORTkey, REMOTE_ERROR, SERVER_PORT, TIMEOUT, TIMEOUTkey, UBICLASSESkey, UBIPACKAGESkey, UNKNOWN |
| Constructor Summary | |
MuServer()
The µServer constructor. |
|
| Method Summary | |
void |
addUbiquitousClass(java.lang.String className)
Add all the classes contained in a package to the set of ubiquitous classes, i.e., the classes present on every node. |
void |
addUbiquitousPackage(java.lang.String packageName)
Specify the packages that are considered to be ubiquitous, i.e., whose classes are assumed to be present on every node. |
void |
boot()
Start the run-time support listening for incoming groups. |
protected void |
cleanup()
|
protected MuClassLoader |
createClassLoader()
|
Group |
createGroup(java.lang.String root,
java.lang.String handler)
Create a new Group object. |
(package private) void |
D(java.lang.String msg)
|
(package private) void |
D(java.lang.String msg,
java.lang.Throwable e)
|
(package private) void |
Err(java.lang.String msg)
|
(package private) void |
Err(java.lang.String msg,
java.lang.Throwable e)
|
int |
getPort()
Retrieve the socket port the µServer is listening to. |
ClassSpace |
getPrivateClassSpace()
Retrieves the private class space associated with the thread object invoking the method. |
static MuServer |
getServer()
Retrieve the µServer managing the thread object invoking this method. |
static MuServer |
getServer(java.lang.Object obj)
Retrieve the µServer associated with the given object. |
static MuServer |
getServer(java.lang.Thread t)
Retrieve the µServer managing the thread object passed as a parameter. |
ClassSpace |
getSharedClassSpace()
Retrieve the shared class space associated with the µServer containing the thread object invoking the method. |
long |
getTimeout()
Retrieve the timeout (in milliseconds) for synchronous transfers. |
private void |
insertUbiquitousPackage(java.lang.String packageName)
|
boolean |
isCompressionOn()
Return true, if GZIP compression is used during outgoing
communication, false otherwise. |
boolean |
isDebugOn()
Return true, if debug messages are shown on the standard
output stream, false otherwise. |
boolean |
isErrorsOn()
Return true, if error messages are shown on the standard
error stream, false otherwise. |
boolean |
isMessagesOn()
Return true, if messages are shown on the standard
output stream, false otherwise. |
boolean |
isUbiquitous(java.lang.String className)
Return true if a class is ubiquitous, (i.e., it is assumed
to be present on every node), false otherwise. |
void |
loadProperties(java.lang.String filename)
Loads into the server the properties read from a file. |
private void |
loadPropertyVars()
|
(package private) void |
M(java.lang.String msg)
Output Message handling |
(package private) static java.net.InetAddress |
parseHost(java.lang.String destination)
Extracts the host component from an address specified as host:port. |
(package private) static int |
parsePort(java.lang.String destination)
Extracts the port component from an address specified as host:port. |
void |
run()
Implements the Runnable interface, and contains the
behavior of the server. |
void |
setProperty(java.lang.String key,
java.lang.String value)
Set the value of a property. |
void |
shutDown()
Stop the run-time support listening for incoming groups. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
ERRMSG
static final java.lang.String ERRMSG
- See Also:
- Constant Field Values
builtinUbiPackages
private static final java.lang.String builtinUbiPackages
- See Also:
- Constant Field Values
defaultProperties
protected static java.util.Properties defaultProperties
- The default properties.
properties
public java.util.Properties properties
- The properties of this µServer. Properties are stored as
pairs
. The set of legal keys (here, the constantsare shown, rather than the actual key string), their corresponding default value, and their meaning is:Key Default value Description MESSAGESkeytrueActivates server messages on the standard output stream. ERRORSkeytrueActivates errors messages on the standard error stream. DEBUGkeyfalseActivates debugging messages on the standard output stream. COMPRESSIONkeytrueActivates compression of the serialized stream containing outgoing mobile code. PORTkey1968The port number for incoming connections. TIMEOUTkey30000The timeout for network connections. Properties can be set using the method setProperty 55 , and retrieved using the methods of java.util.Properties.
port
private int port
timeout
private long timeout
compressionON
private boolean compressionON
errorsON
private boolean errorsON
debugON
private boolean debugON
messagesON
private boolean messagesON
incomingLoader
protected MuClassLoader incomingLoader
- The class loader used to handle incoming groups.
defaultLoader
protected static MuClassLoader defaultLoader
- The class loader for all non-mobile threads. There's only one per VM
and doesn't have any server associated with it.
sharedSpace
protected ClassSpace sharedSpace
- The class space visible outside the server.
loaders
protected static java.util.Hashtable loaders
- The "persistency root" for class loaders.
Key: Thread object. Value: class loader.
serverThread
private java.lang.Thread serverThread
- Needed to perform the shutdown of the server.
ubiquitousPackagePrefixes
private java.util.Vector ubiquitousPackagePrefixes
- Holds the list of packages that are ubiquitous, and whose subpackages
are considered ubiquitous as well.
ubiquitousPackages
private java.util.Vector ubiquitousPackages
- Holds the list of ubiquitous packages.
ubiquitousClasses
private java.util.Vector ubiquitousClasses
- Holds the list of ubiquitous classes that are not in ubiquitous
packages.
classpath
static java.lang.String[] classpath
- Contains all the directories listed in the
CLASSPATHsystem variable. Used for locating a class in the system.
| Constructor Detail |
MuServer
public MuServer()
- The µServer constructor.
| Method Detail |
setProperty
public void setProperty(java.lang.String key, java.lang.String value)
- Set the value of a property. See
properties55 for a list of key, default values, and their meaning.
loadProperties
public void loadProperties(java.lang.String filename) throws java.io.FileNotFoundException, java.io.IOException
- Loads into the server the properties read from a file. The format is the
same used by Java, i.e.,
key=valueon separate lines. The following would be a property file for the default values:messages=true errors=true debug=false compression=true port=1968 timeout=30000 ubiclasses= ubipackages=java.* javax.* mucode.*
loadPropertyVars
private void loadPropertyVars()
getPort
public int getPort()
- Retrieve the socket port the µServer is listening to.
getTimeout
public long getTimeout()
- Retrieve the timeout (in milliseconds) for synchronous transfers.
isCompressionOn
public boolean isCompressionOn()
- Return
true, if GZIP compression is used during outgoing communication,falseotherwise.
isDebugOn
public boolean isDebugOn()
- Return
true, if debug messages are shown on the standard output stream,falseotherwise.
isErrorsOn
public boolean isErrorsOn()
- Return
true, if error messages are shown on the standard error stream,falseotherwise.
isMessagesOn
public boolean isMessagesOn()
- Return
true, if messages are shown on the standard output stream,falseotherwise.
addUbiquitousPackage
public final void addUbiquitousPackage(java.lang.String packageName)
- Specify the packages that are considered to be ubiquitous, i.e., whose
classes are assumed to be present on every node. Ubiquitous classes are
the first one to be searched by the class loader. If
packageNameends with.*, all the subpackages are made ubiquitous as well. Thus, for instance, calling this method by passing("mypackage")results in considering ubiquitous only all the classes inmypackage, but not for instance those inmypackage.mysubpackage. By default, system classes (java.*and subpackages), Java extensions (javax.*and subpackages), and µCode classes (mucode.*and subpackages) are ubiquitous.
insertUbiquitousPackage
private final void insertUbiquitousPackage(java.lang.String packageName)
addUbiquitousClass
public final void addUbiquitousClass(java.lang.String className)
- Add all the classes contained in a package to the set of ubiquitous
classes, i.e., the classes present on every node. Ubiquitous classes are
the first one to be searched by the class loader. System classes
(
java.*, and the primitive types) and µCode classes (mucode.*) are ubiquitous by default.
isUbiquitous
public final boolean isUbiquitous(java.lang.String className)
- Return
trueif a class is ubiquitous, (i.e., it is assumed to be present on every node),falseotherwise.
createGroup
public final Group createGroup(java.lang.String root, java.lang.String handler)
- Create a new
Groupobject. This operation must be requested to a specific µServer rather than being performed by application code, because resolution of the group classes depend on the contents of the class spaces associated to a particular µServer.
getSharedClassSpace
public ClassSpace getSharedClassSpace()
- Retrieve the shared class space associated with the µServer
containing the thread object invoking the method.
getPrivateClassSpace
public final ClassSpace getPrivateClassSpace()
- Retrieves the private class space associated with the thread object
invoking the method.
boot
public final void boot()
- Start the run-time support listening for incoming groups.
shutDown
public final void shutDown()
- Stop the run-time support listening for incoming groups.
getServer
public static final MuServer getServer()
- Retrieve the µServer managing the thread object invoking
this method. If the thread object is a stationary one, i.e. it has not
been created as a consequence of a migration, the method returns
null.
getServer
public static final MuServer getServer(java.lang.Thread t)
- Retrieve the µServer managing the thread object passed as a
parameter. If the thread object is a stationary one, i.e. it has not
been created as a consequence of a migration, the method returns
null.
getServer
public static final MuServer getServer(java.lang.Object obj)
- Retrieve the µServer associated with the given object. If
the object has not been inside a µServer, the method returns
null.
run
public void run()
- Implements the
Runnableinterface, and contains the behavior of the server.- Specified by:
runin interfacejava.lang.Runnable
cleanup
protected void cleanup()
M
void M(java.lang.String msg)
- Output Message handling
D
void D(java.lang.String msg)
Err
void Err(java.lang.String msg)
D
void D(java.lang.String msg, java.lang.Throwable e)
Err
void Err(java.lang.String msg, java.lang.Throwable e)
parseHost
static java.net.InetAddress parseHost(java.lang.String destination) throws java.net.UnknownHostException
- Extracts the host component from an address specified as
host:port.
parsePort
static int parsePort(java.lang.String destination) throws java.net.UnknownHostException
- Extracts the port component from an address specified as
host:port. If the port is not specified, the default value as specified in the classPropertiesis returned.
createClassLoader
protected MuClassLoader createClassLoader()
|
|||||||||
| Home >> All >> [ mucode overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC