/** * Create a new object instance, ignoring the key * * @param key ignored * @return newly created object instance */ public V makeObject(final K key) throws Exception { return factory.makeObject(); }
/** * {@inheritDoc} */ public T makeObject() throws Exception { synchronized (lock) { return factory.makeObject(); } }
throw new IllegalStateException("Cannot add objects without a factory."); T obj = _factory.makeObject();
throw new IllegalStateException("Cannot add objects without a factory."); T obj = _factory.makeObject();
/** * Create an object, and place it into the pool. * addObject() is useful for "pre-loading" a pool with idle objects. */ @Override public void addObject() throws Exception { assertOpen(); if (_factory == null) { throw new IllegalStateException("Cannot add objects without a factory."); } T obj = _factory.makeObject(); try { assertOpen(); addObjectToPool(obj, false); } catch (IllegalStateException ex) { // Pool closed try { _factory.destroyObject(obj); } catch (Exception ex2) { // swallow } throw ex; } }
throw new NoSuchElementException(); } else { obj = _factory.makeObject(); newlyCreated = true; if (obj == null) {
} else { newlyCreated = true; obj = _factory.makeObject();
if(null == latch.getPair()) { try { T obj = _factory.makeObject(); latch.setPair(new ObjectTimestampPair<T>(obj)); newlyCreated = true;
/** * Create a new object instance, ignoring the key * * @param key ignored * @return newly created object instance */ public V makeObject(final K key) throws Exception { return factory.makeObject(); }
/** * {@inheritDoc} */ public T makeObject() throws Exception { synchronized (lock) { return factory.makeObject(); } }
public Object makeObject() throws Exception { synchronized (lock) { return factory.makeObject(); } }
public Object makeObject() throws Exception { synchronized (lock) { return factory.makeObject(); } }
@Override public synchronized T borrowObject() throws Exception, NoSuchElementException, IllegalStateException { if (t == null) { t = factory.makeObject(); } return t; }
/** * {@inheritDoc} */ public T makeObject() throws Exception { synchronized (lock) { return factory.makeObject(); } }
/** * Create a new object instance, ignoring the key * * @param key ignored * @return newly created object instance */ public V makeObject(final K key) throws Exception { return factory.makeObject(); }
public Object makeObject(final Object key) throws Exception { return factory.makeObject(); }
public Object makeObject(final Object key) throws Exception { return factory.makeObject(); }
@Override public synchronized T borrowObject() throws Exception, NoSuchElementException, IllegalStateException { if (t != null) { // ensure the object is validate before we borrow it if (!factory.validateObject(t)) { invalidateObject(t); LOG.info("Recreating new connection as current connection is invalid: {}", t); t = null; } } if (t == null) { t = factory.makeObject(); } return t; }
/** * Create an object, and place it into the pool. * addObject() is useful for "pre-loading" a pool with idle objects. */ public void addObject() throws Exception { assertOpen(); if (_factory == null) { throw new IllegalStateException("Cannot add objects without a factory."); } Object obj = _factory.makeObject(); try { assertOpen(); addObjectToPool(obj, false); } catch (IllegalStateException ex) { // Pool closed try { _factory.destroyObject(obj); } catch (Exception ex2) { // swallow } throw ex; } }
/** * Create an object, and place it into the pool. * addObject() is useful for "pre-loading" a pool with idle objects. */ public void addObject() throws Exception { assertOpen(); if (_factory == null) { throw new IllegalStateException("Cannot add objects without a factory."); } Object obj = _factory.makeObject(); try { assertOpen(); addObjectToPool(obj, false); } catch (IllegalStateException ex) { // Pool closed try { _factory.destroyObject(obj); } catch (Exception ex2) { // swallow } throw ex; } }