org.apache.jk.common

Class ChannelJni

public class ChannelJni extends JniHandler implements JkChannel

Pass messages using jni

Author: Costin Manolache

Constructor Summary
ChannelJni()
Method Summary
intflush(Msg msg, MsgContext ep)
StringgetChannelName()
voidinit()
intinvoke(Msg msg, MsgContext ep)
Receive a packet from the C side.
booleanisSameAddress(MsgContext ep)
intreceive(Msg msg, MsgContext ep)
Receives does nothing - send will put the response in the same buffer
voidregisterRequest(Request req, MsgContext ep, int count)
intsend(Msg msg, MsgContext ep)
Send the packet.

Constructor Detail

ChannelJni

public ChannelJni()

Method Detail

flush

public int flush(Msg msg, MsgContext ep)

getChannelName

public String getChannelName()

init

public void init()

invoke

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

isSameAddress

public boolean isSameAddress(MsgContext ep)

receive

public int receive(Msg msg, MsgContext ep)
Receives does nothing - send will put the response in the same buffer

registerRequest

public void registerRequest(Request req, MsgContext ep, int count)

send

public int send(Msg msg, MsgContext ep)
Send the packet. XXX This will modify msg !!! We could use 2 packets, or sendAndReceive().
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.