dist1.acb.ACBpoint.transport
Class ClientSocket

java.lang.Object
  extended byjava.lang.Thread
      extended bydist1.acb.common.transport.AbstractClientSocket
          extended bydist1.acb.ACBpoint.transport.ClientSocket
All Implemented Interfaces:
java.lang.Runnable

public class ClientSocket
extends AbstractClientSocket

ClientSocket Connection to the Primary

Version:
$Revision: 1.20 $
Author:
Lazar Adzigogov/Alexander Stasiv

Nested Class Summary
 
Nested classes inherited from class dist1.acb.common.transport.AbstractClientSocket
AbstractClientSocket.SocketAndStreams
 
Field Summary
 
Fields inherited from class dist1.acb.common.transport.AbstractClientSocket
isShutdowned, log, objectStreamFactory, socket
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
 void executeRequestsFromBackup(int firstRequest)
          Tries to repeate requests from backup list
static ClientSocket getInstance()
          Gets the instance of the ClientSocket server
 java.lang.Integer getLastRequest()
          Returns Id of last request in the backup buffer, or null if the buffer is empty
protected  void handleConnectionEstablished()
           
protected  boolean handleConnectionLost()
           
protected  void handleUnrecoverableError(java.lang.Throwable e)
           
 Response request(Request request)
          Send the request and receive a response from the server in same thread.
 void resetRequestsBackup()
          DOCUMENT ME!
 
Methods inherited from class dist1.acb.common.transport.AbstractClientSocket
connect, connect, connect, getResponse, getServerAddr, getServersAddresses, handleResponseToNoRequest, isConnected, receiveResponse, request, run, scheduleRequest, setServersAddresses, start
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static ClientSocket getInstance()
Gets the instance of the ClientSocket server

Returns:
The instance value

getLastRequest

public java.lang.Integer getLastRequest()
Returns Id of last request in the backup buffer, or null if the buffer is empty

Returns:
Id of last request in the backup buffer, or null if the buffer is empty

executeRequestsFromBackup

public void executeRequestsFromBackup(int firstRequest)
                               throws java.lang.InterruptedException,
                                      java.lang.ClassNotFoundException,
                                      java.io.IOException
Tries to repeate requests from backup list

Parameters:
firstRequest - first request ID to execute
Throws:
java.lang.InterruptedException - The thread was interrupted.
java.lang.ClassNotFoundException - if received from the server class was not found
java.io.IOException - if handleConnectionLost() returns false
java.lang.RuntimeException - if somthing wrong

request

public Response request(Request request)
                 throws java.lang.InterruptedException,
                        java.lang.ClassNotFoundException,
                        java.io.IOException
Send the request and receive a response from the server in same thread. So the method is blocking. The method tries to hide some errors like link brokes or crashes of the server.

Overrides:
request in class AbstractClientSocket
Parameters:
request - Request to send
Returns:
A response from a server
Throws:
java.lang.InterruptedException - The thread was interrupted.
java.lang.ClassNotFoundException - if received from the server class was not found
java.io.IOException - if handleConnectionLost() returns false

resetRequestsBackup

public void resetRequestsBackup()
DOCUMENT ME!


handleConnectionEstablished

protected void handleConnectionEstablished()
Specified by:
handleConnectionEstablished in class AbstractClientSocket

handleConnectionLost

protected boolean handleConnectionLost()
Specified by:
handleConnectionLost in class AbstractClientSocket

handleUnrecoverableError

protected void handleUnrecoverableError(java.lang.Throwable e)
Specified by:
handleUnrecoverableError in class AbstractClientSocket


Copyright © 2004 Phoenix Team (CMU/AIT). All Rights Reserved.