orientdb
orientdb copied to clipboard
Misleading OLockException from Connection Pool when Thread gets interrupted
When a thread gets interrupt() ed before/while acquiring a db connection from a connection pool, a very misleading Exception will be thrown:
com.orientechnologies.common.concur.lock.OLockException: Not more resources available in pool. Requested resource: plocal:S:/workspaces/runtime-***.product/datastore
at com.orientechnologies.common.concur.resource.OResourcePool.getResource(OResourcePool.java:49)
at com.orientechnologies.orient.core.db.ODatabasePoolAbstract.acquire(ODatabasePoolAbstract.java:93)
at ...
Caused by: java.lang.InterruptedException
at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(Unknown Source)
at java.util.concurrent.Semaphore.tryAcquire(Unknown Source)
at com.orientechnologies.common.concur.resource.OResourcePool.getResource(OResourcePool.java:45)
... 7 more
The causing InterruptedException gives it away, but maybe you should let this one bubble up to user code instead of wrapping it into a OLockException with such a misleading message?