org.apache.axis.transport.http

Class SimpleAxisServer

public class SimpleAxisServer extends Object implements Runnable

This is a simple implementation of an HTTP server for processing SOAP requests via Apache's xml-axis. This is not intended for production use. Its intended uses are for demos, debugging, and performance profiling. Note this classes uses static objects to provide a thread pool, so you should not use multiple instances of this class in the same JVM/classloader unless you want bad things to happen at shutdown.

Author: Sam Ruby (ruby@us.ibm.com) Rob Jellinghaus (robj@unrealities.com) Alireza Taherkordi (a_taherkordi@users.sourceforge.net)

Field Summary
protected static Loglog
static intMAX_SESSIONS_DEFAULT
static intsessionIndex
Constructor Summary
SimpleAxisServer()
create a server with the default threads and sessions.
SimpleAxisServer(int maxPoolSize)
Create a server with a configurable pool side; sessions set to the default limit
SimpleAxisServer(int maxPoolSize, int maxSessions)
Constructor
Method Summary
protected SessioncreateSession(String cooky)
demand create a session if there is not already one for the string
protected voidfinalize()
stop the server if not already told to.
AxisServergetAxisServer()
demand create an axis server; return an existing one if one exists.
booleangetDoThreads()
intgetMaxSessions()
get max session count
EngineConfigurationgetMyConfig()
static ThreadPoolgetPool()
get the thread pool
ServerSocketgetServerSocket()
Obtain the serverSocket that that SimpleAxisServer is listening on.
protected booleanisSessionUsed()
static voidmain(String[] args)
Server process.
voidrun()
Accept requests from a given TCP port and send them through the Axis engine for processing.
voidsetDoThreads(boolean value)
turn threading on or off.
voidsetMaxSessions(int maxSessions)
Resize the session map
voidsetMyConfig(EngineConfiguration myConfig)
voidsetServerSocket(ServerSocket serverSocket)
Set the serverSocket this server should listen on. (note : changing this will not affect a running server, but if you stop() and then start() the server, the new socket will be used).
voidstart(boolean daemon)
Start this server.
voidstart()
Start this server as a NON-daemon.
voidstop()
Stop this server.

Field Detail

log

protected static Log log

MAX_SESSIONS_DEFAULT

public static final int MAX_SESSIONS_DEFAULT

sessionIndex

public static int sessionIndex

Constructor Detail

SimpleAxisServer

public SimpleAxisServer()
create a server with the default threads and sessions.

SimpleAxisServer

public SimpleAxisServer(int maxPoolSize)
Create a server with a configurable pool side; sessions set to the default limit

Parameters: maxPoolSize maximum thread pool size

SimpleAxisServer

public SimpleAxisServer(int maxPoolSize, int maxSessions)
Constructor

Parameters: maxPoolSize max number of threads maxSessions maximum sessions

Method Detail

createSession

protected Session createSession(String cooky)
demand create a session if there is not already one for the string

Parameters: cooky

Returns: a session.

finalize

protected void finalize()
stop the server if not already told to.

Throws: Throwable

getAxisServer

public AxisServer getAxisServer()
demand create an axis server; return an existing one if one exists. The configuration for the axis server is derived from #myConfig if not null, the default config otherwise.

Returns:

getDoThreads

public boolean getDoThreads()

getMaxSessions

public int getMaxSessions()
get max session count

Returns:

getMyConfig

public EngineConfiguration getMyConfig()

getPool

public static ThreadPool getPool()
get the thread pool

Returns:

getServerSocket

public ServerSocket getServerSocket()
Obtain the serverSocket that that SimpleAxisServer is listening on.

isSessionUsed

protected boolean isSessionUsed()

main

public static void main(String[] args)
Server process.

run

public void run()
Accept requests from a given TCP port and send them through the Axis engine for processing.

setDoThreads

public void setDoThreads(boolean value)
turn threading on or off. This sets a static value

Parameters: value

setMaxSessions

public void setMaxSessions(int maxSessions)
Resize the session map

Parameters: maxSessions maximum sessions

setMyConfig

public void setMyConfig(EngineConfiguration myConfig)

setServerSocket

public void setServerSocket(ServerSocket serverSocket)
Set the serverSocket this server should listen on. (note : changing this will not affect a running server, but if you stop() and then start() the server, the new socket will be used).

start

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

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

start

public void start()
Start this server as a NON-daemon.

stop

public void stop()
Stop this server. Can be called safely if the system is already stopped, or if it was never started. This will interrupt any pending accept().
Copyright B) 2005 Apache Web Services Project. All Rights Reserved.