org.globus.wsrf.container
Class ServiceDispatcher

java.lang.Object
  extended byorg.globus.wsrf.container.ServiceDispatcher
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
GSIServiceDispatcher

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

Dispatcher reading requests off the socket and putting them into a request queue.


Field Summary
private  java.lang.String configDir
           
private  java.lang.String configProfile
           
protected  ContainerSecurityDescriptor containerDescriptor
           
protected  org.apache.axis.server.AxisServer engine
           
protected  int highWaterMark
           
private  java.lang.String homeDir
           
(package private) static org.globus.util.I18n i18n
           
(package private) static org.apache.commons.logging.Log logger
           
protected  int maxThreads
           
protected  org.apache.axis.MessageContext msgContext
           
protected  int numThreads
           
protected  ServiceRequestQueue queue
           
private  Semaphore semaphore
           
private  java.net.ServerSocket serverSocket
           
private  boolean stopped
           
protected  ServiceThreadPool threadPool
           
private  java.lang.Thread worker
           
 
Constructor Summary
protected ServiceDispatcher()
           
  ServiceDispatcher(java.util.Map properties)
           
 
Method Summary
private  int addThread()
           
protected  org.apache.axis.MessageContext createMessageContext()
           
 org.apache.axis.AxisEngine getAxisEngine()
           
private static int getOptionAsInt(ContainerConfig config, java.lang.String property, int defaultValue)
           
 java.net.ServerSocket getServerSocket()
           
 ServiceRequestQueue getServiceRequestQueue()
           
 ServiceThreadPool getServiceThreadPool()
           
protected  void init()
           
 boolean isStopped()
           
private  void removeThread()
           
 void run()
           
 void setServerSocket(java.net.ServerSocket serverSocket)
           
 void setThreads(int numThreads)
           
protected  void setupThreadPool()
           
 void start(boolean daemon)
          Start this dispatcher.
 void stop()
           
 void waitForInit()
           
 void waitForStop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.commons.logging.Log logger

i18n

static org.globus.util.I18n i18n

serverSocket

private java.net.ServerSocket serverSocket

worker

private volatile java.lang.Thread worker

stopped

private volatile boolean stopped

semaphore

private Semaphore semaphore

queue

protected ServiceRequestQueue queue

threadPool

protected ServiceThreadPool threadPool

numThreads

protected int numThreads

maxThreads

protected int maxThreads

highWaterMark

protected int highWaterMark

engine

protected org.apache.axis.server.AxisServer engine

msgContext

protected org.apache.axis.MessageContext msgContext

containerDescriptor

protected ContainerSecurityDescriptor containerDescriptor

homeDir

private java.lang.String homeDir

configDir

private java.lang.String configDir

configProfile

private java.lang.String configProfile
Constructor Detail

ServiceDispatcher

protected ServiceDispatcher()

ServiceDispatcher

public ServiceDispatcher(java.util.Map properties)
                  throws java.lang.Exception
Method Detail

init

protected void init()
             throws java.lang.Exception
Throws:
java.lang.Exception

createMessageContext

protected org.apache.axis.MessageContext createMessageContext()

setupThreadPool

protected void setupThreadPool()
                        throws java.lang.Exception
Throws:
java.lang.Exception

getAxisEngine

public org.apache.axis.AxisEngine getAxisEngine()

setServerSocket

public void setServerSocket(java.net.ServerSocket serverSocket)

getServerSocket

public java.net.ServerSocket getServerSocket()

setThreads

public void setThreads(int numThreads)

getServiceThreadPool

public ServiceThreadPool getServiceThreadPool()

getServiceRequestQueue

public ServiceRequestQueue getServiceRequestQueue()

getOptionAsInt

private static int getOptionAsInt(ContainerConfig config,
                                  java.lang.String property,
                                  int defaultValue)

run

public void run()
Specified by:
run in interface java.lang.Runnable

waitForInit

public void waitForInit()
                 throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

waitForStop

public void waitForStop()
                 throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

addThread

private int addThread()

removeThread

private void removeThread()

stop

public void stop()
          throws java.io.IOException
Throws:
java.io.IOException

isStopped

public boolean isStopped()

start

public void start(boolean daemon)
Start this dispatcher. Spawns a worker thread to listen for HTTP requests.

Parameters:
daemon - a boolean indicating if the thread should be a daemon.