Methods Summary |
---|
public synchronized void | freeInstance(com.sun.org.apache.xml.internal.dtm.DTMIterator obj)Add an instance of the given object to the pool
m_freeStack.addElement(obj);
|
public synchronized com.sun.org.apache.xml.internal.dtm.DTMIterator | getInstance()Get an instance of the given object in this pool
// Check if the pool is empty.
if (m_freeStack.isEmpty())
{
// Create a new object if so.
try
{
return (DTMIterator)m_orig.clone();
}
catch (Exception ex)
{
throw new WrappedRuntimeException(ex);
}
}
else
{
// Remove object from end of free pool.
DTMIterator result = (DTMIterator)m_freeStack.lastElement();
m_freeStack.setSize(m_freeStack.size() - 1);
return result;
}
|
public synchronized com.sun.org.apache.xml.internal.dtm.DTMIterator | getInstanceOrThrow()Get an instance of the given object in this pool
// Check if the pool is empty.
if (m_freeStack.isEmpty())
{
// Create a new object if so.
return (DTMIterator)m_orig.clone();
}
else
{
// Remove object from end of free pool.
DTMIterator result = (DTMIterator)m_freeStack.lastElement();
m_freeStack.setSize(m_freeStack.size() - 1);
return result;
}
|