BEA Systems, Inc.

WebLogic Server 8.1 API Reference

weblogic.xml.stream.util
Class RecyclingFactory

java.lang.Object
  |
  +--weblogic.xml.stream.util.RecyclingFactory

public final class RecyclingFactory
extends java.lang.Object

Defines a factory that recycles instances of the XMLInputStream API. To request a recycled stream use the remove method. If no streams are present in the internal pool of streams the factory creates a new instance and returns it. The default internal pool holds on to a maximum of 32 streams. For this to work the instance of the static factory should be a singleton in your application. The optimal size of the pool should approximate the average number of concurrent threads in your application.

Author:
Copyright © 2002 BEA Systems, Inc. All Rights Reserved.
See Also:
XMLInputStream, ElementFilter, XMLInputStreamFactory

Constructor Summary
RecyclingFactory()
          Create a factory with the default pool size of 32
RecyclingFactory(int poolSize)
          Create a factory with the specified size
 
Method Summary
 boolean add(XMLInputStream stream)
          Return a stream to the pool.
static void main(java.lang.String[] args)
           
 XMLInputStream remove(java.io.InputStream stream)
          Get a recycled XMLInputStream from the pool or create a new one
 XMLInputStream remove(java.io.InputStream stream, ElementFilter filter)
          Get a recycled XMLInputStream from the pool or create a new one and wrap it with the desired filter
 XMLInputStream remove(java.io.Reader reader)
          Get a recycled XMLInputStream from the pool or create a new one
 XMLInputStream remove(java.io.Reader reader, ElementFilter filter)
          Get a recycled XMLInputStream from the pool or create a new one and wrap it with the desired filter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecyclingFactory

public RecyclingFactory()
Create a factory with the default pool size of 32

RecyclingFactory

public RecyclingFactory(int poolSize)
Create a factory with the specified size

Parameters:
poolSize - the size of the parser pool
Method Detail

remove

public XMLInputStream remove(java.io.InputStream stream)
                      throws XMLStreamException
Get a recycled XMLInputStream from the pool or create a new one

Parameters:
stream - the stream of XML to read from

remove

public XMLInputStream remove(java.io.Reader reader)
                      throws XMLStreamException
Get a recycled XMLInputStream from the pool or create a new one

Parameters:
reader - the XML reader to read from

remove

public XMLInputStream remove(java.io.InputStream stream,
                             ElementFilter filter)
                      throws XMLStreamException
Get a recycled XMLInputStream from the pool or create a new one and wrap it with the desired filter

Parameters:
stream - the stream of XML to read from
filter - the ElementFilter to apply to the stream

remove

public XMLInputStream remove(java.io.Reader reader,
                             ElementFilter filter)
                      throws XMLStreamException
Get a recycled XMLInputStream from the pool or create a new one and wrap it with the desired filter

Parameters:
reader - the XML reader to read from
filter - the ElementFilter to apply to the stream

add

public boolean add(XMLInputStream stream)
            throws XMLStreamException
Return a stream to the pool. Returns true if the stream was added to the pool and false if it wasn't.

Parameters:
stream - the XMLInputStream to return to the pool

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs81b