List of usage examples for org.apache.commons.pool ObjectPool invalidateObject
void invalidateObject(Object p0) throws Exception;
From source file:org.openrepose.filters.translation.httpx.HttpxMarshaller.java
private void marshall(Object o, OutputStream out) { Marshaller pooledObject = null; ObjectPool<Marshaller> marshallerPool = HttpxMarshallerUtility.marshallerPool; try {/* w ww .ja va 2s. c o m*/ try { pooledObject = marshallerPool.borrowObject(); pooledObject.marshal(o, out); } catch (Exception ex) { marshallerPool.invalidateObject(pooledObject); pooledObject = null; throw new HttpxException("Error marshalling HTTPX object", ex); } finally { if (pooledObject != null) { marshallerPool.returnObject(pooledObject); } } } catch (Exception e) { throw new HttpxException("Error marshalling HTTPX object", e); } }