org.jgroups.util
Class PortsManager

java.lang.Object
  extended by org.jgroups.util.PortsManager

public class PortsManager
extends java.lang.Object

Maintains a list of ports used on this host, associated with time stamps. The ports are persisted into the temp file system.

Version:
$Id: PortsManager.java,v 1.6 2009/01/05 07:38:06 belaban Exp $
Author:
Bela Ban

Constructor Summary
PortsManager()
           
PortsManager(long expiry_time)
           
PortsManager(long expiry_time, java.lang.String ports_file)
           
PortsManager(long expiry_time, java.lang.String filename, java.lang.String temp_dir)
           
PortsManager(java.lang.String ports_file)
           
 
Method Summary
 void deleteFile()
          Deletes the underlying file.
 long getExpiryTime()
           
 int getNextAvailablePort(int start_port)
          Loads the file, weeds out expired ports, returns the next available port and saves the new port in the file
 void removePort(int port)
          Loads the file, removes the port (if existent) and closes the file again
 void setExpiryTime(long expiry_time)
           
 void updatePort(int port)
          Updates the timestamp for the given port
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortsManager

public PortsManager()

PortsManager

public PortsManager(long expiry_time)

PortsManager

public PortsManager(java.lang.String ports_file)

PortsManager

public PortsManager(long expiry_time,
                    java.lang.String ports_file)

PortsManager

public PortsManager(long expiry_time,
                    java.lang.String filename,
                    java.lang.String temp_dir)
Method Detail

getExpiryTime

public long getExpiryTime()

setExpiryTime

public void setExpiryTime(long expiry_time)

getNextAvailablePort

public int getNextAvailablePort(int start_port)
Loads the file, weeds out expired ports, returns the next available port and saves the new port in the file


removePort

public void removePort(int port)
Loads the file, removes the port (if existent) and closes the file again


updatePort

public void updatePort(int port)
Updates the timestamp for the given port

Parameters:
port -

deleteFile

public void deleteFile()
Deletes the underlying file. Used for unit testing, not recommended for regular use !



Copyright © 1998-2009 Bela Ban / Red Hat. All Rights Reserved.