Changeset 19433
- Timestamp:
- 2009-05-13T14:30:12+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
greenstone3/trunk/src/java/org/greenstone/server/PortFinder.java
r19428 r19433 46 46 * @return the number of an available port. 47 47 */ 48 public int findPortInRange(boolean silent) throws Exception {48 public int findPortInRange(boolean verbose) throws Exception { 49 49 try { 50 50 boolean foundFreePort = false; 51 51 for(int i = 0; i < PORT_BLOCK_SIZE; i++) { 52 52 53 if(isPortAvailable(nextFreePort, silent)) {53 if(isPortAvailable(nextFreePort, verbose)) { 54 54 foundFreePort = true; 55 55 break; … … 107 107 108 108 /** @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) { 110 110 ServerSocket tmpSocket = null; 111 111 try { 112 112 tmpSocket = new ServerSocket(portnum); 113 113 tmpSocket.close(); 114 if( !silent) {114 if(verbose) { 115 115 System.err.println("Port " + portnum + " not yet in use."); 116 116 } … … 121 121 // socket to a local address and port. Typically, the port is 122 122 // in use, or the requested local address could not be assigned." 123 if( !silent) {123 if(verbose) { 124 124 System.err.println("Port " + portnum + " already in use or can't be assigned."); 125 125 }
Note:
See TracChangeset
for help on using the changeset viewer.