Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.ajp.tomcat4
Class Ajp13Processor  view Ajp13Processor download Ajp13Processor.java

java.lang.Object
  extended byorg.apache.ajp.tomcat4.Ajp13Processor
All Implemented Interfaces:
org.apache.catalina.Lifecycle, java.lang.Runnable

final class Ajp13Processor
extends java.lang.Object
implements org.apache.catalina.Lifecycle, java.lang.Runnable

Version:
$Revision: 299218 $ $Date: 2004-02-24 03:48:44 -0500 (Tue, 24 Feb 2004) $

Nested Class Summary
private  class Ajp13Processor.Bool
          A simple class to provide synchronized access to a boolean.
 
Field Summary
private  org.apache.tomcat.util.http.BaseRequest ajpRequest
           
private  boolean available
          Is there a new socket available?
private  Ajp13Connector connector
          The Ajp13Connector with which this processor is associated.
private  int debug
          The debugging detail level for this component.
private  Ajp13Processor.Bool handlingRequest
          Are we currently handling a request?
private  int id
          The identifier of this processor, unique per connector.
private  org.apache.catalina.util.LifecycleSupport lifecycle
          The lifecycle event support for this component.
private  Ajp13Logger logger
           
private  Ajp13Request request
          The AJP13 request object we will pass to our associated container.
private  Ajp13Response response
          The AJP13 response object we will pass to our associated container.
protected  org.apache.catalina.util.StringManager sm
          The string manager for this package.
private  java.net.Socket socket
          The socket we are currently processing a request for.
private  boolean started
          Has this component been started yet?
private  Ajp13Processor.Bool stopped
          The shutdown signal to our background thread
private  java.lang.Thread thread
          The background thread.
private  java.lang.ThreadGroup threadGroup
          This processor's thread group.
private  java.lang.String threadName
          The name to register for the background thread.
private  java.lang.Object threadSync
          The thread synchronization object.
 
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
Ajp13Processor(Ajp13Connector connector, int id, java.lang.ThreadGroup threadGroup)
          Construct a new Ajp13Processor associated with the specified connector.
 
Method Summary
 void addLifecycleListener(org.apache.catalina.LifecycleListener listener)
          Add a lifecycle event listener to this component.
(package private)  void assign(java.net.Socket socket)
          Process an incoming TCP/IP connection on the specified socket.
private  java.net.Socket await()
          Await a newly assigned Socket from our Connector, or null if we are supposed to shut down.
 org.apache.catalina.LifecycleListener[] findLifecycleListeners()
          Get the lifecycle listeners associated with this lifecycle.
private  void parseConnection(java.net.Socket socket)
          Parse and record the connection parameters related to this request.
private  void process(java.net.Socket socket)
          Process an incoming AJP13 request on the Socket that has been assigned to this Processor.
 void removeLifecycleListener(org.apache.catalina.LifecycleListener listener)
          Remove a lifecycle event listener from this component.
 void run()
          The background thread that listens for incoming TCP/IP connections and hands them off to an appropriate processor.
 void start()
          Start the background thread we will use for request processing.
 void stop()
          Stop the background thread we will use for request processing.
private  void threadStart()
          Start the background processing thread.
private  void threadStop()
          Stop the background processing thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private Ajp13Logger logger

ajpRequest

private org.apache.tomcat.util.http.BaseRequest ajpRequest

available

private boolean available
Is there a new socket available?


connector

private Ajp13Connector connector
The Ajp13Connector with which this processor is associated.


debug

private int debug
The debugging detail level for this component.


id

private int id
The identifier of this processor, unique per connector.


lifecycle

private org.apache.catalina.util.LifecycleSupport lifecycle
The lifecycle event support for this component.


request

private Ajp13Request request
The AJP13 request object we will pass to our associated container.


response

private Ajp13Response response
The AJP13 response object we will pass to our associated container.


sm

protected org.apache.catalina.util.StringManager sm
The string manager for this package.


socket

private java.net.Socket socket
The socket we are currently processing a request for. This object is used for inter-thread communication only.


started

private boolean started
Has this component been started yet?


stopped

private Ajp13Processor.Bool stopped
The shutdown signal to our background thread


handlingRequest

private Ajp13Processor.Bool handlingRequest
Are we currently handling a request?


thread

private java.lang.Thread thread
The background thread.


threadName

private java.lang.String threadName
The name to register for the background thread.


threadGroup

private java.lang.ThreadGroup threadGroup
This processor's thread group.


threadSync

private java.lang.Object threadSync
The thread synchronization object.

Constructor Detail

Ajp13Processor

public Ajp13Processor(Ajp13Connector connector,
                      int id,
                      java.lang.ThreadGroup threadGroup)
Construct a new Ajp13Processor associated with the specified connector.

Method Detail

assign

void assign(java.net.Socket socket)
Process an incoming TCP/IP connection on the specified socket. Any exception that occurs during processing must be logged and swallowed. NOTE: This method is called from our Connector's thread. We must assign it to our own thread so that multiple simultaneous requests can be handled.


await

private java.net.Socket await()
Await a newly assigned Socket from our Connector, or null if we are supposed to shut down.


parseConnection

private void parseConnection(java.net.Socket socket)
                      throws java.io.IOException,
                             javax.servlet.ServletException
Parse and record the connection parameters related to this request.


process

private void process(java.net.Socket socket)
Process an incoming AJP13 request on the Socket that has been assigned to this Processor. Any exceptions that occur during processing must be swallowed and dealt with.


run

public void run()
The background thread that listens for incoming TCP/IP connections and hands them off to an appropriate processor.

Specified by:
run in interface java.lang.Runnable

threadStart

private void threadStart()
Start the background processing thread.


threadStop

private void threadStop()
Stop the background processing thread.


addLifecycleListener

public void addLifecycleListener(org.apache.catalina.LifecycleListener listener)
Add a lifecycle event listener to this component.

Specified by:
addLifecycleListener in interface org.apache.catalina.Lifecycle

findLifecycleListeners

public org.apache.catalina.LifecycleListener[] findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.

Specified by:
findLifecycleListeners in interface org.apache.catalina.Lifecycle

removeLifecycleListener

public void removeLifecycleListener(org.apache.catalina.LifecycleListener listener)
Remove a lifecycle event listener from this component.

Specified by:
removeLifecycleListener in interface org.apache.catalina.Lifecycle

start

public void start()
           throws org.apache.catalina.LifecycleException
Start the background thread we will use for request processing.

Specified by:
start in interface org.apache.catalina.Lifecycle

stop

public void stop()
          throws org.apache.catalina.LifecycleException
Stop the background thread we will use for request processing.

Specified by:
stop in interface org.apache.catalina.Lifecycle