|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.javageeks.gjas.LocalServerManager
This class presents a local-to-this-JVM-only ServerManager. It is useful for localized testing, and for loading/running Services within their own JVM. Note that use of this ServerManager does not inherently prevent object-sharing or prevent inter-JVM communication of Services, since it does nothing to block sockets or any other IPC communication. For example, nothing prevents us from running a LocalServerManager with a SocketControlService that allows us to remotely (through the SocketControlService) start, stop and otherwise control the Services listed within this JVM.
Note that LocalServerManager, by default, uses the local (default) ClassLoader scheme to load and find its classes, so any classes loaded will need to be found on the CLASSPATH and/or as an extension.
Constructor Summary | |
LocalServerManager()
|
Method Summary | |
IServer |
addService(Service svc,
ConfigProperties args)
Add the loaded Service to the list of Servers and start it |
IServer |
addService(java.lang.String svcName,
ConfigProperties args)
Add a Service by name; this presumes that the Service has already been deployed to this ServerManager via the deployService method. |
void |
deployService(java.lang.String serviceName,
ClassLoaderStrategy strategy)
Place a ClassLoaderStrategy into the service-loaders map, so subsequent addService() calls can use the loader to retrieve the necessary code. |
void |
error(java.lang.Exception ex)
|
void |
error(java.lang.String msg)
|
java.io.OutputStream |
getErrStream()
Return the OutputStream used for writing errors. |
java.io.OutputStream |
getLogStream()
Return the OutputStream used for writing to the log. |
IServer |
getService(java.lang.String instanceID)
Obtain a reference to a Server instance by ID. |
java.lang.String[] |
getServices()
Obtain a list of every Server instance running in the system. |
void |
killService(java.lang.String instanceID)
Try to kill the Service--don't try to stop() it |
IServer |
loadService(Service svc)
|
IServer |
loadService(java.lang.String svcName)
|
void |
log(java.lang.Exception ex)
|
void |
log(java.lang.String msg)
|
static void |
main(java.lang.String[] args)
This is the entry point of the LocalServerManager system; it creates an instance of LocalServerManager (which in turn registers itself as the one-and-only ServerManager instance), then parses the command line for arguments indicating which Services to load and start. |
void |
removeService(java.lang.String instanceID)
Attempt to stop (if necessary) and remove an instance of a Server. |
void |
setErrStream(java.io.OutputStream os)
Set the OutputStream used for writing errors. |
void |
setLogStream(java.io.OutputStream os)
Set the OutputStream used for writing to the log. |
void |
shutdown()
Shut the entire system down, usually in preparation for terminating this VM (or perhaps for doing a complete shutdown/restart cycling). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LocalServerManager()
Method Detail |
public void shutdown()
getServices
to get all
Servers' instanceIDs, then calling removeService
on each one.shutdown
in interface IServerManager
public void deployService(java.lang.String serviceName, ClassLoaderStrategy strategy)
deployService
in interface IServerManager
public IServer loadService(Service svc)
loadService
in interface IServerManager
public IServer loadService(java.lang.String svcName)
loadService
in interface IServerManager
public IServer addService(Service svc, ConfigProperties args)
addService
in interface IServerManager
public IServer addService(java.lang.String svcName, ConfigProperties args)
addService
in interface IServerManager
public void removeService(java.lang.String instanceID)
removeService
in interface IServerManager
public void killService(java.lang.String instanceID)
killService
in interface IServerManager
public java.lang.String[] getServices()
getServices
in interface IServerManager
public IServer getService(java.lang.String instanceID)
getService
in interface IServerManager
public void log(java.lang.String msg)
log
in interface IServerManager
public void log(java.lang.Exception ex)
log
in interface IServerManager
public void error(java.lang.String msg)
error
in interface IServerManager
public void error(java.lang.Exception ex)
error
in interface IServerManager
public java.io.OutputStream getLogStream()
public void setLogStream(java.io.OutputStream os)
public java.io.OutputStream getErrStream()
public void setErrStream(java.io.OutputStream os)
public static void main(java.lang.String[] args)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |