StoredCollections (Sleepycat Software, Inc. - Berkeley DB Java API)
Keywords: com.sleepycat.bdb.collection.StoredCollections,StoredCollections class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB version 4.2.52
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sleepycat.bdb.collection
Class StoredCollections

    java.lang.Object
      |
      +--com.sleepycat.bdb.collection.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 derieved 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.isDirtyReadEnabled()` will return true. Dirty-read is disabled by default for a container.

Auto-Commit Methods names beginning with autoCommit create a new auto-commit container from a given stored container. If auto-commit is enabled for a container (or for its `DbEnv`), a transaction will be started and committed automatically for each write operation when no transaction is already active. Auto-commit only applies to container methods. It does not apply to iterator methods and these always require an active transaction. For a non-transactional container (where `StoredContainer.isTransactional()` returns false) auto-commit has no effect. If auto-commit is enabled for a transactional container or its environment, `StoredContainer.isAutoCommit()` will return true. Auto-commit is disabled by default for a container but may be enabled for an entire environment using `DbEnv.setFlags(int, boolean)`.

Method Summary
`static Collection` | `autoCommitCollection(Collection storedCollection)` Creates a auto-commit collection from a given stored collection.
`static List` | `autoCommitList(List storedList)` Creates a auto-commit list from a given stored list.
`static Map` | `autoCommitMap(Map storedMap)` Creates a auto-commit map from a given stored map.
`static Set` | `autoCommitSet(Set storedSet)` Creates a auto-commit set from a given stored set.
`static SortedMap` | `autoCommitSortedMap(SortedMap storedSortedMap)` Creates a auto-commit sorted map from a given stored sorted map.
`static SortedSet` | `autoCommitSortedSet(SortedSet storedSortedSet)` Creates a auto-commit sorted set from a given stored sorted set.
`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.

### autoCommitCollection

    public static Collection autoCommitCollection(Collection storedCollection)

  Creates a auto-commit collection from a given stored collection.

  Parameters:
    `storedCollection` - the base collection.
  Returns:
    the auto-commit collection.
  Throws:
    `ClassCastException` - if the given container is not a StoredContainer.

### autoCommitList

    public static List autoCommitList(List storedList)

  Creates a auto-commit list from a given stored list.

  Parameters:
    `storedList` - the base list.
  Returns:
    the auto-commit list.
  Throws:
    `ClassCastException` - if the given container is not a StoredContainer.

### autoCommitMap

    public static Map autoCommitMap(Map storedMap)

  Creates a auto-commit map from a given stored map.

  Parameters:
    `storedMap` - the base map.
  Returns:
    the auto-commit map.
  Throws:
    `ClassCastException` - if the given container is not a StoredContainer.

### autoCommitSet

    public static Set autoCommitSet(Set storedSet)

  Creates a auto-commit set from a given stored set.

  Parameters:
    `storedSet` - the base set.
  Returns:
    the auto-commit set.
  Throws:
    `ClassCastException` - if the given container is not a StoredContainer.

### autoCommitSortedMap

    public static SortedMap autoCommitSortedMap(SortedMap storedSortedMap)

  Creates a auto-commit sorted map from a given stored sorted map.

  Parameters:
    `storedSortedMap` - the base map.
  Returns:
    the auto-commit map.
  Throws:
    `ClassCastException` - if the given container is not a StoredContainer.

### autoCommitSortedSet

    public static SortedSet autoCommitSortedSet(SortedSet storedSortedSet)

  Creates a auto-commit sorted set from a given stored sorted set.

  Parameters:
    `storedSortedSet` - the base set.
  Returns:
    the auto-commit 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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB version 4.2.52
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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