Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jini.rio.resources.persistence
Class PersistentStore

    java.lang.Object
      org.jini.rio.resources.persistence.PersistentStore

    public class PersistentStore

extends Object

Class that stores a server's state to disk. Basically a wrapper around ReliableLog with the addition of lock management.

Constructor Summary
`PersistentStore(String logDir, com.sun.jini.reliableLog.LogHandler logHandler, SnapshotHandler snapshotHandler)` Construct a store that will persist its data to the specified directory.

Method Summary
`void` | `acquireMutatorLock()` Block until we can acquire a non-exclusive mutator lock on the servers 's persistent state.
`void` | `addSubStore(SubStore subStore)` Inform the store of a sub-store
`void` | `close()` Close this PersistentStore without destroying its contents
`void` | `destroy()` Destroy the store
`String` | `getStoreLocation()` Get the absolute path location for the store location
`void` | `releaseMutatorLock()` Release one level of mutator locks if this thread holds at lease one.
`void` | `snapshot()` Generate a snapshot, will perform the necessary locking to ensure no threads are mutating the state of the server before creating the snapshot.
`void` | `update(Object o)` Log an update.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PersistentStore

    public PersistentStore(String logDir,
                           com.sun.jini.reliableLog.LogHandler logHandler,
                           SnapshotHandler snapshotHandler)
                    throws StoreException

  Construct a store that will persist its data to the specified directory.

  Parameters:
    `logDir` - Directory where the store should persist its data. must exist.
    `logHandler` - Object that will process the log and last snapshot to recover the server's state
    `snapshotHandler` - the server is called back after an update so it can decide whether or not to do a snapshot.
  Throws:
    `StoreException` - if there is a problem setting up the store

Method Detail

### destroy

    public void destroy()
                 throws IOException

  Destroy the store

  Throws:
    `IOException` - if it has difficulty removing the log files

### getStoreLocation

    public String getStoreLocation()

  Get the absolute path location for the store location

  Returns:
    The absolute path location for the store location

### addSubStore

    public void addSubStore(SubStore subStore)
                     throws StoreException

  Inform the store of a sub-store

  Parameters:
    `subStore` - The SubStore to add
  Throws:
    `StoreException` - if the SubStore cannot be added

### acquireMutatorLock

    public void acquireMutatorLock()

  Block until we can acquire a non-exclusive mutator lock on the servers 's persistent state. This lock should be acquired in a `try` block and a `releaseMutatorLock` call should be placed in a `finally` block.

### releaseMutatorLock

    public void releaseMutatorLock()

  Release one level of mutator locks if this thread holds at lease one.

### update

    public void update(Object o)
                throws IOException

  Log an update. Will flush to disk before returning.

  Parameters:
    `o` - Update argument
  Throws:
    `IllegalStateException` - if the current thread does not hold a non-exclusive mutator lock
    `IOException` - If errors accessing the file system occur

### snapshot

    public void snapshot()
                  throws IOException

  Generate a snapshot, will perform the necessary locking to ensure no threads are mutating the state of the server before creating the snapshot.

  Throws:
    `IOException` - see
  See Also:
    `ReliableLog.snapshot()`

### close

    public void close()
               throws IOException

  Close this PersistentStore without destroying its contents

  Throws:
    `IOException` - If file system access errors are encountered

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © Project Rio.