org.apache.openejb.util
Class NetworkUtil

java.lang.Object
  extended by org.apache.openejb.util.NetworkUtil

public final class NetworkUtil
extends Object

TODO: this class is no more an utility class (static) and should be rewritten to get a config + state -> listOfPorts with release(port) method (otherwise caching makes half of usages broken) -> lockFile -> minPort/maxPort -> ...


Nested Class Summary
static class NetworkUtil.LastPort
           
 
Field Summary
static int EVICTION_TIMEOUT
           
static int PORT_MAX
           
static int PORT_MIN
           
static int[] RANDOM
           
static String TOMEE_LOCK_FILE
          Lock file property name
 
Method Summary
static void clearLockFile()
           
static String getLocalAddress(String start, String end)
           
static int getNextAvailablePort()
           
static int getNextAvailablePort(int[] portList)
           
static int getNextAvailablePort(int min, int max, Collection<Integer> excluded)
           
static int getNextAvailablePort(int min, int max, Collection<Integer> excluded, Collection<NetworkUtil.LastPort> lastPorts)
           
static int getNextAvailablePortInDefaultRange()
           
static boolean isLocalAddress(InetAddress addr)
           
static boolean isLocalAddress(String addr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOMEE_LOCK_FILE

public static final String TOMEE_LOCK_FILE
Lock file property name

See Also:
Constant Field Values

RANDOM

public static final int[] RANDOM

PORT_MIN

public static final int PORT_MIN
See Also:
Constant Field Values

PORT_MAX

public static final int PORT_MAX
See Also:
Constant Field Values

EVICTION_TIMEOUT

public static final int EVICTION_TIMEOUT
Method Detail

clearLockFile

public static void clearLockFile()

getNextAvailablePortInDefaultRange

public static int getNextAvailablePortInDefaultRange()

getNextAvailablePort

public static int getNextAvailablePort()

getNextAvailablePort

public static int getNextAvailablePort(int[] portList)

getNextAvailablePort

public static int getNextAvailablePort(int min,
                                       int max,
                                       Collection<Integer> excluded,
                                       Collection<NetworkUtil.LastPort> lastPorts)

getNextAvailablePort

public static int getNextAvailablePort(int min,
                                       int max,
                                       Collection<Integer> excluded)

getLocalAddress

public static String getLocalAddress(String start,
                                     String end)

isLocalAddress

public static boolean isLocalAddress(String addr)

isLocalAddress

public static boolean isLocalAddress(InetAddress addr)


Copyright © 1999–2015 The Apache Software Foundation. All rights reserved.