org.jppf.comm.recovery
Class ServerConnection

java.lang.Object
  extended by org.jppf.utils.ThreadSynchronization
      extended by org.jppf.comm.recovery.AbstractRecoveryConnection
          extended by org.jppf.comm.recovery.ServerConnection
All Implemented Interfaces:
Runnable

public class ServerConnection
extends AbstractRecoveryConnection

Instances of this class represent connections to a server from a remote peer.

They are used to send, at regular intervals, a request to the distant peer and check if the expected response is received. If the response is incorrect or not received at all, then the connection is considered broken and closed on the server side.

The main goal is to detect network connections broken due to hardware failures on the remote peer side, which cannot be detected otherwise.

Author:
Laurent Cohen

Field Summary
 
Fields inherited from class org.jppf.comm.recovery.AbstractRecoveryConnection
initialized, maxRetries, ok, socketReadTimeout, socketWrapper, uuid
 
Fields inherited from class org.jppf.utils.ThreadSynchronization
stopped
 
Constructor Summary
ServerConnection(Socket socket, int maxRetries, int socketReadTimeout)
          Initialize this connection with the specified socket.
 
Method Summary
 void close()
          Close this server connection and release the resources it is using.
 void run()
          
 String toString()
          
 
Methods inherited from class org.jppf.comm.recovery.AbstractRecoveryConnection
getUuid, isInitialized, isOk, receiveMessage, receiveMessage, sendMessage, setInitialized, setOk
 
Methods inherited from class org.jppf.utils.ThreadSynchronization
goToSleep, goToSleep, goToSleep, isStopped, setStopped, wakeUp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServerConnection

public ServerConnection(Socket socket,
                        int maxRetries,
                        int socketReadTimeout)
                 throws Exception
Initialize this connection with the specified socket.

Parameters:
socket - the socket connected to a client.
maxRetries - the maximum number of failed write/read attempts on a connection before the remote peer is considered dead.
socketReadTimeout - the maximum wait time on a response from the remote peer.
Throws:
Exception - if any error occurs while initializing the socket connection.
Method Detail

run

public void run()


close

public void close()
Close this server connection and release the resources it is using.

Specified by:
close in class AbstractRecoveryConnection

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2005-2010 JPPF Team.