Berkeley DB Java Edition
version 1.5.1

com.sleepycat.collections
Class StoredCollections

java.lang.Object
  |
  +--com.sleepycat.collections.StoredCollections

public class StoredCollections
extends Object

This class consists exclusively of static methods that operate on or return stored collections. It contains methods for changing certain properties of a collection. Because collection properties are immutable, these methods always return a new collection reference. This allows stored collections to be used safely by multiple threads. Note that creating the new collection reference is not expensive and creates only two new objects.

When a collection is created with a particular property, all collections and iterators derived from that collection will inherit the property. For example, if a dirty-read Map is created then calls to subMap(), values(), entrySet(), and keySet() will create dirty-read collections also.

Dirty-Read Methods names beginning with dirtyRead create a new dirty-read container from a given stored container. When dirty-read is enabled, data will be read that has been modified by another transaction but not committed. Using dirty-read can improve concurrency since reading will not wait for other transactions to complete. For a non-transactional container (when StoredContainer.isTransactional() returns false), dirty-read has no effect. If StoredContainer.isDirtyReadAllowed() returns false, dirty-read also has no effect. If dirty-ready is enabled (and allowed) for a container, StoredContainer.isDirtyRead() will return true. Dirty-read is disabled by default for a container.


Method Summary
static Collection dirtyReadCollection(Collection storedCollection)
          Creates a dirty-read collection from a given stored collection.
static List dirtyReadList(List storedList)
          Creates a dirty-read list from a given stored list.
static Map dirtyReadMap(Map storedMap)
          Creates a dirty-read map from a given stored map.
static Set dirtyReadSet(Set storedSet)
          Creates a dirty-read set from a given stored set.
static SortedMap dirtyReadSortedMap(SortedMap storedSortedMap)
          Creates a dirty-read sorted map from a given stored sorted map.
static SortedSet dirtyReadSortedSet(SortedSet storedSortedSet)
          Creates a dirty-read sorted set from a given stored sorted set.
static Iterator iterator(Iterator storedIterator)
          Clones a stored iterator preserving its current position.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

dirtyReadCollection

public static Collection dirtyReadCollection(Collection storedCollection)
Creates a dirty-read collection from a given stored collection.

Parameters:
storedCollection - the base collection.
Returns:
the dirty-read collection.
Throws:
ClassCastException - if the given container is not a StoredContainer.

dirtyReadList

public static List dirtyReadList(List storedList)
Creates a dirty-read list from a given stored list.

Parameters:
storedList - the base list.
Returns:
the dirty-read list.
Throws:
ClassCastException - if the given container is not a StoredContainer.

dirtyReadMap

public static Map dirtyReadMap(Map storedMap)
Creates a dirty-read map from a given stored map.

Parameters:
storedMap - the base map.
Returns:
the dirty-read map.
Throws:
ClassCastException - if the given container is not a StoredContainer.

dirtyReadSet

public static Set dirtyReadSet(Set storedSet)
Creates a dirty-read set from a given stored set.

Parameters:
storedSet - the base set.
Returns:
the dirty-read set.
Throws:
ClassCastException - if the given container is not a StoredContainer.

dirtyReadSortedMap

public static SortedMap dirtyReadSortedMap(SortedMap storedSortedMap)
Creates a dirty-read sorted map from a given stored sorted map.

Parameters:
storedSortedMap - the base map.
Returns:
the dirty-read map.
Throws:
ClassCastException - if the given container is not a StoredContainer.

dirtyReadSortedSet

public static SortedSet dirtyReadSortedSet(SortedSet storedSortedSet)
Creates a dirty-read sorted set from a given stored sorted set.

Parameters:
storedSortedSet - the base set.
Returns:
the dirty-read set.
Throws:
ClassCastException - if the given container is not a StoredContainer.

iterator

public static Iterator iterator(Iterator storedIterator)
Clones a stored iterator preserving its current position.

Parameters:
storedIterator - an iterator to clone.
Returns:
a new StoredIterator having the same position as the given iterator.
Throws:
ClassCastException - if the given iterator is not a StoredIterator.

Berkeley DB Java Edition
version 1.5.1

Copyright (c) 1996-2004 Sleepycat Software, Inc. - All rights reserved.