com.debianmirror.server
Class Listener

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--com.debianmirror.server.Listener
All Implemented Interfaces:
java.lang.Runnable

public class Listener
extends java.lang.Thread

Listener will listen on the assigned listeningPort for incoming client requests. These client requests will be stored in a list. These stored client requests can get requested by the getSocket() method. These should be returned in a fifo manner.

Author:
E01 - Tobias Hertkorn, Jonas Jagerhok, Jamie Fitz-Gerald

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Listener(int myLP)
          Creates a Listener instance on the assigned listeningPort.
 
Method Summary
 void die()
          Changes the keepRunning variable and notifys the Listener of the change.
 java.net.Socket getSocket()
          Returns a socket from the sockets list.
 void run()
          Is the method starting the Listener thread.
Basicly just calls the listenLoop()  methode.
 
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, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Listener

public Listener(int myLP)
         throws java.io.IOException
Creates a Listener instance on the assigned listeningPort.

Throws:
IOException - thrown, when there is something wrong with the ServerSocket.
Method Detail

die

public void die()

Changes the keepRunning variable and notifys the Listener of the change.
Should initiate a graceful stop of the thread.


getSocket

public java.net.Socket getSocket()
Returns a socket from the sockets list.
If there is no socket in the sockets list, this method blocks until there is a socket to return

Returns:
a socket representing a client connection.

run

public void run()

Is the method starting the Listener thread.
Basicly just calls the listenLoop()  methode.

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


Copyright © 2004, Apt-Got Group