Servertec
Persistent Object Store
1.4.1 09/04/2005

stec.pos
Interface ObjectStoreEnumeration

All Known Implementing Classes:
ObjectStoreEnumerator, ObjectStoreEnumerator

public interface ObjectStoreEnumeration

Defines interface for accessing a series of elements representing keys or values contained in the persistent object store.

Unlike java.util.Enumeration, java.util.Enumeration nextElement() does not move the cursor to the next element, hasMoreElement() does.

If locking is enabled then hasMoreElement() will first unlock any key that was locked by the last call to hasMoreElements() and then it will attempt to lock the next key before it returns.

If locking is enabled then when an enumeration is closed or finalized it will unlock the last key that was locked by the last call to hasMoreElements().

Since:
1.0.0 08/12/2001
See Also:
elements, elements, elements, elements, keys, keys, keys, keys, elements, elements, elements, elements, keys, keys, keys, keys, ObjectStoreEnumerationFilter, Enumeration

Method Summary
 void close()
          Closes this enumeration.
 boolean hasMoreElements()
          Returns whether the current enumeration contains any more keys or values.
 boolean hasMoreElements(long timeout)
          Returns whether the current enumeration contains any more keys or values.
 boolean isOpen()
          Returns whether this enumeration is still open.
 java.lang.Object nextElement()
          Returns the next element.
 

Method Detail

hasMoreElements

boolean hasMoreElements()
                        throws java.io.IOException
Returns whether the current enumeration contains any more keys or values.

Internally finds the next element, moving the cursor as needed.

If locking is enabled then hasMoreElement() will first unlock any key that was locked by the last call to hasMoreElements() and then it will attempt to lock the next key before it returns.

If the next key is already locked by another reference then this method will roadblock until the key can be locked.

Returns:
whether the current enumeration contains any more keys or values.
Throws:
java.io.IOException - if an I/O exception occurred.

hasMoreElements

boolean hasMoreElements(long timeout)
                        throws java.io.IOException,
                               TimeoutException
Returns whether the current enumeration contains any more keys or values.

Internally finds the next element, moving the cursor as needed.

If locking is enabled then hasMoreElement() will first unlock any key that was locked by last call to hasMoreElements() and then it will attempt to lock the next key before it returns.

If the next key is already locked by another reference then this method will roadblock until the key can be locked or timeout occurs.

If TimeoutException is thrown then nextElement() returns the element that is waiting to be locked.

Parameters:
timeout - the number of milliseconds to wait for the next key to be locked before giving up and throwing TimeoutException. -1 for unlimited.
Returns:
whether the current enumeration contains any more keys or values.
Throws:
TimeoutException - if the next key could not be locked in the time specified.
java.io.IOException - if an I/O exception occurred.
Since:
1.3.1 11/26/2003

nextElement

java.lang.Object nextElement()
                             throws java.io.IOException,
                                    java.util.NoSuchElementException
Returns the next element.

Does not move the cursor to the next element, hasMoreElements() does.

Repeated calls without, first calling hasMoreElements(), will return the same element.

Returns the element that is waiting to be locked when hasMoreElements(long) throws a TimeoutException.

Returns:
the next element.
Throws:
java.util.NoSuchElementException - if no more elements were available.
java.io.IOException - if an I/O exception occurred.

close

void close()
           throws java.io.IOException
Closes this enumeration.

If locking was enabled then this method unlocks the last key that was locked by the last call to hasMoreElements().

This method must be called if locking is enabled.

Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.2.0 12/03/2002

isOpen

boolean isOpen()
               throws java.io.IOException
Returns whether this enumeration is still open.

Returns:
whether this enumeration is still open.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.2.0 12/03/2002

Servertec
Persistent Object Store
1.4.1 09/04/2005

Copyright © 2001-2005 Servertec. All rights reserved.