com.Prominic.jFTPd
Class IdleKiller

java.lang.Object
  extended by java.lang.Thread
      extended by com.Prominic.jFTPd.IdleKiller
All Implemented Interfaces:
java.lang.Runnable

public class IdleKiller
extends java.lang.Thread

This class is used to kill idle connections - that is connections that didn't send any command in the specified period and which don't do any transfers - are not busy. Connections are checked every 15 seconds.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
(package private)  boolean DEBUG
           
(package private)  ConnectionHandler handler
           
(package private)  boolean running
           
(package private)  long sleepTime
           
(package private)  long timeout
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
IdleKiller(ConnectionHandler handler, long timeout)
          Creates an idle killer.
 
Method Summary
 long getTimeout()
           
 void run()
          Runs the thread.
 void setTimeout(long t)
          Sets the timeout value.
 void shutdownConnections()
          This terminates all the active connections, no matter if they are idle or not.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, 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, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG

boolean DEBUG

handler

ConnectionHandler handler

timeout

long timeout

sleepTime

long sleepTime

running

boolean running
Constructor Detail

IdleKiller

public IdleKiller(ConnectionHandler handler,
                  long timeout)
Creates an idle killer.

Parameters:
handler - - connection handler
timeout - - the timeout period
Method Detail

getTimeout

public long getTimeout()
Returns:
long the time out period.

run

public void run()
Runs the thread. It calls connection.terminate() for each connection that is idle. FTP clients can use the NOOP command to keep the connection alive.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

setTimeout

public void setTimeout(long t)
Sets the timeout value.

Parameters:
t - - new timeout value.

shutdownConnections

public void shutdownConnections()
This terminates all the active connections, no matter if they are idle or not. Used when shutting down the server. Creation date: (07-Aug-02 17:54:36)