Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.classpath.tools.rmi
Class PersistentHashTable  view PersistentHashTable download PersistentHashTable.java

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended bygnu.classpath.tools.rmi.PersistentHashTable
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, Persistent, java.io.Serializable

public class PersistentHashTable
extends java.util.Hashtable
implements java.io.Serializable, Persistent

The persistent hash table. The changes are written to dist after SAVE_AT_MOST_AFTER time from the latest database change or at most after ALWAYS_UPDATE, if the database is updated very frequently. To ensure that no information is lost, the shutdown method must be called before exit.


Nested Class Summary
(package private)  class PersistentHashTable.WriteToDiskTask
           
 
Nested classes inherited from class java.util.Hashtable
 
Nested classes inherited from class gnu.classpath.tools.rmi.Persistent
Persistent.ExitTask
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
(package private)  java.io.File database
          The database file.
(package private)  long lastUpdated
          The time, when the disk database was last updated.
(package private)  boolean ready
          Setting to false prevents the automated disk update.
private static long serialVersionUID
          Use serialVersionUID for interoperability
(package private)  PersistentHashTable.WriteToDiskTask sheduled
          The currently sheduled write to disk task, null if none.
 
Fields inherited from class java.util.Hashtable
 
Fields inherited from interface gnu.classpath.tools.rmi.Persistent
ALWAYS_UPDATE, SAVE_AT_MOST_AFTER, timer
 
Constructor Summary
private PersistentHashTable(java.io.File file)
          Use static method to obtain the instance.
 
Method Summary
static java.util.Map createInstance(java.io.File file, boolean coldStart)
          Create a new persistent table that stores its information into the given file.
 void markDirty()
          Mark the modified database as modified.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Update the memory maps and mark as should be written to the disk.
 java.lang.Object remove(java.lang.Object key)
          Update the memory maps and mark as should be written to the disk.
 void shutdown()
          Save the current database state to the disk before exit.
 void writeContent()
          Write the database content to the disk.
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, putAll, rehash, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Use serialVersionUID for interoperability

See Also:
Constant Field Values

database

java.io.File database
The database file.


sheduled

PersistentHashTable.WriteToDiskTask sheduled
The currently sheduled write to disk task, null if none.


lastUpdated

long lastUpdated
The time, when the disk database was last updated.


ready

transient boolean ready
Setting to false prevents the automated disk update. The initial value is true to prevent writing while reading and is set to false in createInstance.

Constructor Detail

PersistentHashTable

private PersistentHashTable(java.io.File file)
Use static method to obtain the instance.

Method Detail

createInstance

public static java.util.Map createInstance(java.io.File file,
                                           boolean coldStart)
Create a new persistent table that stores its information into the given file.


writeContent

public void writeContent()
Write the database content to the disk.

Specified by:
writeContent in interface Persistent

markDirty

public void markDirty()
Mark the modified database as modified. The database will be written after several seconds, unless another modification occurs.


shutdown

public void shutdown()
Save the current database state to the disk before exit.


put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Update the memory maps and mark as should be written to the disk.

Specified by:
put in interface java.util.Map

remove

public java.lang.Object remove(java.lang.Object key)
Update the memory maps and mark as should be written to the disk.

Specified by:
remove in interface java.util.Map