net.sf.colossus.webserver
Class PortBookKeeper

java.lang.Object
  extended by net.sf.colossus.webserver.PortBookKeeper

public class PortBookKeeper
extends java.lang.Object

This class keeps track of which ports are currently occupied by ongoing games and which are free for new games.

Author:
Clemens Katzer

Field Summary
private  int availablePorts
           
private static java.util.logging.Logger LOGGER
           
private  int portRangeFrom
           
private  boolean[] portUsed
           
 
Constructor Summary
PortBookKeeper(int portRangeFrom, int availablePorts)
           
 
Method Summary
 int getFreePort()
           
 void releasePort(int port)
           
private  boolean testThatPortReallyFree(int port)
           
 
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

portRangeFrom

private final int portRangeFrom

availablePorts

private final int availablePorts

portUsed

private final boolean[] portUsed
Constructor Detail

PortBookKeeper

public PortBookKeeper(int portRangeFrom,
                      int availablePorts)
Method Detail

getFreePort

public int getFreePort()

testThatPortReallyFree

private boolean testThatPortReallyFree(int port)

releasePort

public void releasePort(int port)