Package org.apache.axis.transport.http
Class SimpleAxisServer
- java.lang.Object
-
- org.apache.axis.transport.http.SimpleAxisServer
-
- All Implemented Interfaces:
java.lang.Runnable
public class SimpleAxisServer extends java.lang.Object implements java.lang.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
Fields Modifier and Type Field Description protected static org.apache.commons.logging.Log
log
static int
MAX_SESSIONS_DEFAULT
static int
sessionIndex
-
Constructor Summary
Constructors Constructor Description 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 limitSimpleAxisServer(int maxPoolSize, int maxSessions)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Session
createSession(java.lang.String cooky)
demand create a session if there is not already one for the stringprotected void
finalize()
stop the server if not already told to.AxisServer
getAxisServer()
demand create an axis server; return an existing one if one exists.boolean
getDoThreads()
int
getMaxSessions()
get max session countEngineConfiguration
getMyConfig()
static ThreadPool
getPool()
get the thread pooljava.net.ServerSocket
getServerSocket()
Obtain the serverSocket that that SimpleAxisServer is listening on.protected boolean
isSessionUsed()
static void
main(java.lang.String[] args)
Server process.void
run()
Accept requests from a given TCP port and send them through the Axis engine for processing.void
setDoThreads(boolean value)
turn threading on or off.void
setMaxSessions(int maxSessions)
Resize the session mapvoid
setMyConfig(EngineConfiguration myConfig)
void
setServerSocket(java.net.ServerSocket serverSocket)
Set the serverSocket this server should listen on.void
start()
Start this server as a NON-daemon.void
start(boolean daemon)
Start this server.void
stop()
Stop this server.
-
-
-
Field Detail
-
log
protected static org.apache.commons.logging.Log log
-
MAX_SESSIONS_DEFAULT
public static final int MAX_SESSIONS_DEFAULT
- See Also:
- Constant Field Values
-
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 threadsmaxSessions
- maximum sessions
-
-
Method Detail
-
getPool
public static ThreadPool getPool()
get the thread pool- Returns:
-
finalize
protected void finalize() throws java.lang.Throwable
stop the server if not already told to.- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
getMaxSessions
public int getMaxSessions()
get max session count- Returns:
-
setMaxSessions
public void setMaxSessions(int maxSessions)
Resize the session map- Parameters:
maxSessions
- maximum sessions
-
isSessionUsed
protected boolean isSessionUsed()
-
setDoThreads
public void setDoThreads(boolean value)
turn threading on or off. This sets a static value- Parameters:
value
-
-
getDoThreads
public boolean getDoThreads()
-
getMyConfig
public EngineConfiguration getMyConfig()
-
setMyConfig
public void setMyConfig(EngineConfiguration myConfig)
-
createSession
protected Session createSession(java.lang.String cooky)
demand create a session if there is not already one for the string- Parameters:
cooky
-- Returns:
- a session.
-
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:
-
run
public void run()
Accept requests from a given TCP port and send them through the Axis engine for processing.- Specified by:
run
in interfacejava.lang.Runnable
-
getServerSocket
public java.net.ServerSocket getServerSocket()
Obtain the serverSocket that that SimpleAxisServer is listening on.
-
setServerSocket
public void setServerSocket(java.net.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) throws java.lang.Exception
Start this server. Spawns a worker thread to listen for HTTP requests.- Parameters:
daemon
- a boolean indicating if the thread should be a daemon.- Throws:
java.lang.Exception
-
start
public void start() throws java.lang.Exception
Start this server as a NON-daemon.- Throws:
java.lang.Exception
-
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().
-
main
public static void main(java.lang.String[] args)
Server process.
-
-