Package com.tangosol.net
Class LoadBalancer.SocketHandler
- java.lang.Object
-
- com.tangosol.util.Base
-
- com.tangosol.util.Daemon
-
- com.tangosol.net.LoadBalancer.SocketHandler
-
- Direct Known Subclasses:
LoadBalancer.RequestHandler
,LoadBalancer.ResponseHandler
- Enclosing class:
- LoadBalancer
public abstract static class LoadBalancer.SocketHandler extends Daemon
A SocketHandler is an abstract daemon thread.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tangosol.util.Daemon
Daemon.DaemonWorker
-
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
m_abBuf
The buffer to use for reading from a stream.
-
Constructor Summary
Constructors Constructor Description SocketHandler(String sName)
Construct a SocketHandler with a given daemon thread name.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
copy(InputStream streamIn, OutputStream streamOut, byte[] abBuf)
Process the transfer of data from one stream to another.protected byte[]
ensureBuffer(Socket socket)
Return the existing buffer, if there is one, or create one to use for reading from the passed socket.protected void
process(Socket socketIn, Socket socketOut)
Process the transfer of data from one socket to another.abstract void
run()
Processing loop for the SocketHandler.-
Methods inherited from class com.tangosol.util.Daemon
changeState, configureWorker, ensureThreadGroup, finishStarting, finishStopping, getConfiguredName, getConfiguredPriority, getContext, getDescription, getGuardRegisterAction, getMaxWaitMillis, getState, getThread, getThreadContextClassLoader, getWorker, guardIfNeeded, heartbeat, heartbeat, instantiateWorker, isGuarded, isOnWorkerThread, isRunning, isStopping, recover, setConfiguredName, setConfiguredPriority, setContext, setGuardPolicy, setGuardRegisterAction, setThreadContextClassLoader, shutdown, start, stop, terminate, toStateString, toString
-
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
-
-
-
Constructor Detail
-
SocketHandler
public SocketHandler(String sName)
Construct a SocketHandler with a given daemon thread name.
-
-
Method Detail
-
run
public abstract void run()
Processing loop for the SocketHandler.
-
process
protected void process(Socket socketIn, Socket socketOut) throws IOException
Process the transfer of data from one socket to another.- Parameters:
socketIn
- the socket to read fromsocketOut
- the socket to write to- Throws:
IOException
-
copy
protected void copy(InputStream streamIn, OutputStream streamOut, byte[] abBuf) throws IOException
Process the transfer of data from one stream to another.- Parameters:
streamIn
- the stream to read fromstreamOut
- the stream to write toabBuf
- the byte array to use as a buffer to read into and write from- Throws:
IOException
-
ensureBuffer
protected byte[] ensureBuffer(Socket socket)
Return the existing buffer, if there is one, or create one to use for reading from the passed socket.- Parameters:
socket
- the socket that the buffer will be used to read from- Returns:
- a byte array to use as a read buffer
-
-