Example usage for java.util.concurrent ConcurrentHashMap remove

List of usage examples for java.util.concurrent ConcurrentHashMap remove

Introduction

In this page you can find the example usage for java.util.concurrent ConcurrentHashMap remove.

Prototype

public V remove(Object key) 

Source Link

Document

Removes the key (and its corresponding value) from this map.

Usage

From source file:com.clustercontrol.repository.factory.NodeProperty.java

public static void removeNode(String facilityId) {
    m_log.info("remove NodeCache : " + facilityId);

    try {/*ww w.  jav  a 2s  .c  o  m*/
        _lock.writeLock();

        ConcurrentHashMap<String, NodeInfo> cache = getCache();
        cache.remove(facilityId);
        storeCache(cache);
    } finally {
        _lock.writeUnlock();
    }
}

From source file:Main.java

public static <T1, T2> void removeHashMapElementByHash(ConcurrentHashMap<T1, T2> target, int hashcode) {
    Iterator<T1> iter = target.keySet().iterator();
    Object key = null;/*from  w  w w .j a v a2 s  .  c o  m*/
    while (iter.hasNext()) {
        key = iter.next();
        if (key.hashCode() == hashcode) {
            target.remove(key);
        }
    }
}

From source file:com.clustercontrol.repository.factory.NodeProperty.java

public static void updateNode(String facilityId) {
    m_log.info("update NodeCache : " + facilityId);

    try {//from  w  w w.  ja  v  a  2 s .  co m
        _lock.writeLock();

        ConcurrentHashMap<String, NodeInfo> cache = getCache();
        try {
            new JpaTransactionManager().getEntityManager().clear();
            NodeInfo facilityEntity = QueryUtil.getNodePK(facilityId);
            cache.put(facilityId, facilityEntity);
        } catch (Exception e) {
            m_log.warn("update NodeCache failed : " + e.getMessage());
            //??????????
            cache.remove(facilityId);
        }
        storeCache(cache);
    } finally {
        _lock.writeUnlock();
    }
}

From source file:org.exoplatform.addons.lecko.social.rest.api.EntityBuilder.java

private static void updateCachedEtagValue(int etagValue) {
    ApplicationContext ac = ApplicationContextImpl.getCurrent();
    Map<String, String> properties = ac.getProperties();
    ConcurrentHashMap<String, String> props = new ConcurrentHashMap<String, String>(properties);

    if (props.containsKey(RestProperties.ETAG)) {
        props.remove(RestProperties.ETAG);
    }//from   w  w w.j a  va2s .com

    if (props.containsKey(RestProperties.UPDATE_DATE)) {
        props.remove(RestProperties.UPDATE_DATE);
    }

    ac.setProperty(RestProperties.ETAG, String.valueOf(etagValue));
    ApplicationContextImpl.setCurrent(ac);
}

From source file:org.exoplatform.addons.lecko.social.rest.api.EntityBuilder.java

private static void updateCachedLastModifiedValue(Date lastModifiedDate) {
    ApplicationContext ac = ApplicationContextImpl.getCurrent();
    Map<String, String> properties = ac.getProperties();
    ConcurrentHashMap<String, String> props = new ConcurrentHashMap<String, String>(properties);

    if (props.containsKey(RestProperties.UPDATE_DATE)) {
        props.remove(RestProperties.UPDATE_DATE);
    }/*from   w  w w .j a  v a2 s .co  m*/

    if (props.containsKey(RestProperties.ETAG)) {
        props.remove(RestProperties.ETAG);
    }

    ac.setProperty(RestProperties.UPDATE_DATE, String.valueOf(lastModifiedDate.getTime()));
    ApplicationContextImpl.setCurrent(ac);
}

From source file:org.apache.niolex.config.event.ConfigEventDispatcher.java

/**
 * Remove the specified event listener.//  w  ww.  j ava  2 s  . com
 * @param groupName
 * @param listener
 */
public void removeListener(String groupName, IPacketWriter listener) {
    ConcurrentHashMap<IPacketWriter, String> queue = clients.get(groupName);
    if (queue != null) {
        queue.remove(listener);
    }
}

From source file:org.mule.util.queue.FilePersistenceQueue.java

public File peekFromMessageMap(String queue, String id) {
    ConcurrentHashMap<String, File> messageMap = queueMap.get(queue);
    if (messageMap == null) {
        return null;
    }// ww w .j a v  a2  s  . c  o m
    File f = messageMap.get(id);
    if (f != null) {
        messageMap.remove(id);
    }
    return f;
}

From source file:org.wso2.carbon.websocket.transport.WebsocketConnectionFactory.java

public void removeChannelHandler(String sourceIdentifier, String clientIdentifier) {
    ConcurrentHashMap<String, WebSocketClientHandler> handlerMap = channelHandlerPool.get(sourceIdentifier);
    handlerMap.remove(clientIdentifier);
}

From source file:codetoanalyze.java.checkers.ContainerWrapper.java

void accessToSychronizedMapsOk(String key, ConcurrentMap<String, String> concurrentMap,
        ConcurrentHashMap<String, String> concurrentHashMap) {

    concurrentMap.remove(key);//w  w  w . j a v  a2  s.c o m
    concurrentHashMap.remove(key);
}

From source file:com.vmware.identity.idm.server.RsaAuthSessionCache.java

public AuthenticationSession removeSession(String tenantName, String cachedSessionId) {
    ConcurrentHashMap<String, AuthenticationSession> sessionCache = _rsaSessionCacheLookup
            .get(tenantName.toLowerCase());

    if (sessionCache == null) {
        return null;
    }// w  w w .j  ava  2s  .  c  o m

    logger.debug("Removed cached RSA session. sessionID: " + cachedSessionId);

    return sessionCache.remove(cachedSessionId);
}