Methods Summary |
---|
protected boolean | canCreate()Since this method would be called only if the pool is empty
return (isBounded == null) ? true : (createdCount < maxLimit);
|
protected java.lang.Object | checkin(java.lang.Object object)Notification when an object is put back into the pool (checkin).
list.addAsLastNode(new TimeStampedDListNode(object, _clock.getTime()));
return this;
|
protected java.lang.Object | checkout(java.lang.Object param)Notification when an object is given out from the pool (checout).
return obtainObject(param);
|
public void | epilog()
|
public boolean | getExecuteIfMissed()Determine to execute the service method of this object even if it has
missed the right schedule.
return true;
|
public boolean | getExecutionTolerance(long missedByMillis)Determine to execute the service method of this object when the
schedule is delayed by 'missedByMillis' milli seconds.
return true;
|
public long | getFrequency()Get the frequency (time interval) at which service() method will be invoked.
return this.maxIdleTime;
|
public int | getMaxLimit()
return this.maxLimit;
|
private void | initPool()
list = new DList();
super.collection = list;
super.preload((minSize < initialSize) ? initialSize : minSize);
scheduler.addTimeRepeatableTask(this, (int) maxIdleTime);
|
private java.lang.Object | obtainObject(java.lang.Object param)
SoftReference ref;
Object object;
TimeStampedDListNode tsNode = (TimeStampedDListNode) list.delinkLastNode();
return tsNode.object;
|
public void | prolog()
|
public void | service()
int killedCount = 0;
long now = _clock.getTime();
long allowed = now - maxIdleTime;
TimeStampedDListNode tsNode = null;
FastStack stack = new FastStack();
synchronized (super.collection) {
Object done = null;
while (done == null) {
tsNode = (TimeStampedDListNode) list.getFirstDListNode();
if (tsNode == null) { //Empty list
done = new Object();
} else if (tsNode.timeStamp <= allowed) {
//Need to destroy the contained object
list.delink(tsNode);
stack.push(tsNode.object);
killedCount++;
} else {
//This node is not old enough
done = new Object();
}
} //End of for loop
super.createdCount -= killedCount;
if (createdCount < minSize) {
super.preload(minSize - createdCount);
}
if (waitCount > 0) {
if (killedCount == 1) {
collection.notify();
} else {
collection.notifyAll();
}
}
} // end of synchronized
//Now destroy all collected objects
while (! stack.isEmpty()) {
Object object = stack.pop();
beforeDestroy(object);
factory.destroy(object);
}
//Bug 4677074 System.out.println("Leaving service after killing " + killedCount + " (idle) objects. Now size: " + list.size());
//Bug 4677074 begin
_logger.log(Level.FINE,"Leaving service after killing " + killedCount + " (idle) objects. Now size: " + list.size());
//Bug 4677074 end
|
public void | setMaxLimit(int limit)
if ((limit <= 0) || (limit >= Integer.MAX_VALUE-1)) {
this.isBounded = null;
} else {
this.isBounded = Boolean.valueOf(true);
this.maxLimit = limit;
}
|
public java.lang.String | toString()Print an identification for the object.
return "";
|