Servertec
Persistent Object Store
1.4.1 09/04/2005

stec.pos
Class ObjectStoreEnumerator

java.lang.Object
  extended by stec.pos.ObjectStoreEnumerator
All Implemented Interfaces:
ObjectStoreEnumeration

public final class ObjectStoreEnumerator
extends java.lang.Object
implements ObjectStoreEnumeration

Internal class used by stec.xpos.ObjectStoreReference when implementing stec.pos.ObjectStoreEnumeration.

Since:
1.2.0 12/03/2002

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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hasMoreElements

public final boolean hasMoreElements()
                              throws java.io.IOException,
                                     TimeoutException
Description copied from interface: ObjectStoreEnumeration
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.

Specified by:
hasMoreElements in interface ObjectStoreEnumeration
Returns:
whether the current enumeration contains any more keys or values.
Throws:
java.io.IOException - if an I/O exception occurred.
TimeoutException

hasMoreElements

public final boolean hasMoreElements(long timeout)
                              throws java.io.IOException,
                                     TimeoutException
Description copied from interface: ObjectStoreEnumeration
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.

Specified by:
hasMoreElements in interface ObjectStoreEnumeration
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.

nextElement

public final java.lang.Object nextElement()
                                   throws java.io.IOException,
                                          java.util.NoSuchElementException
Description copied from interface: ObjectStoreEnumeration
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.

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

isOpen

public final boolean isOpen()
                     throws java.io.IOException
Description copied from interface: ObjectStoreEnumeration
Returns whether this enumeration is still open.

Specified by:
isOpen in interface ObjectStoreEnumeration
Returns:
whether this enumeration is still open.
Throws:
java.io.IOException - if an I/O exception occurred.

close

public final void close()
                 throws java.io.IOException
Description copied from interface: ObjectStoreEnumeration
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.

Specified by:
close in interface ObjectStoreEnumeration
Throws:
java.io.IOException - if an I/O exception occurred.

Servertec
Persistent Object Store
1.4.1 09/04/2005

Copyright © 2001-2005 Servertec. All rights reserved.