/** {@inheritDoc} */ public DocumentBuilder getBuilder() throws XMLParserException { DocumentBuilder builder = null; if (!initialized) { throw new XMLParserException("Parser pool has not been initialized"); } synchronized(builderPool) { if (!builderPool.isEmpty()) { builder = builderPool.pop().get(); } } // Will be null if either the stack was empty, or the SoftReference // has been garbage-collected if (builder == null) { builder = createBuilder(); } if (builder != null) { return new DocumentBuilderProxy(builder, this); } return null; }
/** {@inheritDoc} */ public DocumentBuilder getBuilder() throws XMLParserException { DocumentBuilder builder = null; if (!initialized) { throw new XMLParserException("Parser pool has not been initialized"); } synchronized(builderPool) { if (!builderPool.isEmpty()) { builder = builderPool.pop().get(); } } // Will be null if either the stack was empty, or the SoftReference // has been garbage-collected if (builder == null) { builder = createBuilder(); } if (builder != null) { return new DocumentBuilderProxy(builder, this); } return null; }