@@ -136,7 +136,7 @@ private void evictionRun() {
136
136
shouldEvict = true ;
137
137
}
138
138
} catch (Exception e ) {
139
- log .warn ("Object validation failed with error for object with id {}" , pooledObject .id (), e );
139
+ log .warn ("Object validation failed with error for object with id {} in pool - {} " , pooledObject .id (), config . poolName (), e );
140
140
shouldEvict = true ;
141
141
}
142
142
}
@@ -167,13 +167,13 @@ private void evictionRun() {
167
167
"used {} time(s), " ,
168
168
pooledObject .id (), Duration .ofMillis (System .currentTimeMillis () - pooledObject .creationTime ()), pooledObject .idlingTime (), pooledObject .borrowCount ());
169
169
} catch (Exception e ) {
170
- log .warn ("Failed to destroy object with id {}" , pooledObject .id (), e );
170
+ log .warn ("Failed to destroy object with id {} in pool - {} " , pooledObject .id (), config . poolName (), e );
171
171
}
172
172
}
173
173
174
174
if (!objectsToDestroy .isEmpty ()) {
175
- log .debug ("Evicted {} idle objects. Current pool size: {}, Idle: {}, Borrowed: {}" ,
176
- objectsToDestroy .size (), currentPoolSize (), idleObjectCount (), borrowedObjectsCount ());
175
+ log .debug ("Evicted {} idle objects in pool - {} . Current pool size: {}, Idle: {}, Borrowed: {}" ,
176
+ objectsToDestroy .size (), config . poolName (), currentPoolSize (), idleObjectCount (), borrowedObjectsCount ());
177
177
objectsToDestroy .clear ();
178
178
}
179
179
}
@@ -197,7 +197,7 @@ public void destroyAllIdleObjects() {
197
197
try {
198
198
factory .destroyObject (pooledObject .object ());
199
199
} catch (Exception e ) {
200
- log .warn ("Failed to destroy object with id {}" , pooledObject .id (), e );
200
+ log .warn ("Failed to destroy object with id {} in pool - {} " , pooledObject .id (), config . poolName (), e );
201
201
}
202
202
}
203
203
log .info ("Destroyed {} idle objects. Current pool size: {}" ,
@@ -226,11 +226,11 @@ private void abandonCheckRun() {
226
226
});
227
227
228
228
for (PooledObject <T > pooledObject : objectsToRemove ) {
229
- log .warn ("Removing abandoned object with id {} borrowed for more than {} ms and destroying it." , pooledObject .id (), now - pooledObject .lastBorrowedTime ());
229
+ log .warn ("Removing abandoned object with id {} in pool - {}. It has been borrowed for more than {} ms and destroying it." , pooledObject .id (), config . poolName (), now - pooledObject .lastBorrowedTime ());
230
230
removeAndDestroyBorrowedObjects (pooledObject );
231
231
}
232
232
} catch (Exception e ) {
233
- log .warn ("Error removing abandoned objects" , e );
233
+ log .warn ("Error removing abandoned objects in pool - {}" , config . poolName () , e );
234
234
} finally {
235
235
lock .unlock ();
236
236
}
@@ -248,7 +248,7 @@ private void removeAndDestroyBorrowedObjects(PooledObject<T> pooledObject) {
248
248
try {
249
249
factory .destroyObject (pooledObject .object ());
250
250
} catch (Exception e ) {
251
- log .warn ("Failed to destroy object with id {}" , pooledObject .id (), e .getCause ());
251
+ log .warn ("Failed to destroy object with id {} in pool - {} " , pooledObject .id (), config . poolName (), e .getCause ());
252
252
}
253
253
}
254
254
@@ -392,7 +392,7 @@ public void returnObject(T obj, boolean broken) throws PoolObjectException {
392
392
lock .lock ();
393
393
var pooledObject = borrowedObjects .get (obj .getEntityId ());
394
394
if (pooledObject == null ) {
395
- log .warn ("Attempted returning object that is not in borrowed objects list. id: {}" , obj .getEntityId ());
395
+ log .warn ("Attempted returning object that is not in borrowed objects list. id: {}, pool - {} " , obj .getEntityId (), config . poolName ());
396
396
return ;
397
397
}
398
398
if (broken ) {
@@ -413,7 +413,7 @@ public void returnObject(T obj, boolean broken) throws PoolObjectException {
413
413
}
414
414
415
415
if (!isValid ) {
416
- log .warn ("Returned broken or invalid entity with id {} and destroying it." , pooledObject .id ());
416
+ log .warn ("Returned broken or invalid entity with id {} to pool - {} and destroying it." , pooledObject .id (), config . poolName ());
417
417
removeAndDestroyBorrowedObjects (pooledObject );
418
418
} else {
419
419
@@ -452,10 +452,10 @@ public void returnObject(T obj) throws PoolObjectException {
452
452
@ Override
453
453
public void close () {
454
454
if (!scheduler .isShutdown ()) {
455
- log .info ("Closing object pool. Current pool size: {}" , currentPoolSize .get ());
455
+ log .info ("Closing object pool - {} . Current pool size: {}" , config . poolName () , currentPoolSize .get ());
456
456
scheduler .shutdown ();
457
457
} else {
458
- log .warn ("Trying to close an Object pool that is already closed" );
458
+ log .warn ("Trying to close an Object pool - {} that is already closed" , config . poolName () );
459
459
return ;
460
460
}
461
461
@@ -477,6 +477,7 @@ public void close() {
477
477
// Clear collections
478
478
borrowedObjects .clear ();
479
479
idleObjects .clear ();
480
+ log .info ("Closed object pool - {}" , config .poolName ());
480
481
} finally {
481
482
lock .unlock ();
482
483
}
0 commit comments