[Idrs-commit] CVS: Idrs/dev/src/net/sourceforge/idrs/utils/pool ObjectPool.java,1.4,1.5
Brought to you by:
bigman921
|
From: Marc B. <big...@us...> - 2004-08-30 00:57:03
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/utils/pool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12162/src/net/sourceforge/idrs/utils/pool Modified Files: ObjectPool.java Log Message: Added log4j support. cleaned up the logs Index: ObjectPool.java =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/utils/pool/ObjectPool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ObjectPool.java 29 Aug 2004 05:01:40 -0000 1.4 --- ObjectPool.java 30 Aug 2004 00:56:09 -0000 1.5 *************** *** 18,21 **** --- 18,23 ---- import java.io.*; + import org.apache.log4j.Logger; + /** *************** *** 25,30 **** */ public abstract class ObjectPool implements Serializable { ! ! protected PrintStream out; //Used for logging pool activity protected int maxTrys; protected long daysOpen; //How many days a pooled object will stay open before being rebuilt --- 27,32 ---- */ public abstract class ObjectPool implements Serializable { ! static Logger logger = Logger.getLogger(ObjectPool.class.getName()); ! protected int maxTrys; protected long daysOpen; //How many days a pooled object will stay open before being rebuilt *************** *** 77,81 **** //added Marc Boorshtein - 8/31/00 ! this.out = new PrintStream(new FileOutputStream(path,false)); this.maxTrys = trys; this.daysOpen = daysOpen; --- 79,83 ---- //added Marc Boorshtein - 8/31/00 ! this.maxTrys = trys; this.daysOpen = daysOpen; *************** *** 127,132 **** PooledObject obj = null; int i; ! System.out.println("MaxTrys:" + maxTrys); ! System.out.println("Num:" + num); if (num <= this.maxTrys) { if (count > 0) { --- 129,133 ---- PooledObject obj = null; int i; ! if (num <= this.maxTrys) { if (count > 0) { *************** *** 135,139 **** for (i=0;i<count;i++) { ! System.out.println("Count : " + count + "," + i); synchronized(pool) { if ((pool[i] != null) && (pool[i].isFree())) { --- 136,140 ---- for (i=0;i<count;i++) { ! synchronized(pool) { if ((pool[i] != null) && (pool[i].isFree())) { *************** *** 143,147 **** reset(i); } ! System.out.println("Got Connection"); pool[i].isFree(false); --- 144,148 ---- reset(i); } ! logger.debug("Got Connection"); pool[i].isFree(false); *************** *** 150,157 **** else { // object failed validation ! System.out.println("Object not valid"); synchronized (this) { java.util.Date dnow = new java.util.Date(System.currentTimeMillis()); ! System.out.println("Output : " + out); reset(i); --- 151,158 ---- else { // object failed validation ! logger.error("Object not valid"); synchronized (this) { java.util.Date dnow = new java.util.Date(System.currentTimeMillis()); ! reset(i); *************** *** 194,202 **** } catch(InterruptedException e) { ! System.out.println("ERROR: Failed while waiting for an object:"); ! System.out.println(e); } //changed Marc Boorshtein - 8/31/00 ! out.println("---------> All Connections Exhausted, waiting in loop " + num); return checkOut(num + 1); } --- 195,203 ---- } catch(InterruptedException e) { ! logger.error("ERROR: Failed while waiting for an object:",e); ! } //changed Marc Boorshtein - 8/31/00 ! logger.debug("---------> All Connections Exhausted, waiting in loop " + num); return checkOut(num + 1); } *************** *** 243,247 **** } else { ! System.out.println("Lost Connection"); } --- 244,248 ---- } else { ! logger.warn("Lost Connection"); } *************** *** 254,258 **** PooledObject obj; if (pos == -1) { ! System.out.println("Lost : " + DBName); } else { --- 255,259 ---- PooledObject obj; if (pos == -1) { ! logger.warn("Lost : " + DBName); } else { *************** *** 261,265 **** } else { ! out.println("-------> Connection " + pos + " lost, rebuilding"); synchronized (pool) { int tmpCount = count; --- 262,266 ---- } else { ! logger.debug("-------> Connection " + pos + " lost, rebuilding"); synchronized (pool) { int tmpCount = count; *************** *** 277,281 **** PooledObject obj; if (pos == -1) { ! System.out.println("Lost : " + pos); } else { --- 278,282 ---- PooledObject obj; if (pos == -1) { ! logger.warn("Lost : " + pos); } else { *************** *** 284,288 **** } else { ! out.println("-------> Connection " + pos + " lost, rebuilding"); synchronized (pool) { int tmpCount = count; --- 285,289 ---- } else { ! logger.debug("-------> Connection " + pos + " lost, rebuilding"); synchronized (pool) { int tmpCount = count; |