|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.elkoserver.foundation.server.Server
public class Server
The core of an Elko server, holding the run queue, a collection of configuration information extracted from the various Java property settings, as well as access to various important server-intrinsic services (such as port listeners) that are configured by those property settings.
| Constructor Summary | |
|---|---|
Server(BootProperties props,
String serverType,
Trace appTrace)
Generate the Server from Java properties. |
|
| Method Summary | |
|---|---|
void |
connectionCountChange(int delta)
Track the number of connections, so server can exit gracefully. |
void |
enqueue(Runnable runnable)
Drop a runnable onto the main run queue. |
void |
enqueueSlowTask(Callable<Object> task,
ArgRunnable resultHandler)
Drop a task onto the slow queue. |
void |
findService(String service,
ArgRunnable handler,
boolean monitor)
Issue a request for service information to the broker. |
void |
findServiceLink(String service,
ArgRunnable handler)
Obtain a message channel to a service. |
List<HostDesc> |
listeners()
Get the configured listeners for this server. |
NetworkManager |
networkManager()
Get this server's network manager. |
ObjDB |
openObjectDatabase(String propRoot)
Open an asynchronous object database whose location (directory path or remote repository host) is specified by properties. |
BootProperties |
props()
Get this server's properties. |
void |
registerLoadWatcher(LoadWatcher watcher)
Add an object to the collection of objects to be notified when the server samples its load. |
void |
registerReinitWatcher(ReinitWatcher watcher)
Add an object to the collection of objects to be notified when the server is being reinitialized. |
void |
registerService(ServiceDesc service)
Add a new service offering to the collection of services provided by this server. |
void |
registerShutdownWatcher(ShutdownWatcher watcher)
Add an object to the collection of objects to be notified when the server is being shut down. |
void |
reinit()
Reinitialize the server. |
String |
serverName()
Get this server's name. |
List<ServiceDesc> |
services()
Get the services being offered by this server. |
void |
setServiceRefTable(RefTable serviceRefTable)
Assign the ref table that will be used to dispatch messages received from connected services. |
void |
shutdown(boolean kill)
Shut down the server. |
int |
startListeners(String propRoot,
ServiceFactory serviceFactory)
Start listening for connections on all the ports that are configured. |
Trace |
trace()
Return the application trace object for this server. |
void |
unregisterLoadWatcher(LoadWatcher watcher)
Remove an object from the collection of objects that are notified when the server samples its load. |
void |
unregisterReinitWatcher(ReinitWatcher watcher)
Remove an object from the collection of objects that are notified when the server is being reinitialized. |
void |
unregisterShutdownWatcher(ShutdownWatcher watcher)
Remove an object from the collection of objects that are notified when the server is being shut down. |
String |
version()
Return the version ID string for this build. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Server(BootProperties props,
String serverType,
Trace appTrace)
props - The properties, as determined by the boot process.serverType - Server type tag (for generating property names).appTrace - Trace object for event logging.| Method Detail |
|---|
public void connectionCountChange(int delta)
connectionCountChange in interface ConnectionCountMonitordelta - An upward or downward adjustment to the connection count.public void enqueue(Runnable runnable)
runnable - The thing to run.
public void enqueueSlowTask(Callable<Object> task,
ArgRunnable resultHandler)
task - Callable that executes the task. This will be executed in
a separate thread and so is permitted to block.resultHandler - Thunk that will be invoked with the result
returned by the task. This will be executed on the main run queue.
public void findService(String service,
ArgRunnable handler,
boolean monitor)
findService in interface ServiceFinderservice - The service desired.handler - Object to receive the asynchronous result(s).monitor - If true, keep watching for more results after the first.
public void findServiceLink(String service,
ArgRunnable handler)
service - The service desiredhandler - A runnable that will be invoked with a service link to
the requested service once the connection is located or created. The
handler will be passed a null if no connection was possible.public List<HostDesc> listeners()
public NetworkManager networkManager()
public ObjDB openObjectDatabase(String propRoot)
propRoot - Prefix string for all the properties describing the odb
that is to be opened.
public BootProperties props()
public void registerLoadWatcher(LoadWatcher watcher)
watcher - An object to notify about load samples.public void unregisterLoadWatcher(LoadWatcher watcher)
watcher - The object to stop notifying about load samples.public void registerReinitWatcher(ReinitWatcher watcher)
watcher - An object to notify at reinitialization time.public void unregisterReinitWatcher(ReinitWatcher watcher)
watcher - The object that no longer cares about reinitialization.public void registerService(ServiceDesc service)
service - Service descriptor describing the service being added.public void registerShutdownWatcher(ShutdownWatcher watcher)
watcher - An object to notify at shutdown time.public void unregisterShutdownWatcher(ShutdownWatcher watcher)
watcher - The object that no longer cares about shutdown.public void reinit()
public String serverName()
public List<ServiceDesc> services()
public void setServiceRefTable(RefTable serviceRefTable)
serviceRefTable - The ref table to use.public void shutdown(boolean kill)
kill - If true, shut down immediately instead of cleaning up.
public int startListeners(String propRoot,
ServiceFactory serviceFactory)
propRoot - Prefix string for all the properties describing the
listeners that are to be started.serviceFactory - Object to provide message handler factories for
the new listeners.
public Trace trace()
public String version()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||