/** * {@inheritDoc} */ @Override public void passivateObject(final PooledObject<T> p) throws Exception { writeLock.lock(); try { factory.passivateObject(p); } finally { writeLock.unlock(); } }
/** * {@inheritDoc} */ @Override public void passivateObject(final PooledObject<T> p) throws Exception { writeLock.lock(); try { factory.passivateObject(p); } finally { writeLock.unlock(); } }
/** * Adds the provided wrapped pooled object to the set of idle objects for * this pool. The object must already be part of the pool. If {@code p} * is null, this is a no-op (no exception, but no impact on the pool). * * @param p The object to make idle * * @throws Exception If the factory fails to passivate the object */ private void addIdleObject(final PooledObject<T> p) throws Exception { if (p != null) { factory.passivateObject(p); if (getLifo()) { idleObjects.addFirst(p); } else { idleObjects.addLast(p); } } }
success = false; } else { factory.passivateObject(ref);
private static <T> List<String> invokeEveryMethod(final PooledObjectFactory<T> pof) throws Exception { pof.activateObject(null); pof.destroyObject(null); pof.makeObject(); pof.passivateObject(null); pof.validateObject(null); pof.toString(); final List<String> expectedMethods = Arrays.asList(new String[] { "activateObject", "destroyObject", "makeObject", "passivateObject", "validateObject", "toString", }); return expectedMethods; }
} else { try { factory.passivateObject(ref); } catch (final Exception e) { success = false;
@Test public void testDefaultMethods() throws Exception { final PooledObjectFactory<Object> factory = new TestFactory(); factory.activateObject(null); // a no-op factory.passivateObject(null); // a no-op factory.destroyObject(null); // a no-op assertTrue(factory.validateObject(null)); // constant true }
/** * {@inheritDoc} */ @Override public void passivateObject(final PooledObject<T> p) throws Exception { writeLock.lock(); try { factory.passivateObject(p); } finally { writeLock.unlock(); } }
} else { try { factory.passivateObject(underTest); } catch (final Exception e) { destroy(underTest);
factory.passivateObject(p); } catch (final Exception e1) { swallowException(e1);
/** * Adds the provided wrapped pooled object to the set of idle objects for * this pool. The object must already be part of the pool. If {@code p} * is null, this is a no-op (no exception, but no impact on the pool). * * @param p The object to make idle * * @throws Exception If the factory fails to passivate the object */ private void addIdleObject(final PooledObject<T> p) throws Exception { if (p != null) { factory.passivateObject(p); if (getLifo()) { idleObjects.addFirst(p); } else { idleObjects.addLast(p); } } }
success = false; } else { factory.passivateObject(ref);
} else { try { factory.passivateObject(ref); } catch (final Exception e) { success = false;
} else { try { factory.passivateObject(underTest); } catch (final Exception e) { destroy(underTest);
factory.passivateObject(p); } catch (final Exception e1) { swallowException(e1);