/** {@inheritDoc} */ public DocumentBuilder getBuilder() throws XMLParserException { DocumentBuilder builder = null; long version = 0; if (dirtyBuilderConfiguration) { initializePool(); } synchronized(this) { version = getPoolVersion(); 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, version); } return null; }
/** {@inheritDoc} */ public DocumentBuilder getBuilder() throws XMLParserException { DocumentBuilder builder = null; long version = 0; if (dirtyBuilderConfiguration) { initializePool(); } synchronized(this) { version = getPoolVersion(); 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, version); } return null; }
/** Constructor. */ public BasicParserPool() { maxPoolSize = 5; builderPool = new Stack<SoftReference<DocumentBuilder>>(); builderAttributes = new LazyMap<String, Object>(); coalescing = true; expandEntityReferences = false; builderFeatures = buildDefaultFeatures(); ignoreComments = true; ignoreElementContentWhitespace = true; namespaceAware = true; schema = null; dtdValidating = false; xincludeAware = false; errorHandler = new LoggingErrorHandler(log); try { dirtyBuilderConfiguration = true; initializePool(); } catch (XMLParserException e) { // default settings, no parsing exception } }
/** Constructor. */ public BasicParserPool() { maxPoolSize = 5; builderPool = new Stack<SoftReference<DocumentBuilder>>(); builderAttributes = new LazyMap<String, Object>(); coalescing = true; expandEntityReferences = false; builderFeatures = buildDefaultFeatures(); ignoreComments = true; ignoreElementContentWhitespace = true; namespaceAware = true; schema = null; dtdValidating = false; xincludeAware = false; errorHandler = new LoggingErrorHandler(log); try { dirtyBuilderConfiguration = true; initializePool(); } catch (XMLParserException e) { // default settings, no parsing exception } }