net.larsan.urd.impl
Class UrdServer

java.lang.Object
  |
  +--net.larsan.urd.impl.UrdServer
All Implemented Interfaces:
java.lang.Runnable

public class UrdServer
extends java.lang.Object
implements java.lang.Runnable

This is the main Urd server class. This class does not do any preparations to its execution but asumes that all needed objects will be available in the Urd JNDI context.

The context must be prepared by this class environment. In particular this server will search the context for the following objects:

      /urd/classloader/shared (shared services class loader)
      /urd/threads (the framework thread pool)
 
All of the above objects must be available before this server can start. And should any of them be missing the execution will immediately halt. The server will also look for the following objects, but will use default values if they are not found:
      /urd/handler (current error handler; default: stderr)
      /urd/classloader/system (system framework class loader; default: current class loader)
      /urd/classloader/service (service root classloader; default: parent class loader)
 
The command line server takes its default values (such as address and port) from the preference object from the JNDI context ('/urd/pref').

Version:
Alpha-0.1 / 2002-10-06 21:37
Author:
Lars J. Nilsson

Constructor Summary
UrdServer()
          Create server
 
Method Summary
 void addServerListener(UrdServerListener list)
          Add listener to this server.
protected  void cleanup()
          Cleanup resources
 java.lang.Thread[] dumpThreads()
          Print all threads
 Registry getRegistry()
          Get the service registry.
protected  boolean getRunFlag()
          Get internal thread flag
 ListInfo info(java.lang.String url)
          List service info
 void kill()
          Kill the server
 ListInfo[] list()
          List all services
 void removeServerListener(UrdServerListener list)
          Remive listener from this server
 void run()
          Run server
protected  void setRunFlag(boolean runFlag)
          Set internal thread flag
 void shutdown(long millis)
          Shutdown server.
 void startService(java.lang.String service)
          Start service command
 void stopService(java.lang.String service)
          Stop service command
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrdServer

public UrdServer()
Create server

Method Detail

run

public void run()
Run server

Specified by:
run in interface java.lang.Runnable

getRegistry

public Registry getRegistry()
Get the service registry.


addServerListener

public void addServerListener(UrdServerListener list)
Add listener to this server.


removeServerListener

public void removeServerListener(UrdServerListener list)
Remive listener from this server


kill

public void kill()
Kill the server


cleanup

protected void cleanup()
Cleanup resources


shutdown

public void shutdown(long millis)
Shutdown server.

Parameters:
millis - Millisecond timeout for shutdown event

getRunFlag

protected boolean getRunFlag()
Get internal thread flag


setRunFlag

protected void setRunFlag(boolean runFlag)
Set internal thread flag


dumpThreads

public java.lang.Thread[] dumpThreads()
Print all threads


info

public ListInfo info(java.lang.String url)
              throws NoSuchServiceException
List service info

NoSuchServiceException

list

public ListInfo[] list()
List all services


startService

public void startService(java.lang.String service)
                  throws NoSuchServiceException
Start service command

NoSuchServiceException

stopService

public void stopService(java.lang.String service)
                 throws NoSuchServiceException
Stop service command

NoSuchServiceException