org.apache.jk.common
Class JniHandler
- MBeanRegistration, NotificationListener
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.
- Costin Manolache
ERROR , HANDLE_FLUSH , HANDLE_RECEIVE_PACKET , HANDLE_SEND_PACKET , HANDLE_THREAD_END , LAST , OK , domain , id , mserver , name , next , nextName , oname , properties , wEnv |
addHandlerCallback , createMsgContext , destroy , getDomain , getId , getName , getNext , getObjectName , getProperty , handleNotification , init , invoke , pause , postDeregister , postRegister , preDeregister , preRegister , resume , setId , setName , setNext , setNext , setProperty , setWorkerEnv |
C2B_NOTE
public static final int C2B_NOTE
- 1
JK_HANDLE_JNI_DISPATCH
public static final int JK_HANDLE_JNI_DISPATCH
- 21
JK_HANDLE_SHM_DISPATCH
public static final int JK_HANDLE_SHM_DISPATCH
- 22
MB_NOTE
public static final int MB_NOTE
- 2
MSG_NOTE
public static final int MSG_NOTE
- 0
jkHome
protected String jkHome
nativeJkHandlerP
protected long nativeJkHandlerP
JniHandler
public JniHandler()
appendString
public void appendString(Msg msg,
String s,
C2BConverter charsetDecoder)
throws IOException
createMsgContext
public MsgContext createMsgContext()
Create a msg context to be used with the shm channel
- createMsgContext in interface JkHandler
destroyJkComponent
public void destroyJkComponent()
throws IOException
getJkHome
public String getJkHome()
init
public void init()
throws IOException
You must call initNative() inside the component init()
- init in interface JkHandler
initJkComponent
public void initJkComponent()
throws IOException
initNative
protected void initNative(String nativeComponentName)
invoke
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.
- invoke in interface JkHandler
nativeDispatch
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.
pause
public void pause()
throws Exception
- pause in interface JkHandler
recycleNative
protected void recycleNative(MsgContext ep)
resume
public void resume()
throws Exception
- resume in interface JkHandler
setJkHome
public void setJkHome(String s)
setNativeAttribute
public void setNativeAttribute(String name,
String val)
throws IOException
setNativeEndpoint
protected void setNativeEndpoint(MsgContext msgCtx)
Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.