FileDocCategorySizeDatePackage
LockingStore.javaAPI DocGlassfish v2 API4165Fri May 04 22:33:32 BST 2007com.sun.enterprise.admin.common.domains.registry

LockingStore

public interface LockingStore
Implementors of this interface represent a store which can be locked and which will store and retrieve a single data object
author
Toby H Ferguson
version
1.0

Fields Summary
Constructors Summary
Methods Summary
public longlastModified()
get the last time this store was modified

return
the time that this store was last modified, as per {@link java.io.File#lastModified()}

public voidlock()
lock the store.

precondition - true

postcondition - the store is locked

throws
IOException if there was a problem initializing the store
throws
TimeoutException if there was a problem obtaining a lock in a reasonable amount of time

public java.lang.ObjectreadObject()
Read the object from the store.

precondition - true

postcondition - store has not been modified

return
the single object that was in the store (or null if the store is empty)
throws
TimeoutException if a lock on the store couldn't be obtained in a reasonable time.
throws
IOException if there was a problem reading from the store
throws
ClassNotFoundException if the object could not be restored from the store

public voidunlock()
unlock the store.

precondition - store is not locked, or the store has been locked by the caller.

postcondition - store is closed and all resources released

public voidwriteObject(java.lang.Object o)
Write the given object to the store via serialization.

Precondition - store is locked

Postcondition - store contains this object, and only this object.

param
o the object to be put into the store. Must implement {@link Serializable}
throws
IOException if there was a problem writing to the store. Store will no longer be locked.
throws
IllegalStateException if the store is not locked. Store will no longer be locked.