Save This Page
Home » apache-tomcat-6.0.16-src » org.apache.jk » common » [javadoc | source]
org.apache.jk.common
public class: JniHandler [javadoc | source]
java.lang.Object
   org.apache.jk.core.JkHandler
      org.apache.jk.common.JniHandler

All Implemented Interfaces:
    NotificationListener, MBeanRegistration

Direct Known Subclasses:
    ChannelUn, Shm14, ChannelJni, Shm

Base class for components using native code ( libjkjni.so ). It allows to access the jk_env and wrap ( 'box' ? ) a native jk component, and call it's methods. Note that get/setAttribute are expensive ( Strings, etc ), invoke() is were all optimizations are done. We do recycle all memory on both C and java sides ( the only exception is when we attempt pinning but the VM doesn't support it ). The low level optimizations from ByteBuffer, etc are used to reduce the overhead of passing strings.
Field Summary
protected  AprImpl apr     
protected  long nativeJkHandlerP     
protected  String jkHome     
public static final  int JK_HANDLE_JNI_DISPATCH     
public static final  int JK_HANDLE_SHM_DISPATCH     
public static final  int MSG_NOTE     
public static final  int MB_NOTE     
Fields inherited from org.apache.jk.core.JkHandler:
OK,  LAST,  ERROR,  properties,  wEnv,  next,  nextName,  name,  id,  HANDLE_RECEIVE_PACKET,  HANDLE_SEND_PACKET,  HANDLE_FLUSH,  HANDLE_THREAD_END,  domain,  oname,  mserver
Constructor:
 public JniHandler() 
Method from org.apache.jk.common.JniHandler Summary:
appendString,   createMsgContext,   destroyJkComponent,   getJkHome,   init,   initJkComponent,   initNative,   invoke,   nativeDispatch,   pause,   recycleNative,   resume,   setJkHome,   setNativeAttribute,   setNativeEndpoint
Methods from org.apache.jk.core.JkHandler:
addHandlerCallback,   createMsgContext,   createMsgContext,   destroy,   getDomain,   getId,   getName,   getNext,   getObjectName,   getProperty,   handleNotification,   init,   invoke,   pause,   postDeregister,   postRegister,   preDeregister,   preRegister,   resume,   setId,   setName,   setNext,   setNext,   setProperty,   setWorkerEnv
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.jk.common.JniHandler Detail:
 public  void appendString(Msg msg,
    String s,
    C2BConverter charsetDecoder) throws IOException 
 public MsgContext createMsgContext() 
    Create a msg context to be used with the shm channel
 public  void destroyJkComponent() throws IOException 
 public String getJkHome() 
 public  void init() throws IOException 
    You must call initNative() inside the component init()
 public  void initJkComponent() throws IOException 
 protected  void initNative(String nativeComponentName) 
 public int invoke(Msg msg,
    MsgContext ep) throws IOException 
    Base implementation for invoke. Dispatch the action to the native code, where invoke() is called on the wrapped jk_bean.
 protected int nativeDispatch(Msg msg,
    MsgContext ep,
    int code,
    int raw) throws IOException 
    send and get the response in the same buffer. This calls the method on the wrapped jk_bean object.
 public  void pause() throws Exception 
 protected  void recycleNative(MsgContext ep) 
 public  void resume() throws Exception 
 public  void setJkHome(String s) 
 public  void setNativeAttribute(String name,
    String val) throws IOException 
 protected  void setNativeEndpoint(MsgContext msgCtx)