Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.0.0

E15725-01


com.tangosol.util
Class ConverterCollections.ConverterConcurrentMap

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.ConverterCollections.ConverterMap
          extended by com.tangosol.util.ConverterCollections.ConverterConcurrentMap

All Implemented Interfaces:
ConcurrentMap, Serializable, Map
Enclosing class:
ConverterCollections

public static class ConverterCollections.ConverterConcurrentMap
extends ConverterCollections.ConverterMap
implements ConcurrentMap, Serializable

A Converter ConcurrentMap views an underlying ConcurrentMap through a set of key and value Converters.


Nested Class Summary

 

Nested classes/interfaces inherited from interface java.util.Map
Map.Entry

 

Field Summary

 

Fields inherited from class com.tangosol.util.ConverterCollections.ConverterMap
m_convKeyDown, m_convKeyUp, m_convValDown, m_convValUp, m_map, m_set

 

Fields inherited from interface com.tangosol.util.ConcurrentMap
LOCK_ALL

 

Constructor Summary
ConverterCollections.ConverterConcurrentMap(ConcurrentMap map, Converter convKeyUp, Converter convKeyDown, Converter convValUp, Converter convValDown)
          Constructor.

 

Method Summary
 ConcurrentMap getConcurrentMap()
          Return the underlying ConcurrentMap.
 boolean lock(Object oKey)
          Attempt to lock the specified item and return immediately.
 boolean lock(Object oKey, long cWait)
          Attempt to lock the specified item within the specified period of time.
 boolean unlock(Object oKey)
          Unlock the specified item.

 

Methods inherited from class com.tangosol.util.ConverterCollections.ConverterMap
clear, containsKey, containsValue, entrySet, get, getConverterKeyDown, getConverterKeyUp, getConverterValueDown, getConverterValueUp, getMap, instantiateCollection, instantiateEntrySet, instantiateMap, instantiateSet, isEmpty, keySet, put, putAll, remove, size, toString, values

 

Methods inherited from interface com.tangosol.util.ConcurrentMap
clear, containsKey, containsValue, get, isEmpty, put, putAll, remove, size

 

Methods inherited from interface java.util.Map
entrySet, equals, hashCode, keySet, values

 

Constructor Detail

ConverterCollections.ConverterConcurrentMap

public ConverterCollections.ConverterConcurrentMap(ConcurrentMap map,
                                                   Converter convKeyUp,
                                                   Converter convKeyDown,
                                                   Converter convValUp,
                                                   Converter convValDown)
Constructor.
Parameters:
map - the underlying ConcurrentMap
convKeyUp - the Converter to view the underlying ConcurrentMap's keys through
convKeyDown - the Converter to use to pass keys down to the underlying ConcurrentMap
convValUp - the Converter to view the underlying ConcurrentMap's values through
convValDown - the Converter to use to pass values down to the underlying ConcurrentMap

Method Detail

lock

public boolean lock(Object oKey)
Attempt to lock the specified item and return immediately.

This method behaves exactly as if it simply performs the call lock(oKey, 0).

Specified by:
lock in interface ConcurrentMap
Parameters:
oKey - key being locked
Returns:
true if the item was successfully locked; false otherwise

lock

public boolean lock(Object oKey,
                    long cWait)
Attempt to lock the specified item within the specified period of time.

The item doesn't have to exist to be locked. While the item is locked there is known to be a lock holder which has an exclusive right to modify (calling put and remove methods) that item.

Lock holder is an abstract concept that depends on the ConcurrentMap implementation. For example, holder could be a cluster member or a thread (or both).

Locking strategy may vary for concrete implementations as well. Lock could have an expiration time (this lock is sometimes called a "lease") or be held indefinitely (until the lock holder terminates).

Some implementations may allow the entire map to be locked. If the map is locked in such a way, then only a lock holder is allowed to perform any of the "put" or "remove" operations. Pass the special constant ConcurrentMap.LOCK_ALL as the oKey parameter to indicate the map lock.

Specified by:
lock in interface ConcurrentMap
Parameters:
oKey - key being locked
cWait - the number of milliseconds to continue trying to obtain a lock; pass zero to return immediately; pass -1 to block the calling thread until the lock could be obtained
Returns:
true if the item was successfully locked within the specified time; false otherwise

unlock

public boolean unlock(Object oKey)
Unlock the specified item. The item doesn't have to exist to be unlocked. If the item is currently locked, only the holder of the lock could successfully unlock it.
Specified by:
unlock in interface ConcurrentMap
Parameters:
oKey - key being unlocked
Returns:
true if the item was successfully unlocked; false otherwise

getConcurrentMap

public ConcurrentMap getConcurrentMap()
Return the underlying ConcurrentMap.
Returns:
the underlying ConcurrentMap

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.0.0

E15725-01


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