|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.util.protocol.RequestReplyExecutor org.xmlBlaster.util.protocol.socket.SocketExecutor
public abstract class SocketExecutor
Send/receive messages over outStream and inStream.
A common base class for socket based messaging. Allows to block during a request and deliver the return message to the waiting thread.
Field Summary | |
---|---|
private boolean |
isNullTerminated
Set to true if a XmlScript is send.If scripts used over socket we need to terminate each script with a null byte |
protected java.io.InputStream |
iStream
Reading from socket |
private static java.util.logging.Logger |
log
|
protected java.lang.String |
loginName
This is the client side |
private static int |
MAX_CHUNKSIZE_DEFAULT
|
protected int |
maxChunkSize
|
private java.lang.String |
ME
|
protected java.lang.String |
msgInfoParserClassName
Which message format parser to use |
protected java.io.OutputStream |
oStream
Writing to socket |
protected boolean |
running
|
protected long |
soLingerTimeout
How long to block the socket on close with remaining data |
protected long |
soTimeout
How long to block the socket on input stream read |
Fields inherited from class org.xmlBlaster.util.protocol.RequestReplyExecutor |
---|
addressConfig, addressServer, cbClient, compressZlib, compressZlibStream, contextNode, glob, mbeanHandle, minSizeForCompression, ONEWAY, pingResponseTimeout, prefix, progressListener, responseListenerMap, responseTimeout, updateResponseTimeout, useEmailExpiryTimestamp, WAIT_ON_RESPONSE |
Constructor Summary | |
---|---|
SocketExecutor()
|
Method Summary | |
---|---|
java.lang.String |
getCbMsgInfoParserClassName()
|
static java.lang.String |
getGlobalKey(SessionName sessionName)
|
java.io.InputStream |
getInputStream()
|
java.lang.String |
getMsgInfoParserClassName()
Which parser to use. |
java.io.OutputStream |
getOutputStream()
|
long |
getSoLingerTimeout()
|
long |
getSoTimeout()
|
java.lang.String |
getUsageUrl()
|
java.lang.String |
getVersion()
The version of the plugin |
protected void |
initialize(Global glob,
AddressBase addressConfig,
java.io.InputStream iStream,
java.io.OutputStream oStream)
Used by SocketCallbackImpl on client side, uses I_CallbackExtended to invoke client classes Used by HandleClient on server side, uses I_XmlBlaster to invoke xmlBlaster core This executor has mixed client and server specific code for two reasons: - Possibly we can use the same socket between two xmlBlaster server (load balance) - Everything is together |
java.lang.String |
ping(java.lang.String qos)
Ping to check if callback server (or server protocol) is alive. |
protected void |
sendMessage(MsgInfo msgInfo,
java.lang.String requestId,
MethodName methodName,
boolean udp)
Flush the data to the socket. |
java.lang.String[] |
sendUpdate(java.lang.String cbSessionId,
MsgUnitRaw[] msgArr,
boolean expectingResponse,
boolean useUdpForOneway,
PluginInfo callbackPluginInfo)
Updating multiple messages in one sweep, callback to client. |
protected void |
setLoginName(java.lang.String loginName)
Sets the loginName and automatically the requestId as well |
void |
setRunning(boolean run)
|
void |
setSoLingerTimeout(long millis)
Set the given millis to timeout socket close if data are lingering |
void |
setSoTimeout(long millis)
Set the given millis to protect against blocking socket on input stream read() operations |
void |
setUsageUrl(java.lang.String url)
|
void |
shutdown()
Shutdown the plugin, free resources. |
java.lang.String |
usage()
|
boolean |
useUdpForOneway()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.xmlBlaster.util.protocol.RequestReplyExecutorMBean |
---|
getMinSizeForCompression, getPingResponseTimeout, getResponseTimeout, getResponseTimeout, getUpdateResponseTimeout, interruptInvocation, isCompressZlib, isCompressZlibStream, isUseEmailExpiryTimestamp, setCompressZlib, setCompressZlibStream, setMinSizeForCompression, setPingResponseTimeout, setResponseTimeout, setUpdateResponseTimeout, setUseEmailExpiryTimestamp |
Methods inherited from interface org.xmlBlaster.util.admin.I_AdminPlugin |
---|
getType, isShutdown |
Field Detail |
---|
private java.lang.String ME
private static java.util.logging.Logger log
protected java.io.InputStream iStream
protected java.io.OutputStream oStream
protected long soTimeout
protected long soLingerTimeout
protected java.lang.String loginName
protected java.lang.String msgInfoParserClassName
private boolean isNullTerminated
private static final int MAX_CHUNKSIZE_DEFAULT
protected int maxChunkSize
protected boolean running
Constructor Detail |
---|
public SocketExecutor()
Method Detail |
---|
protected void initialize(Global glob, AddressBase addressConfig, java.io.InputStream iStream, java.io.OutputStream oStream) throws java.io.IOException
iStream
- The reading stream (for example a socket InputStream)oStream
- The writing stream (for example a socket OutputStream)
java.io.IOException
protected void setLoginName(java.lang.String loginName)
setLoginName
in class RequestReplyExecutor
public java.lang.String getMsgInfoParserClassName()
public java.lang.String getCbMsgInfoParserClassName()
public final void setSoTimeout(long millis)
millis
- If <= 0 it is disabledpublic final long getSoTimeout()
public final void setSoLingerTimeout(long millis)
millis
- If < 0 it is set to one minute, 0 disable timeoutpublic final long getSoLingerTimeout()
public final java.io.OutputStream getOutputStream()
public final java.io.InputStream getInputStream()
public void setRunning(boolean run)
public final java.lang.String[] sendUpdate(java.lang.String cbSessionId, MsgUnitRaw[] msgArr, boolean expectingResponse, boolean useUdpForOneway, PluginInfo callbackPluginInfo) throws XmlBlasterException
expectingResponse
- is WAIT_ON_RESPONSE or ONEWAY
XmlBlasterException
RequestBroker
public boolean useUdpForOneway()
public java.lang.String ping(java.lang.String qos) throws XmlBlasterException
qos
- Currently an empty string ""
XmlBlasterException
- If client not reachableprotected void sendMessage(MsgInfo msgInfo, java.lang.String requestId, MethodName methodName, boolean udp) throws XmlBlasterException, java.io.IOException
sendMessage
in class RequestReplyExecutor
XmlBlasterException
java.io.IOException
public void shutdown()
I_AdminPlugin
shutdown
in interface I_AdminPlugin
shutdown
in class RequestReplyExecutor
public java.lang.String getVersion()
I_AdminPlugin
getVersion
in interface I_AdminPlugin
public java.lang.String usage()
usage
in interface I_AdminUsage
usage
in class RequestReplyExecutor
public java.lang.String getUsageUrl()
getUsageUrl
in interface I_AdminUsage
public void setUsageUrl(java.lang.String url)
setUsageUrl
in interface I_AdminUsage
public static java.lang.String getGlobalKey(SessionName sessionName)
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |