Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


com.tangosol.net
Class LoadBalancer.SocketHandler

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.Daemon
          extended by com.tangosol.net.LoadBalancer.SocketHandler

All Implemented Interfaces:
Guardable, java.lang.Runnable
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

 

Field Summary
protected  byte[] m_abBuf
          The buffer to use for reading from a stream.

 

Constructor Summary
LoadBalancer.SocketHandler(java.lang.String sName)
          Construct a SocketHandler with a given daemon thread name.

 

Method Summary
protected  void copy(java.io.InputStream streamIn, java.io.OutputStream streamOut, byte[] abBuf)
          Process the transfer of data from one stream to another.
protected  byte[] ensureBuffer(java.net.Socket socket)
          Return the existing buffer, if there is one, or create one to use for reading from the passed socket.
protected  void process(java.net.Socket socketIn, java.net.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, 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

 

Field Detail

m_abBuf

protected byte[] m_abBuf
The buffer to use for reading from a stream.

Constructor Detail

LoadBalancer.SocketHandler

public LoadBalancer.SocketHandler(java.lang.String sName)
Construct a SocketHandler with a given daemon thread name.

Method Detail

run

public abstract void run()
Processing loop for the SocketHandler.
Specified by:
run in interface java.lang.Runnable
Specified by:
run in class Daemon
See Also:
Thread.run()

process

protected void process(java.net.Socket socketIn,
                       java.net.Socket socketOut)
                throws java.io.IOException
Process the transfer of data from one socket to another.
Parameters:
socketIn - the socket to read from
socketOut - the socket to write to
Throws:
java.io.IOException

copy

protected void copy(java.io.InputStream streamIn,
                    java.io.OutputStream streamOut,
                    byte[] abBuf)
             throws java.io.IOException
Process the transfer of data from one stream to another.
Parameters:
streamIn - the stream to read from
streamOut - the stream to write to
abBuf - the byte array to use as a buffer to read into and write from
Throws:
java.io.IOException

ensureBuffer

protected byte[] ensureBuffer(java.net.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

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.