Changeset 19433

Show
Ignore:
Timestamp:
13.05.2009 14:30:12 (10 years ago)
Author:
ak19
Message:

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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • greenstone3/trunk/src/java/org/greenstone/server/PortFinder.java

    r19428 r19433  
    4646     *  @return the number of an available port.     
    4747     */ 
    48     public int findPortInRange(boolean silent) throws Exception {    
     48    public int findPortInRange(boolean verbose) throws Exception {   
    4949    try { 
    5050        boolean foundFreePort = false; 
    5151        for(int i = 0; i < PORT_BLOCK_SIZE; i++) { 
    5252         
    53         if(isPortAvailable(nextFreePort, silent)) { 
     53        if(isPortAvailable(nextFreePort, verbose)) { 
    5454            foundFreePort = true; 
    5555            break; 
     
    107107 
    108108    /** @return true if the portnum is available for use */ 
    109     public static boolean isPortAvailable(int portnum, boolean silent) { 
     109    public static boolean isPortAvailable(int portnum, boolean verbose) { 
    110110    ServerSocket tmpSocket = null; 
    111111    try { 
    112112        tmpSocket = new ServerSocket(portnum); 
    113113        tmpSocket.close(); 
    114         if(!silent) { 
     114        if(verbose) { 
    115115        System.err.println("Port " + portnum + " not yet in use."); 
    116116        } 
     
    121121        // socket to a local address and port. Typically, the port is  
    122122        // in use, or the requested local address could not be assigned." 
    123         if(!silent) { 
     123        if(verbose) { 
    124124        System.err.println("Port " + portnum + " already in use or can't be assigned."); 
    125125        }