ants.p2p
Class NeighbourAnt

java.lang.Object
  extended by java.lang.Thread
      extended by ants.p2p.NeighbourAnt
All Implemented Interfaces:
Neighbour, java.lang.Runnable

public class NeighbourAnt
extends java.lang.Thread
implements Neighbour


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static int bandwidthLimit
           
static int maxQueryRatePerMinute
           
static int queryBandwidthLimit
           
static double totalCompressedSizeIn
           
static double totalCompressedSizeOut
           
static double totalControlCompressedSizeIn
           
static double totalControlCompressedSizeOut
           
static double totalDataCompressedSizeIn
           
static double totalDataCompressedSizeOut
           
static double totalDownloaded
           
static double totalQueryCompressedSizeIn
           
static double totalQueryCompressedSizeOut
           
static double totalUncompressionSizeIn
           
static double totalUncompressionSizeOut
           
static double totalUploaded
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
NeighbourAnt(Ant local, java.lang.String ip, int port, int remoteServerPort, javax.crypto.Cipher enc, javax.crypto.Cipher dec, java.net.Socket s, boolean isRequirer, long timeElapsed)
           
 
Method Summary
 void decQueuedMessages()
           
 boolean equals(java.lang.Object o)
           
 Ant getAnt()
           
 java.lang.String getIdent()
           
 long getLastActiveDownloadTime()
           
 long getLastActiveUploadTime()
           
 long getLastProbedAt()
           
 long getQueuedMessages()
           
 java.lang.String getRemoteId()
           
 long getTimeElapsed()
           
static int getTotalCompressionGainIn()
           
static int getTotalCompressionGainOut()
           
 void incQueuedMessages()
           
 boolean isConnected()
           
 boolean isRequirer()
           
 SenderThread route(Message m)
           
 void run()
           
 void send(Message m)
           
 void setFailure()
           
 void setLastActiveDownloadTime()
           
 void setLastActiveUploadTime()
           
 void terminate()
           
 java.lang.String toString()
           
static void updateInStats(Message m, long size)
           
static void updateOutStats(Message m, long size)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bandwidthLimit

public static int bandwidthLimit

queryBandwidthLimit

public static int queryBandwidthLimit

maxQueryRatePerMinute

public static final int maxQueryRatePerMinute
See Also:
Constant Field Values

totalCompressedSizeOut

public static double totalCompressedSizeOut

totalUncompressionSizeOut

public static double totalUncompressionSizeOut

totalCompressedSizeIn

public static double totalCompressedSizeIn

totalUncompressionSizeIn

public static double totalUncompressionSizeIn

totalQueryCompressedSizeOut

public static double totalQueryCompressedSizeOut

totalQueryCompressedSizeIn

public static double totalQueryCompressedSizeIn

totalDataCompressedSizeOut

public static double totalDataCompressedSizeOut

totalDataCompressedSizeIn

public static double totalDataCompressedSizeIn

totalControlCompressedSizeOut

public static double totalControlCompressedSizeOut

totalControlCompressedSizeIn

public static double totalControlCompressedSizeIn

totalDownloaded

public static double totalDownloaded

totalUploaded

public static double totalUploaded
Constructor Detail

NeighbourAnt

public NeighbourAnt(Ant local,
                    java.lang.String ip,
                    int port,
                    int remoteServerPort,
                    javax.crypto.Cipher enc,
                    javax.crypto.Cipher dec,
                    java.net.Socket s,
                    boolean isRequirer,
                    long timeElapsed)
             throws java.io.IOException
Throws:
java.io.IOException
Method Detail

incQueuedMessages

public void incQueuedMessages()
Specified by:
incQueuedMessages in interface Neighbour

decQueuedMessages

public void decQueuedMessages()
Specified by:
decQueuedMessages in interface Neighbour

getQueuedMessages

public long getQueuedMessages()
Specified by:
getQueuedMessages in interface Neighbour

getTimeElapsed

public long getTimeElapsed()

getLastProbedAt

public long getLastProbedAt()

getLastActiveDownloadTime

public long getLastActiveDownloadTime()

getLastActiveUploadTime

public long getLastActiveUploadTime()

setLastActiveDownloadTime

public void setLastActiveDownloadTime()

setLastActiveUploadTime

public void setLastActiveUploadTime()

isConnected

public boolean isConnected()

isRequirer

public boolean isRequirer()

terminate

public void terminate()

getIdent

public java.lang.String getIdent()
Specified by:
getIdent in interface Neighbour

getAnt

public Ant getAnt()
Specified by:
getAnt in interface Neighbour

getRemoteId

public java.lang.String getRemoteId()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

route

public SenderThread route(Message m)
Specified by:
route in interface Neighbour

send

public void send(Message m)
          throws java.lang.Exception
Specified by:
send in interface Neighbour
Throws:
java.lang.Exception

updateOutStats

public static void updateOutStats(Message m,
                                  long size)

updateInStats

public static void updateInStats(Message m,
                                 long size)

run

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

setFailure

public void setFailure()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Thread

getTotalCompressionGainOut

public static int getTotalCompressionGainOut()

getTotalCompressionGainIn

public static int getTotalCompressionGainIn()