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

All Implemented Interfaces:
    JkChannel, NotificationListener, MBeanRegistration

Pass messages using jni
Field Summary
 int receivedNote     
Fields inherited from org.apache.jk.common.JniHandler:
apr,  nativeJkHandlerP,  jkHome,  JK_HANDLE_JNI_DISPATCH,  JK_HANDLE_SHM_DISPATCH,  MSG_NOTE,  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 ChannelJni() 
Method from org.apache.jk.common.ChannelJni Summary:
flush,   getChannelName,   init,   invoke,   isSameAddress,   receive,   registerRequest,   send
Methods from org.apache.jk.common.JniHandler:
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.ChannelJni Detail:
 public int flush(Msg msg,
    MsgContext ep) throws IOException 
 public String getChannelName() 
 public  void init() throws IOException 
 public int invoke(Msg msg,
    MsgContext ep) throws IOException 
    Receive a packet from the C side. This is called from the C code using invocation, but only for the first packet - to avoid recursivity and thread problems. This may look strange, but seems the best solution for the problem ( the problem is that we don't have 'continuation' ). sendPacket will move the thread execution on the C side, and return when another packet is available. For packets that are one way it'll return after it is processed too ( having 2 threads is far more expensive ). Again, the goal is to be efficient and behave like all other Channels ( so the rest of the code can be shared ). Playing with java objects on C is extremely difficult to optimize and do right ( IMHO ), so we'll try to keep it simple - byte[] passing, the conversion done in java ( after we know the encoding and if anyone asks for it - same lazy behavior as in 3.3 ).
 public boolean isSameAddress(MsgContext ep) 
 public int receive(Msg msg,
    MsgContext ep) throws IOException 
    Receives does nothing - send will put the response in the same buffer
 public  void registerRequest(Request req,
    MsgContext ep,
    int count) 
 public int send(Msg msg,
    MsgContext ep) throws IOException 
    Send the packet. XXX This will modify msg !!! We could use 2 packets, or sendAndReceive().