|
|||||||||
| Home >> All >> org >> apache >> jk >> [ common overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.jk.common
Class ChannelSocket

java.lang.Objectorg.apache.jk.core.JkHandler
org.apache.jk.common.ChannelSocket
- All Implemented Interfaces:
- java.util.EventListener, org.apache.jk.core.JkChannel, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationListener
- public class ChannelSocket
- extends org.apache.jk.core.JkHandler
- implements javax.management.NotificationBroadcaster, org.apache.jk.core.JkChannel
- extends org.apache.jk.core.JkHandler
Accept ( and send ) TCP messages.
| Nested Class Summary | |
(package private) static class |
ChannelSocket.SocketAcceptor
|
(package private) static class |
ChannelSocket.SocketConnection
|
| Field Summary | |
private int |
bufferSize
|
(package private) org.apache.coyote.RequestGroupInfo |
global
|
private java.net.InetAddress |
inet
|
(package private) int |
isNote
|
(package private) int |
JMXRequestNote
|
private int |
linger
|
private static org.apache.commons.logging.Log |
log
|
private int |
maxPort
|
(package private) javax.management.MBeanNotificationInfo[] |
notifInfo
|
(package private) int |
notifNote
|
private javax.management.NotificationBroadcasterSupport |
nSupport
|
(package private) int |
osNote
|
(package private) boolean |
paused
|
private int |
port
|
private long |
requestCount
|
(package private) javax.management.ObjectName |
rgOName
|
protected boolean |
running
|
private int |
serverTimeout
|
(package private) int |
socketNote
|
private int |
socketTimeout
|
(package private) java.net.ServerSocket |
sSocket
|
private int |
startPort
|
private boolean |
tcpNoDelay
|
(package private) org.apache.tomcat.util.threads.ThreadPool |
tp
|
(package private) javax.management.ObjectName |
tpOName
|
| Fields inherited from class org.apache.jk.core.JkHandler |
domain, ERROR, HANDLE_FLUSH, HANDLE_RECEIVE_PACKET, HANDLE_SEND_PACKET, HANDLE_THREAD_END, id, LAST, mserver, name, next, nextName, OK, oname, properties, wEnv |
| Constructor Summary | |
ChannelSocket()
jmx:managed-constructor description="default constructor" |
|
| Method Summary | |
void |
accept(org.apache.jk.core.MsgContext ep)
|
(package private) void |
acceptConnections()
Accept incoming connections, dispatch to the thread pool |
void |
addNotificationListener(javax.management.NotificationListener listener,
javax.management.NotificationFilter filter,
java.lang.Object handback)
|
void |
close(org.apache.jk.core.MsgContext ep)
|
void |
destroy()
Clean up and stop the handler |
int |
flush(org.apache.jk.core.Msg msg,
org.apache.jk.core.MsgContext ep)
Flush the data to the client. |
java.lang.String |
getAddress()
|
int |
getBufferSize()
|
java.lang.String |
getChannelName()
Return the identifying name of this Channel. |
boolean |
getDaemon()
|
int |
getInstanceId()
At startup we'll look for the first free port in the range. |
int |
getMaxPort()
|
int |
getMaxSpareThreads()
|
int |
getMaxThreads()
|
int |
getMinSpareThreads()
|
javax.management.MBeanNotificationInfo[] |
getNotificationInfo()
|
int |
getPort()
|
long |
getRequestCount()
|
int |
getServerTimeout()
|
int |
getSoLinger()
|
int |
getSoTimeout()
|
boolean |
getTcpNoDelay()
|
org.apache.tomcat.util.threads.ThreadPool |
getThreadPool()
|
void |
init()
jmx:managed-operation |
int |
invoke(org.apache.jk.core.Msg msg,
org.apache.jk.core.MsgContext ep)
Invoke the request chain. |
static boolean |
isSameAddress(java.net.InetAddress server,
java.net.InetAddress client)
Return true if the specified client and server addresses
are the same. |
boolean |
isSameAddress(org.apache.jk.core.MsgContext ep)
Confirm that a shutdown request was recieved form us. |
void |
open(org.apache.jk.core.MsgContext ep)
|
void |
pause()
|
(package private) void |
processConnection(org.apache.jk.core.MsgContext ep)
Process a single ajp connection. |
int |
read(org.apache.jk.core.MsgContext ep,
byte[] b,
int offset,
int len)
Read N bytes from the InputStream, and ensure we got them all Under heavy load we could experience many fragmented packets just read Unix Network Programming to recall that a call to read didn't ensure you got all the data you want from read() Linux manual On success, the number of bytes read is returned (zero indicates end of file),and the file position is advanced by this number. |
int |
receive(org.apache.jk.core.Msg msg,
org.apache.jk.core.MsgContext ep)
Recieve a message from the client. |
void |
registerRequest(org.apache.coyote.Request req,
org.apache.jk.core.MsgContext ep,
int count)
Register a new Request in the Request pool. |
void |
reinit()
Called after you change some fields at runtime using jmx. |
void |
removeNotificationListener(javax.management.NotificationListener listener)
|
void |
resetCounters()
|
void |
resume()
|
int |
send(org.apache.jk.core.Msg msg,
org.apache.jk.core.MsgContext ep)
Send a message back to the client. |
void |
sendNewMessageNotification(javax.management.Notification notification)
|
void |
setAddress(java.net.InetAddress inet)
|
void |
setAddress(java.lang.String inet)
jmx:managed-attribute description="Bind on a specified address" access="READ_WRITE" |
void |
setBacklog(int i)
|
void |
setBufferSize(int bs)
|
void |
setDaemon(boolean b)
If set to false, the thread pool will be created in non-daemon mode, and will prevent main from exiting |
void |
setMaxPort(int i)
|
void |
setMaxSpareThreads(int i)
|
void |
setMaxThreads(int i)
|
void |
setMinSpareThreads(int i)
|
void |
setNotificationInfo(javax.management.MBeanNotificationInfo[] info)
|
void |
setPort(int port)
Set the port for the ajp13 channel. |
void |
setServerTimeout(int timeout)
Sets the timeout in ms of the server sockets created by this server. |
private void |
setSocketOptions(java.net.Socket s)
|
void |
setSoLinger(int i)
|
void |
setSoTimeout(int i)
|
void |
setTcpNoDelay(boolean b)
|
void |
start()
|
void |
stop()
|
private void |
unLockSocket()
|
| Methods inherited from class org.apache.jk.core.JkHandler |
addHandlerCallback, createMsgContext, 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 |
| Methods inherited from interface org.apache.jk.core.JkChannel |
createMsgContext |
| Field Detail |
log
private static org.apache.commons.logging.Log log
startPort
private int startPort
maxPort
private int maxPort
port
private int port
inet
private java.net.InetAddress inet
serverTimeout
private int serverTimeout
tcpNoDelay
private boolean tcpNoDelay
linger
private int linger
socketTimeout
private int socketTimeout
bufferSize
private int bufferSize
requestCount
private long requestCount
tp
org.apache.tomcat.util.threads.ThreadPool tp
sSocket
java.net.ServerSocket sSocket
socketNote
final int socketNote
- See Also:
- Constant Field Values
isNote
final int isNote
- See Also:
- Constant Field Values
osNote
final int osNote
- See Also:
- Constant Field Values
notifNote
final int notifNote
- See Also:
- Constant Field Values
paused
boolean paused
tpOName
javax.management.ObjectName tpOName
rgOName
javax.management.ObjectName rgOName
global
org.apache.coyote.RequestGroupInfo global
JMXRequestNote
int JMXRequestNote
running
protected boolean running
nSupport
private javax.management.NotificationBroadcasterSupport nSupport
notifInfo
javax.management.MBeanNotificationInfo[] notifInfo
| Constructor Detail |
ChannelSocket
public ChannelSocket()
- jmx:managed-constructor description="default constructor"
| Method Detail |
getThreadPool
public org.apache.tomcat.util.threads.ThreadPool getThreadPool()
getRequestCount
public long getRequestCount()
setPort
public void setPort(int port)
- Set the port for the ajp13 channel.
To support seemless load balancing and jni, we treat this
as the 'base' port - we'll try up until we find one that is not
used. We'll also provide the 'difference' to the main coyote
handler - that will be our 'sessionID' and the position in
the scoreboard and the suffix for the unix domain socket.
jmx:managed-attribute description="Port to listen" access="READ_WRITE"
getPort
public int getPort()
setAddress
public void setAddress(java.net.InetAddress inet)
setAddress
public void setAddress(java.lang.String inet)
- jmx:managed-attribute description="Bind on a specified address" access="READ_WRITE"
getAddress
public java.lang.String getAddress()
setServerTimeout
public void setServerTimeout(int timeout)
- Sets the timeout in ms of the server sockets created by this
server. This method allows the developer to make servers
more or less responsive to having their server sockets
shut down.
By default this value is 1000ms.
getServerTimeout
public int getServerTimeout()
setTcpNoDelay
public void setTcpNoDelay(boolean b)
getTcpNoDelay
public boolean getTcpNoDelay()
setSoLinger
public void setSoLinger(int i)
getSoLinger
public int getSoLinger()
setSoTimeout
public void setSoTimeout(int i)
getSoTimeout
public int getSoTimeout()
setMaxPort
public void setMaxPort(int i)
getMaxPort
public int getMaxPort()
setBufferSize
public void setBufferSize(int bs)
getBufferSize
public int getBufferSize()
getInstanceId
public int getInstanceId()
- At startup we'll look for the first free port in the range.
The difference between this port and the beggining of the range
is the 'id'.
This is usefull for lb cases ( less config ).
setDaemon
public void setDaemon(boolean b)
- If set to false, the thread pool will be created in
non-daemon mode, and will prevent main from exiting
getDaemon
public boolean getDaemon()
setMaxThreads
public void setMaxThreads(int i)
setMinSpareThreads
public void setMinSpareThreads(int i)
setMaxSpareThreads
public void setMaxSpareThreads(int i)
getMaxThreads
public int getMaxThreads()
getMinSpareThreads
public int getMinSpareThreads()
getMaxSpareThreads
public int getMaxSpareThreads()
setBacklog
public void setBacklog(int i)
pause
public void pause()
throws java.lang.Exception
resume
public void resume()
throws java.lang.Exception
accept
public void accept(org.apache.jk.core.MsgContext ep) throws java.io.IOException
setSocketOptions
private void setSocketOptions(java.net.Socket s) throws java.net.SocketException
resetCounters
public void resetCounters()
reinit
public void reinit()
throws java.io.IOException
- Called after you change some fields at runtime using jmx.
Experimental for now.
init
public void init()
throws java.io.IOException
- jmx:managed-operation
start
public void start()
throws java.io.IOException
stop
public void stop()
throws java.io.IOException
registerRequest
public void registerRequest(org.apache.coyote.Request req, org.apache.jk.core.MsgContext ep, int count)
- Description copied from interface:
org.apache.jk.core.JkChannel - Register a new Request in the Request pool.
- Specified by:
registerRequestin interfaceorg.apache.jk.core.JkChannel
open
public void open(org.apache.jk.core.MsgContext ep) throws java.io.IOException
close
public void close(org.apache.jk.core.MsgContext ep) throws java.io.IOException
unLockSocket
private void unLockSocket()
throws java.io.IOException
destroy
public void destroy()
throws java.io.IOException
- Description copied from class:
org.apache.jk.core.JkHandler - Clean up and stop the handler
send
public int send(org.apache.jk.core.Msg msg, org.apache.jk.core.MsgContext ep) throws java.io.IOException
- Description copied from interface:
org.apache.jk.core.JkChannel - Send a message back to the client.
- Specified by:
sendin interfaceorg.apache.jk.core.JkChannel
flush
public int flush(org.apache.jk.core.Msg msg, org.apache.jk.core.MsgContext ep) throws java.io.IOException
- Description copied from interface:
org.apache.jk.core.JkChannel - Flush the data to the client.
- Specified by:
flushin interfaceorg.apache.jk.core.JkChannel
receive
public int receive(org.apache.jk.core.Msg msg, org.apache.jk.core.MsgContext ep) throws java.io.IOException
- Description copied from interface:
org.apache.jk.core.JkChannel - Recieve a message from the client.
- Specified by:
receivein interfaceorg.apache.jk.core.JkChannel
read
public int read(org.apache.jk.core.MsgContext ep, byte[] b, int offset, int len) throws java.io.IOException
- Read N bytes from the InputStream, and ensure we got them all
Under heavy load we could experience many fragmented packets
just read Unix Network Programming to recall that a call to
read didn't ensure you got all the data you want
from read() Linux manual
On success, the number of bytes read is returned (zero indicates end
of file),and the file position is advanced by this number.
It is not an error if this number is smaller than the number of bytes
requested; this may happen for example because fewer bytes
are actually available right now (maybe because we were close to
end-of-file, or because we are reading from a pipe, or from a
terminal), or because read() was interrupted by a signal.
On error, -1 is returned, and errno is set appropriately. In this
case it is left unspecified whether the file position (if any) changes.
acceptConnections
void acceptConnections()
- Accept incoming connections, dispatch to the thread pool
processConnection
void processConnection(org.apache.jk.core.MsgContext ep)
- Process a single ajp connection.
invoke
public int invoke(org.apache.jk.core.Msg msg, org.apache.jk.core.MsgContext ep) throws java.io.IOException
- Description copied from interface:
org.apache.jk.core.JkChannel - Invoke the request chain.
- Specified by:
invokein interfaceorg.apache.jk.core.JkChannel
isSameAddress
public boolean isSameAddress(org.apache.jk.core.MsgContext ep)
- Description copied from interface:
org.apache.jk.core.JkChannel - Confirm that a shutdown request was recieved form us.
- Specified by:
isSameAddressin interfaceorg.apache.jk.core.JkChannel
getChannelName
public java.lang.String getChannelName()
- Description copied from interface:
org.apache.jk.core.JkChannel - Return the identifying name of this Channel.
- Specified by:
getChannelNamein interfaceorg.apache.jk.core.JkChannel
isSameAddress
public static boolean isSameAddress(java.net.InetAddress server, java.net.InetAddress client)
- Return
trueif the specified client and server addresses are the same. This method works around a bug in the IBM 1.1.8 JVM on Linux, where the address bytes are returned reversed in some circumstances.
sendNewMessageNotification
public void sendNewMessageNotification(javax.management.Notification notification)
addNotificationListener
public void addNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback) throws java.lang.IllegalArgumentException
- Specified by:
addNotificationListenerin interfacejavax.management.NotificationBroadcaster
removeNotificationListener
public void removeNotificationListener(javax.management.NotificationListener listener) throws javax.management.ListenerNotFoundException
- Specified by:
removeNotificationListenerin interfacejavax.management.NotificationBroadcaster
setNotificationInfo
public void setNotificationInfo(javax.management.MBeanNotificationInfo[] info)
getNotificationInfo
public javax.management.MBeanNotificationInfo[] getNotificationInfo()
- Specified by:
getNotificationInfoin interfacejavax.management.NotificationBroadcaster
|
|||||||||
| Home >> All >> org >> apache >> jk >> [ common overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC