Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.1.0 E18814-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.net.cache
Class ReadWriteBackingMap.ReadLatch

`java.lang.Object
com.tangosol.net.cache.ReadWriteBackingMap.ReadLatch`

Enclosing class:
  ReadWriteBackingMap

      protected class ReadWriteBackingMap.ReadLatch

extends java.lang.Object

A synchronization construct used to coordinate asynchronous loads by the refresh-ahead thread with cache accesses by other threads.

The refresh-ahead thread places a new `ReadLatch` in the control map before performing a load operation on the cache store. The presence of the latch signals to a thread executing the `ReadWriteBackingMap.get(java.lang.Object)` method that an asynchronous load is in progress. This thread can then wait on the latch to get the results of the asynchronous load. This thread is then responsible for removing the latch from the control map. Additionally, a thread performing a `ReadWriteBackingMap.put(java.lang.Object, java.lang.Object)` or `ReadWriteBackingMap.remove(java.lang.Object)` operation can cancel an ongoing asynchronous load using the latch. This thread is also responsible for removing the latch from the control map.

Author:
  jh 2005.02.11

Constructor Summary
`protected` | `ReadWriteBackingMap.ReadLatch(java.lang.Object oKey)` Create a new `ReadLatch` for the specified key.

Method Summary
`void` | `cancel()` Cancel the load operation.
`void` | `cancel(java.lang.Throwable t)` Cancel the load operation due to an exception.
`void` | `complete(java.lang.Object oValue)` Complete the load operation.
`java.lang.Object` | `getKey()` Return the key that is being loaded by the refresh-ahead thread.
`java.lang.Object` | `getValue()` Return the result of the load operation.
`boolean` | `isCanceled()` Return `true` if the load operation has been canceled.
`boolean` | `isComplete()` Return `true` if the load operation is complete.

Constructor Detail

### ReadWriteBackingMap.ReadLatch

    protected ReadWriteBackingMap.ReadLatch(java.lang.Object oKey)

  Create a new `ReadLatch` for the specified key.
  Parameters:
    `oKey` - the key that is being loaded by the refresh-ahead thread

Method Detail

### cancel

    public void cancel()

  Cancel the load operation. This method has no effect if the operation has already been completed or canceled.

### cancel

    public void cancel(java.lang.Throwable t)

  Cancel the load operation due to an exception. This method has no effect if the operation has already been completed or canceled.

### complete

    public void complete(java.lang.Object oValue)

  Complete the load operation. The specified value and entry is the result of the load operation. This method has no effect if the operation has already been completed or canceled.
  Parameters:
    `oValue` - the result of the load operation

### isComplete

    public boolean isComplete()

  Return `true` if the load operation is complete. The results of the load operation can be retrieved using the `getValue()` method.
  Returns:
    `true` if the load operation is complete

### isCanceled

    public boolean isCanceled()

  Return `true` if the load operation has been canceled.
  Returns:
    `true` if the load operation has been canceled

### getKey

    public java.lang.Object getKey()

  Return the key that is being loaded by the refresh-ahead thread.
  Returns:
    the key that is being loaded

### getValue

    public java.lang.Object getValue()

  Return the result of the load operation. Note: this method should not be called by the refresh-ahead daemon thread
  Returns:
    the result of the load operation

Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.1.0 E18814-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.