Changeset 19432 for gli/trunk


Ignore:
Timestamp:
2009-05-13T14:29:21+12:00 (15 years ago)
Author:
ak19
Message:

Changing somethings about previous commit: isPortAvailable takes a parameter called verbose instead of one called silent.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/util/PortFinder.java

    r19429 r19432  
    4747     *  @return the number of an available port.   
    4848     */
    49     public int findPortInRange(boolean silent) throws Exception {   
     49    public int findPortInRange(boolean verbose) throws Exception { 
    5050    try {
    5151        boolean foundFreePort = false;
    5252        for(int i = 0; i < PORT_BLOCK_SIZE; i++) {
    5353       
    54         if(isPortAvailable(nextFreePort, silent)) {
     54        if(isPortAvailable(nextFreePort, verbose)) {
    5555            foundFreePort = true;
    5656            break;
     
    108108
    109109    /** @return true if the portnum is available for use */
    110     public static boolean isPortAvailable(int portnum, boolean silent) {
     110    public static boolean isPortAvailable(int portnum, boolean verbose) {
    111111    ServerSocket tmpSocket = null;
    112112    try {
    113113        tmpSocket = new ServerSocket(portnum);
    114114        tmpSocket.close();
    115         if(!silent) {
     115        if(verbose) {
    116116        System.err.println("Port " + portnum + " not yet in use.");
    117117        }
     
    122122        // socket to a local address and port. Typically, the port is
    123123        // in use, or the requested local address could not be assigned."
    124         if(!silent) {
     124        if(verbose) {
    125125        System.err.println("Port " + portnum + " already in use or can't be assigned.");
    126126        }
Note: See TracChangeset for help on using the changeset viewer.