runWhileClosed(java.util.concurrent.Callable<T> c)
Run a task while the storage is closed.

void

runWhileClosed(java.lang.Runnable r)
Run a task while the storage is closed.

<T> T

runWhileOpen(java.util.concurrent.Callable<T> c)
Runs a task while the storage is open.

void

runWhileOpen(java.lang.Runnable r)
Runs a task while the storage is open.

Method Detail

getRelativePath

java.lang.String getRelativePath(@NotNull
java.net.URL url)

Get a path relative to this storage. This can be used to avoid storing
abosolute paths in the storage, which helps make the storage files
portable between machines. The storage must be open when this method is
called.

runWhileOpen

Runs a task while the storage is open. This takes care of opening and
closing the storage, even if the task throws an exception.

Type Parameters:

T - the type of value returned by the task

Parameters:

c - the task to run

Returns:

the return value of the task

Throws:

java.lang.Exception - if the task throws an exception

lockClosed

void lockClosed()

Locks this storage closed. This will block until the storage is not open.
The storage will not be allowed to open again until allowOpen() is
called.
Great care must be taken when calling this method to avoid deadlock. This
method should never be called while holding onto any other locks, such as
Node locks. Doing so would cause deadlock with other threads that use the
storage.

The calling thread must not call anything that requires the storage in
between the calls to lockClosed and allowOpen. Doing so
would cause deadlock.

The caller must ensure that for every call to this method, there is a
corresponding call to allowOpen(). Failure to do so would result
in the storage being locked permanently, blocking all future operations
that need to use it. Typically, a caller should use a try/finally
block to make sure that allowOpen() is always called.

This method is useful for situations where the storage file must be
deleted or replaced while JDeveloper is running.