ChannelJni (Tomcat API Documentation)
Keywords: org.apache.jk.common.ChannelJni class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.jk.common
Class ChannelJni

    java.lang.Object
      org.apache.jk.core.JkHandler
          org.apache.jk.common.JniHandler
              org.apache.jk.common.ChannelJni

All Implemented Interfaces:
  java.util.EventListener, javax.management.MBeanRegistration, javax.management.NotificationListener

public class ChannelJni
extends JniHandler

Pass messages using jni

Author:
  Costin Manolache

Field Summary

Fields inherited from class org.apache.jk.common.JniHandler
`apr, C2B_NOTE, JK_HANDLE_JNI_DISPATCH, JK_HANDLE_SHM_DISPATCH, jkHome, MB_NOTE, MSG_NOTE, nativeJkHandlerP`

Fields inherited from class org.apache.jk.core.JkHandler
`domain, ERROR, HANDLE_FLUSH, HANDLE_RECEIVE_PACKET, HANDLE_SEND_PACKET, id, LAST, mserver, name, next, nextName, OK, oname, properties, wEnv`

Constructor Summary
`ChannelJni()`

Method Summary
`void` | `init()` You must call initNative() inside the component init()
`int` | `invoke(Msg msg, MsgContext ep)` Receive a packet from the C side.
`int` | `receive(Msg msg, MsgContext ep)` Receives does nothing - send will put the response in the same buffer
`int` | `send(Msg msg, MsgContext ep)` Send the packet.

Methods inherited from class org.apache.jk.common.JniHandler
`appendString, createMsgContext, destroyJkComponent, getJkHome, initJkComponent, initNative, nativeDispatch, recycleNative, setJkHome, setNativeAttribute, setNativeEndpoint`

Methods inherited from class org.apache.jk.core.JkHandler
`addHandlerCallback, destroy, getDomain, getId, getName, getNext, getObjectName, getProperty, handleNotification, postDeregister, postRegister, preDeregister, preRegister, setId, setName, setNext, setNext, setProperty, setWorkerEnv`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ChannelJni

    public ChannelJni()

Method Detail

### init

    public void init()
              throws java.io.IOException

  Description copied from class: `JniHandler`
  You must call initNative() inside the component init()

  Overrides:
    `init` in class `JniHandler`
  Throws:
    `java.io.IOException`

### receive

    public int receive(Msg msg,
                       MsgContext ep)
                throws java.io.IOException

  Receives does nothing - send will put the response in the same buffer

  Throws:
    `java.io.IOException`

### send

    public int send(Msg msg,
                    MsgContext ep)
             throws java.io.IOException

  Send the packet. XXX This will modify msg !!! We could use 2 packets, or sendAndReceive().

  Throws:
    `java.io.IOException`

### invoke

    public int invoke(Msg msg,
                      MsgContext ep)
               throws java.io.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 ).

  Overrides:
    `invoke` in class `JniHandler`
  Throws:
    `java.io.IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.