org.apache.jk.common

Class JniHandler

public class JniHandler extends JkHandler

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.

Author: Costin Manolache

Field Summary
protected AprImplapr
protected StringjkHome
static intJK_HANDLE_JNI_DISPATCH
static intJK_HANDLE_SHM_DISPATCH
static intMB_NOTE
static intMSG_NOTE
protected longnativeJkHandlerP
Constructor Summary
JniHandler()
Method Summary
voidappendString(Msg msg, String s, C2BConverter charsetDecoder)
MsgContextcreateMsgContext()
Create a msg context to be used with the shm channel
voiddestroyJkComponent()
StringgetJkHome()
voidinit()
You must call initNative() inside the component init()
voidinitJkComponent()
protected voidinitNative(String nativeComponentName)
intinvoke(Msg msg, MsgContext ep)
Base implementation for invoke.
protected intnativeDispatch(Msg msg, MsgContext ep, int code, int raw)
send and get the response in the same buffer.
voidpause()
protected voidrecycleNative(MsgContext ep)
voidresume()
voidsetJkHome(String s)
voidsetNativeAttribute(String name, String val)
protected voidsetNativeEndpoint(MsgContext msgCtx)

Field Detail

apr

protected AprImpl apr

jkHome

protected String jkHome

JK_HANDLE_JNI_DISPATCH

public static final int JK_HANDLE_JNI_DISPATCH

JK_HANDLE_SHM_DISPATCH

public static final int JK_HANDLE_SHM_DISPATCH

MB_NOTE

public static final int MB_NOTE

MSG_NOTE

public static final int MSG_NOTE

nativeJkHandlerP

protected long nativeJkHandlerP

Constructor Detail

JniHandler

public JniHandler()

Method Detail

appendString

public void appendString(Msg msg, String s, C2BConverter charsetDecoder)

createMsgContext

public MsgContext createMsgContext()
Create a msg context to be used with the shm channel

destroyJkComponent

public void destroyJkComponent()

getJkHome

public String getJkHome()

init

public void init()
You must call initNative() inside the component init()

initJkComponent

public void initJkComponent()

initNative

protected void initNative(String nativeComponentName)

invoke

public int invoke(Msg msg, MsgContext ep)
Base implementation for invoke. Dispatch the action to the native code, where invoke() is called on the wrapped jk_bean.

nativeDispatch

protected int nativeDispatch(Msg msg, MsgContext ep, int code, int raw)
send and get the response in the same buffer. This calls the method on the wrapped jk_bean object.

pause

public void pause()

recycleNative

protected void recycleNative(MsgContext ep)

resume

public void resume()

setJkHome

public void setJkHome(String s)

setNativeAttribute

public void setNativeAttribute(String name, String val)

setNativeEndpoint

protected void setNativeEndpoint(MsgContext msgCtx)
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.