jfreerails.network
Class AbstractInetConnection

java.lang.Object
  extended by jfreerails.network.AbstractInetConnection
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
InetConnection2Client, InetConnection2Server

abstract class AbstractInetConnection
extends java.lang.Object
implements java.lang.Runnable

This class has the code that is shared by the client and server versions of InetConnection.

Author:
Luke

Field Summary
private  SychronizedQueue inbound
           
private  InetConnection inetConnection
           
private static java.util.logging.Logger logger
           
private  SynchronizedFlag readerThreadStatus
           
private  SynchronizedFlag status
           
private  int timeout
           
 
Constructor Summary
AbstractInetConnection(java.net.Socket s)
           
AbstractInetConnection(java.lang.String ip, int port)
           
 
Method Summary
 void disconnect()
           
 void flush()
           
(package private) abstract  java.lang.String getThreadName()
           
 boolean isOpen()
           
private  void open()
           
(package private)  FreerailsSerializable[] read()
           
 void run()
           
(package private)  void send(FreerailsSerializable object)
           
(package private)  void setTimeOut(int i)
           
private  void shutDownInput()
           
private  void shutdownOutput()
           
(package private)  FreerailsSerializable waitForObject()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final java.util.logging.Logger logger

inbound

private final SychronizedQueue inbound

inetConnection

private final InetConnection inetConnection

readerThreadStatus

private final SynchronizedFlag readerThreadStatus

status

private final SynchronizedFlag status

timeout

private int timeout
Constructor Detail

AbstractInetConnection

public AbstractInetConnection(java.net.Socket s)
                       throws java.io.IOException
Throws:
java.io.IOException

AbstractInetConnection

public AbstractInetConnection(java.lang.String ip,
                              int port)
                       throws java.io.IOException
Throws:
java.io.IOException
Method Detail

disconnect

public void disconnect()
                throws java.io.IOException
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Throws:
java.io.IOException

isOpen

public boolean isOpen()

run

public void run()
Specified by:
run in interface java.lang.Runnable

open

private void open()
           throws java.io.IOException
Throws:
java.io.IOException

shutDownInput

private void shutDownInput()

shutdownOutput

private void shutdownOutput()
                     throws java.io.IOException
Throws:
java.io.IOException

getThreadName

abstract java.lang.String getThreadName()

read

FreerailsSerializable[] read()
                       throws java.io.IOException
Throws:
java.io.IOException

send

void send(FreerailsSerializable object)
    throws java.io.IOException
Throws:
java.io.IOException

setTimeOut

void setTimeOut(int i)

waitForObject

FreerailsSerializable waitForObject()
                              throws java.lang.InterruptedException,
                                     java.io.IOException
Throws:
java.lang.InterruptedException
java.io.IOException