Examples of ConcurrentHashMap


Examples of java.util.concurrent.ConcurrentHashMap

    return Boolean.valueOf(monitor_nodes(caller, on, opts));
  }

  public static boolean monitor_nodes(EHandle caller, boolean on, int opts) {
    if (on) nodes_monitors.putIfAbsent(caller, new ConcurrentHashMap());
    ConcurrentHashMap<Integer,AtomicInteger> forHandle = nodes_monitors.get(caller);
    if (forHandle==null) return false; // We're disabling but entry wasn't there.

    if (on) {
      forHandle.putIfAbsent(opts, new AtomicInteger(0));
View Full Code Here

Examples of java.util.concurrent.ConcurrentHashMap

public class ConcurrentTest extends AbstractTest {

  public void testConcurrent() {
    // Should not generate a warning
    ConcurrentHashMap map = new ConcurrentHashMap();

    assertNotNull("testConcurrent", map);
  }
View Full Code Here

Examples of java.util.concurrent.ConcurrentHashMap

    assertNotNull("testConcurrent", map);
  }

  public void testConcurrentClassLiteral() {
    ConcurrentHashMap map = new ConcurrentHashMap();
    assertEquals("testConcurrentClassLiteral ConcurrentHashMap", ConcurrentHashMap.class, map.getClass());
  }
View Full Code Here

Examples of java.util.concurrent.ConcurrentHashMap

public class ConcurrentTest extends AbstractTest {

  public void testConcurrent() {
    // Should not generate a warning
    ConcurrentHashMap map = new ConcurrentHashMap();

    assertNotNull("testConcurrent", map);
  }
View Full Code Here

Examples of java.util.concurrent.ConcurrentHashMap

    assertNotNull("testConcurrent", map);
  }

  public void testConcurrentClassLiteral() {
    ConcurrentHashMap map = new ConcurrentHashMap();
    assertEquals("testConcurrentClassLiteral ConcurrentHashMap", ConcurrentHashMap.class, map.getClass());
  }
View Full Code Here

Examples of java.util.concurrent.ConcurrentHashMap

                                                        .getProperty(WSDLQueryHandler.class.getName()
                                                                     + ".Schemas"));

            if (mp == null) {
                endpointInfo.getService().setProperty(WSDLQueryHandler.class.getName(),
                                                      new ConcurrentHashMap());
                mp = CastUtils.cast((Map)endpointInfo.getService()
                                    .getProperty(WSDLQueryHandler.class.getName()));
            }
            if (smp == null) {
                endpointInfo.getService().setProperty(WSDLQueryHandler.class.getName()
                                                      + ".Schemas",
                                                      new ConcurrentHashMap());
                smp = CastUtils.cast((Map)endpointInfo.getService()
                                    .getProperty(WSDLQueryHandler.class.getName()
                                                 + ".Schemas"));
            }
           
View Full Code Here

Examples of java.util.concurrent.ConcurrentHashMap

                                                        .getProperty(WSDLQueryHandler.class.getName()
                                                                     + ".Schemas"));

            if (mp == null) {
                endpointInfo.getService().setProperty(WSDLQueryHandler.class.getName(),
                                                      new ConcurrentHashMap());
                mp = CastUtils.cast((Map)endpointInfo.getService()
                                    .getProperty(WSDLQueryHandler.class.getName()));
            }
            if (smp == null) {
                endpointInfo.getService().setProperty(WSDLQueryHandler.class.getName()
                                                      + ".Schemas",
                                                      new ConcurrentHashMap());
                smp = CastUtils.cast((Map)endpointInfo.getService()
                                    .getProperty(WSDLQueryHandler.class.getName()
                                                 + ".Schemas"));
            }
           
View Full Code Here

Examples of java.util.concurrent.ConcurrentHashMap

            bv = ((OpenJPAConfigurationImpl) _conf).brokerPlugin;
        else
            bv = (BrokerValue) _conf.getValue(BrokerValue.KEY);

        if (FinalizingBrokerImpl.class.isAssignableFrom(bv.getTemplateBrokerType(_conf))) {
            return MapBackedSet.decorate(new ConcurrentHashMap(), new Object() { });
        } else {
            return new ConcurrentReferenceHashSet<Broker>(ConcurrentReferenceHashSet.WEAK);
        }
    }
View Full Code Here

Examples of java.util.concurrent.ConcurrentHashMap

     * @return number of times this thread has grabbed the lock
     */
    private int incrementLock(File file, Thread forThread) {
        Map locksPerThread = (Map) currentLockHolders.get(file);
        if (locksPerThread == null) {
            locksPerThread = new ConcurrentHashMap();
            currentLockHolders.put(file, locksPerThread);
        }
        Integer c = (Integer) locksPerThread.get(forThread);
        int holdLocks = c == null ? 1 : c.intValue() + 1;
        locksPerThread.put(forThread, new Integer(holdLocks));
View Full Code Here

Examples of java.util.concurrent.ConcurrentHashMap

     * @param forThread
     *            thread for which lock depth is being decreased
     * @return remaining depth of this lock
     */
    private int decrementLock(File file, Thread forThread) {
        ConcurrentHashMap locksPerThread = (ConcurrentHashMap) currentLockHolders.get(file);
        if (locksPerThread == null) {
            throw new RuntimeException("Calling decrementLock on a thread which holds no locks");
        }
        Integer c = (Integer) locksPerThread.get(forThread);
        int oldHeldLocks = c == null ? 0 : c.intValue();
        if (oldHeldLocks <= 0) {
            throw new RuntimeException("Calling decrementLock on a thread which holds no locks");
        }
        int newHeldLocks = oldHeldLocks - 1;
        if (newHeldLocks > 0) {
            locksPerThread.put(forThread, new Integer(newHeldLocks));
        } else {
            locksPerThread.remove(forThread);
        }
        return newHeldLocks;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.