/** * {@inheritDoc} */ public void returnObject(final T obj) { synchronized (lock) { try { pool.returnObject(obj); } catch (Exception e) { // swallowed as of Pool 2 } } }
/** * Return and object to the pool, ignoring the key * * @param key ignored * @param obj object to return */ public void returnObject(final K key, final V obj) { try { pool.returnObject(obj); } catch (Exception e) { // swallowed as of Pool 2 } }
/** * Return an object to the pool, verifying that it is of the correct type. * * @param obj object to return * @throws ClassCastException if obj is not of the expected type */ public void returnObject(final T obj) { if (type.isInstance(obj)) { try { pool.returnObject(obj); } catch (Exception e) { // swallowed as of Pool 2 } } else { throw new ClassCastException("Returned object is not of type: " + type.getName() + " was: " + obj); } }
pool.invalidateObject(obj); } else { pool.returnObject(obj);
public String getBackingStoreDescription() throws FactoryException { AbstractCachedAuthorityFactory worker = null; try { worker = (AbstractCachedAuthorityFactory) getPool().borrowObject(); return worker.getBackingStoreDescription(); } catch (FactoryException e) { throw e; } catch (Exception e) { throw new FactoryException(e); } finally { try { getPool().returnObject(worker); } catch (Exception e) { LOGGER.log(Level.WARNING, "Unable to return worker " + e, e); } } } /**
@Test public void close() throws Exception { managedConnection.close(); verify(pool, never()).returnObject(anyObject()); }
@Test public void releaseInvalidConnection() throws Exception { when(connectionProvider.validate(connection)).thenReturn(failure("Connection is invalid", new IOException())); managedConnection.release(); verify(pool).invalidateObject(connection); verify(pool, never()).returnObject(connection); verify(poolingListener, never()).onReturn(connection); }
@Test public void release() throws Exception { managedConnection.release(); verify(pool).returnObject(connection); verify(poolingListener).onReturn(connection); assertDisconnected(); }
public void returnObject(final Object key, final Object obj) { try { pool.returnObject(obj); } catch (Exception e) { // swallowed as of Pool 2 } }
/** * Returns the specified object to the underlying <code>ObjectPool</code>. */ public void releaseTarget(Object target) throws Exception { this.pool.returnObject(target); }
public Set getAuthorityCodes(Class type) throws FactoryException { Set codes = (Set) cache.get(type); if (codes == null) { try { cache.writeLock(type); codes = (Set) cache.peek(type); if (codes == null) { AbstractCachedAuthorityFactory worker = null; try { worker = (AbstractCachedAuthorityFactory) getPool().borrowObject(); codes = worker.getAuthorityCodes(type); cache.put(type, codes); } catch (FactoryException e) { throw e; } catch (Exception e) { throw new FactoryException(e); } finally { try { getPool().returnObject(worker); } catch (Exception e) { LOGGER.log(Level.WARNING, "Unable to return worker " + e, e); } } } } finally { cache.writeUnLock(type); } } return codes; }
} finally { try { getPool().returnObject(worker); } catch (Exception e) { LOGGER.log(Level.WARNING, "Unable to return worker " + e, e);
} finally { try { getPool().returnObject(worker); } catch (Exception e) { LOGGER.log(Level.WARNING, "Unable to return worker " + e, e);
public void trashObject() { try { // FIXME shouldn't just return the object to the pool? this.pool.returnObject(sbbObject); this.sbbObject = null; } catch (Exception e) { throw new RuntimeException("Unexpected exception ", e); } }
public void release(SubscriberKeyMgtClient client) { try { clientPool.returnObject(client); } catch (Exception e) { log.error("Error occurred while returning client back to pool."); } }
} finally { try { getPool().returnObject(worker); } catch (Exception e) { LOGGER.log(Level.WARNING, "Unable to return worker " + e, e);
public void returnObject(final Object obj) { if (type.isInstance(obj)) { try { pool.returnObject(obj); } catch (Exception e) { // swallowed as of Pool 2 } } else { throw new ClassCastException("Returned object is not of type: " + type.getName() + " was: " + obj); } }
public void returnConnection(Tuple2<DataSource, Connection> con) { try { if (con != null) { pool.returnObject(con); } } catch (Exception ex) { Logger.getLogger(MysqlAccessor.class.getName()).log(Level.SEVERE, null, ex); } }
worker.findCache = findCache; try { getPool().returnObject(worker); } catch (Exception e) { LOGGER.log(Level.WARNING, "Unable to return worker " + e, e);
public void returnSession(PooledSession session) throws JMSException { // lets check if we are already closed getConnection(); try { getSessionPool().returnObject(session); } catch (Exception e) { throw JMSExceptionSupport.create("Failed to return session to pool: " + e, e); } }