|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSocketListener
org.mortbay.p2psockets.http.P2PSocketListener
Socket HTTP Listener modified to use Jxta P2P Sockets. The behaviour of the listener can be controlled with the attributues of the ThreadedServer and ThreadPool from which it is derived. Specifically:
MinThreads - Minumum threads waiting to service requests. MaxThread - Maximum thread that will service requests. MaxIdleTimeMs - Time for an idle thread to wait for a request or read. LowResourcePersistTimeMs - time in ms that connections will persist if listener is low on resources.We aggregate P2PThreadedServers inside of P2PSocketListeners instead of subclassing from them so that we can retain P2PSocketListener as our superclass, so that the rest of Jetty doesn't have to have know about P2PSocketListener. -- bkn3@columbia.edu
Constructor Summary | |
P2PSocketListener()
|
|
P2PSocketListener(InetAddrPort address)
|
Method Summary | |
void |
customizeRequest(HttpConnection connection,
HttpRequest request)
Customize the request from connection. |
protected void |
customizeRequest(java.net.Socket socket,
HttpRequest request)
Customize request from socket. |
int |
getBufferReserve()
|
int |
getBufferSize()
|
int |
getConfidentialPort()
|
java.lang.String |
getConfidentialScheme()
|
java.lang.String |
getDefaultScheme()
|
java.lang.String |
getHost()
|
HttpServer |
getHttpServer()
|
boolean |
getIdentifyListener()
|
int |
getIdleThreads()
Get the number of idle threads in the pool. |
java.net.InetAddress |
getInetAddress()
|
InetAddrPort |
getInetAddrPort()
|
int |
getIntegralPort()
|
java.lang.String |
getIntegralScheme()
|
int |
getLingerTimeSecs()
|
int |
getLowResourcePersistTimeMs()
|
int |
getMaxIdleTimeMs()
Get the maximum thread idle time. |
int |
getMaxReadTimeMs()
|
int |
getMaxThreads()
Set the maximum number of threads. |
int |
getMinThreads()
Get the minimum number of threads. |
java.lang.String |
getName()
|
int |
getPort()
|
java.net.ServerSocket |
getServerSocket()
|
int |
getThreads()
Get the number of threads in the pool. |
void |
handle(java.lang.Object job)
Handle Job - we modify this to call the handleConnection that is inside of P2PSocketListener. |
void |
handleConnection(java.net.Socket socket)
Handle Job. |
boolean |
isConfidential(HttpConnection connection)
|
boolean |
isIntegral(HttpConnection connection)
|
boolean |
isLowOnResources()
Get the lowOnResource state of the listener. |
boolean |
isOutOfResources()
Get the outOfResource state of the listener. |
boolean |
isStarted()
Is the pool running jobs. |
void |
join()
|
void |
persistConnection(HttpConnection connection)
Persist the connection. |
void |
run(java.lang.Object job)
Run job. |
void |
setBufferReserve(int size)
|
void |
setBufferSize(int size)
|
void |
setConfidentialPort(int confidentialPort)
|
void |
setConfidentialScheme(java.lang.String confidentialScheme)
|
void |
setDefaultScheme(java.lang.String scheme)
|
void |
setHost(java.lang.String host)
|
void |
setHttpServer(HttpServer server)
|
void |
setIdentifyListener(boolean identifyListener)
|
void |
setInetAddress(java.net.InetAddress addr)
|
void |
setInetAddrPort(InetAddrPort address)
Set the server InetAddress and port. |
void |
setIntegralPort(int integralPort)
|
void |
setIntegralScheme(java.lang.String integralScheme)
|
void |
setLingerTimeSecs(int ls)
|
void |
setLowResourcePersistTimeMs(int ms)
Set the low resource persistace time. |
void |
setMaxIdleTimeMs(int maxIdleTimeMs)
Set the maximum thread idle time. |
void |
setMaxStopTimeMs(int ms)
Deprecated. maxIdleTime is used instead. |
void |
setMaxThreads(int maxThreads)
Set the maximum number of threads. |
void |
setMinThreads(int minThreads)
Set the minimum number of threads. |
void |
setName(java.lang.String name)
|
void |
setPort(int port)
|
void |
start()
|
void |
stop()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public P2PSocketListener()
public P2PSocketListener(InetAddrPort address) throws java.io.IOException
Method Detail |
public void setHttpServer(HttpServer server)
public HttpServer getHttpServer()
public int getBufferSize()
public void setBufferSize(int size)
public int getBufferReserve()
public void setBufferReserve(int size)
public boolean getIdentifyListener()
public void setIdentifyListener(boolean identifyListener)
identifyListener
- If true, the listener name is added to all
requests as the org.mortbay.http.HttListener attributepublic void setDefaultScheme(java.lang.String scheme)
public java.lang.String getDefaultScheme()
public int getLowResourcePersistTimeMs()
public void setLowResourcePersistTimeMs(int ms)
ms
- time in ms that connections will persist if listener is
low on resources.public void start() throws java.lang.Exception
java.lang.Exception
public void stop() throws java.lang.InterruptedException
java.lang.InterruptedException
public void handleConnection(java.net.Socket socket) throws java.io.IOException
java.io.IOException
public void customizeRequest(HttpConnection connection, HttpRequest request)
request
- protected void customizeRequest(java.net.Socket socket, HttpRequest request)
request
- public void persistConnection(HttpConnection connection)
public boolean isLowOnResources()
public boolean isOutOfResources()
public boolean isIntegral(HttpConnection connection)
public boolean isConfidential(HttpConnection connection)
public java.lang.String getIntegralScheme()
public void setIntegralScheme(java.lang.String integralScheme)
public int getIntegralPort()
public void setIntegralPort(int integralPort)
public java.lang.String getConfidentialScheme()
public void setConfidentialScheme(java.lang.String confidentialScheme)
public int getConfidentialPort()
public void setConfidentialPort(int confidentialPort)
public java.net.ServerSocket getServerSocket()
public void setInetAddrPort(InetAddrPort address)
address
- The Address to listen on, or 0.0.0.0:port for
all interfaces.public InetAddrPort getInetAddrPort()
public void setHost(java.lang.String host) throws java.net.UnknownHostException
host
-
java.net.UnknownHostException
public java.lang.String getHost()
public void setInetAddress(java.net.InetAddress addr)
addr
- public java.net.InetAddress getInetAddress()
public void setPort(int port)
port
- public int getPort()
public int getMaxReadTimeMs()
public void setLingerTimeSecs(int ls)
ls
- seconds to linger or -1 to disable linger.public int getLingerTimeSecs()
public java.lang.String toString()
public void handle(java.lang.Object job)
job
- A Connection.public java.lang.String getName()
public void setName(java.lang.String name)
name
- Name of the ThreadPool to use when naming Threads.public boolean isStarted()
public int getThreads()
getIdleThreads()
public int getIdleThreads()
getThreads()
public int getMinThreads()
setMinThreads(int)
public void setMinThreads(int minThreads)
minThreads
- minimum number of threadsgetMinThreads()
public int getMaxThreads()
setMaxThreads(int)
public void setMaxThreads(int maxThreads)
maxThreads
- maximum number of threads.getMaxThreads()
public int getMaxIdleTimeMs()
setMaxIdleTimeMs(int)
public void setMaxIdleTimeMs(int maxIdleTimeMs)
maxIdleTimeMs
- Max idle time in ms.getMaxIdleTimeMs()
public void setMaxStopTimeMs(int ms)
public void join()
public void run(java.lang.Object job) throws java.lang.InterruptedException
job
- If the job is derived from Runnable, the run method
is called, otherwise it is passed as the argument to the handle
method.
java.lang.InterruptedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |