Package java.util.concurrent

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


public class ConcurrentTest extends AbstractTest {

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

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

    assertNotNull("testConcurrent", map);
  }

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

                                                        .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

                                                        .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

            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

     * @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

     * @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

    /**
     * Return a string naming the threads which currently hold this lock.
     */
    protected String getCurrentLockHolderNames(File file) {
        StringBuilder sb = new StringBuilder();
        ConcurrentHashMap m = (ConcurrentHashMap) currentLockHolders.get(file);
        if (m == null) {
            return "(NULL)";
        }
        Enumeration threads = m.keys();
        while (threads.hasMoreElements()) {
            Thread t = (Thread) threads.nextElement();
            sb.append(t.toString());
            if (threads.hasMoreElements()) {
                sb.append(", ");
View Full Code Here

        {
            // test by type lookup with the 'optional' flag set to false
            try
            {
                // guess we can safely assume that there is no producer for a ConcurrentHashMap in the system...
                ConcurrentHashMap chm = BeanProvider.getContextualReference(ConcurrentHashMap.class);
                Assert.fail("BeanProvider#getContextualReference should have blown up with a non-existing bean!");
            }
            catch(IllegalStateException ise)
            {
                // all is well, this is exactly what should happen!
View Full Code Here

TOP

Related Classes of java.util.concurrent.ConcurrentHashMap

Copyright © 2018 www.massapicom. 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.