Class ConverterCollections.ConverterConcurrentMap<FK,​TK,​FV,​TV>

    • Constructor Detail

      • ConverterConcurrentMap

        public ConverterConcurrentMap​(ConcurrentMap<FK,​FV> map,
                                      Converter<FK,​TK> convKeyUp,
                                      Converter<TK,​FK> convKeyDown,
                                      Converter<FV,​TV> convValUp,
                                      Converter<TV,​FV> 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<FK,​TK>
        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<FK,​TK>
        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<FK,​TK>
        Parameters:
        oKey - key being unlocked
        Returns:
        true if the item was successfully unlocked; false otherwise
      • getConcurrentMap

        public ConcurrentMap<FK,​FV> getConcurrentMap()
        Return the underlying ConcurrentMap.
        Returns:
        the underlying ConcurrentMap