FileDocCategorySizeDatePackage
JkHandler.javaAPI DocApache Tomcat 6.0.145856Fri Jul 20 04:20:36 BST 2007org.apache.jk.core

JkHandler

public class JkHandler extends Object implements MBeanRegistration, NotificationListener
author
Costin Manolache

Fields Summary
public static final int
OK
public static final int
LAST
public static final int
ERROR
protected Properties
properties
protected WorkerEnv
wEnv
protected JkHandler
next
protected String
nextName
protected String
name
protected int
id
public static final int
HANDLE_RECEIVE_PACKET
public static final int
HANDLE_SEND_PACKET
public static final int
HANDLE_FLUSH
public static final int
HANDLE_THREAD_END
protected String
domain
protected ObjectName
oname
protected MBeanServer
mserver
Constructors Summary
Methods Summary
public voidaddHandlerCallback(org.apache.jk.core.JkHandler w)
Experimental, will be replaced. This allows handlers to be notified when other handlers are added.


    
public MsgContextcreateMsgContext()

        return new MsgContext(8*1024);
    
public MsgContextcreateMsgContext(int bsize)

        return new MsgContext(bsize);
    
public voiddestroy()
Clean up and stop the handler

    
public java.lang.StringgetDomain()

        return domain;
    
public intgetId()

        return id;
    
public java.lang.StringgetName()

        return name;
    
public java.lang.StringgetNext()

        if( nextName==null ) {
            if( next!=null)
                nextName=next.getName();
        }
        return nextName;
    
public javax.management.ObjectNamegetObjectName()

        return oname;
    
public java.lang.StringgetProperty(java.lang.String name)

        return properties.getProperty(name) ;
    
public voidhandleNotification(javax.management.Notification notification, java.lang.Object handback)

//        BaseNotification bNot=(BaseNotification)notification;
//        int code=bNot.getCode();
//
//        MsgContext ctx=(MsgContext)bNot.getSource();


    
public voidinit()
Should register the request types it can handle, same style as apache2.

    
public intinvoke(Msg msg, MsgContext mc)

        return OK;
    
public voidpause()

    
public voidpostDeregister()

    
public voidpostRegister(java.lang.Boolean registrationDone)

    
public voidpreDeregister()

    
public javax.management.ObjectNamepreRegister(javax.management.MBeanServer server, javax.management.ObjectName oname)

        this.oname=oname;
        mserver=server;
        domain=oname.getDomain();
        if( name==null ) {
            name=oname.getKeyProperty("name");
        }
        
        // we need to create a workerEnv or set one.
        ObjectName wEnvName=new ObjectName(domain + ":type=JkWorkerEnv");
        if ( wEnv == null ) {
            wEnv=new WorkerEnv();
        }
        if( ! mserver.isRegistered(wEnvName )) {
            Registry.getRegistry(null, null).registerComponent(wEnv, wEnvName, null);
        }
        mserver.invoke( wEnvName, "addHandler", 
                new Object[] {name, this}, 
                new String[] {"java.lang.String", 
                              "org.apache.jk.core.JkHandler"});
        return oname;
    
public voidresume()

    
public voidsetId(int id)
Set the id of the worker. We use an id for faster dispatch. Since we expect a decent number of handler in system, the id is unique - that means we may have to allocate bigger dispatch tables. ( easy to fix if needed )

        this.id=id;
    
public voidsetName(java.lang.String s)
Set the name of the handler. Will allways be called by worker env after creating the worker.

        name=s;
    
public voidsetNext(org.apache.jk.core.JkHandler h)
Catalina-style "recursive" invocation. A chain is used for Apache/3.3 style iterative invocation.

        next=h;
    
public voidsetNext(java.lang.String s)

        nextName=s;
    
public voidsetProperty(java.lang.String name, java.lang.String value)

        properties.put( name, value );
    
public voidsetWorkerEnv(WorkerEnv we)

    
          
        this.wEnv=we;