List of usage examples for java.util.concurrent ConcurrentMap size
int size();
From source file:com.bt.aloha.dialog.StaleDialogChecker.java
protected void initialize() { log.debug("initialize()"); ConcurrentMap<String, DialogInfo> allDialogs = dialogCollection.getAll(); log.debug(String.format("Initialising StaleDialogChecker with %s dialogs", allDialogs.size())); for (ReadOnlyDialogInfo dialogInfo : allDialogs.values()) if (dialogInfo.getDialogState().equals(DialogState.Confirmed)) pingCallLeg(dialogInfo);/*from www . j a v a2 s .c om*/ }
From source file:com.bt.aloha.media.convedia.conference.MaxConferenceDurationTermination.java
public void initialize() { log.debug("initialize()"); //TODO: replace getAll() ConcurrentMap<String, ConferenceInfo> allConferenceCalls = conferenceCollection.getAll(); log.debug(String.format("Initialising with %s conference calls", allConferenceCalls.size())); for (ConferenceInfo conferenceInfo : allConferenceCalls.values()) if (conferenceInfo.getConferenceState().equals(ConferenceState.Active) && conferenceInfo.getMaxDurationInMinutes() > 0) setTerminationTime(conferenceInfo); }
From source file:com.bt.aloha.call.MaxCallDurationTermination.java
protected void initialize() { log.debug("initialize() runOnStartup = " + runOnStartup); if (runOnStartup) { ConcurrentMap<String, CallInfo> calls = callCollection.getAllConnectedCallsWithMaxDuration(); log.debug(//from www. jav a 2 s.c o m String.format("Initialising MaxCallDurationTermination object with %s call(s)", calls.size())); for (ReadOnlyCallInfo callInfo : calls.values()) setTerminationTime(callInfo); } }
From source file:de.hybris.platform.cache.CachePerformanceTest.java
@Test public void testConcurrentLinkedHashMap() { final ConcurrentMap<String, Object> chMap = new ConcurrentLinkedHashMap.Builder<String, Object>() .maximumWeightedCapacity(FILL).concurrencyLevel(8).initialCapacity(FILL).build(); fillCacheMap(chMap, FILL);/*w w w . j ava 2 s . c om*/ assertEquals(FILL, chMap.size()); writeResultTable("ConcurrentLinkedHashMap", 100, FILL, TOTALHITS, THREADS, executeMultithreadedCacheAccess(chMap, FILL, true, THREADS, TOTALHITS, MAX_WAIT_SECONDS)); writeResultTable("ConcurrentLinkedHashMap", 0, FILL, TOTALHITS, THREADS, executeMultithreadedCacheAccess(chMap, FILL, false, THREADS, TOTALHITS, MAX_WAIT_SECONDS)); }
From source file:com.bt.aloha.dao.StateInfoDaoTest.java
@Test public void testGetAll() throws Exception { // setup// ww w.ja va2s. c o m stateInfoDao.add(dialogInfo, collectionType); stateInfoDao.add(dialogInfo2, collectionType); // act ConcurrentMap<String, DialogInfo> result = stateInfoDao.getAll(collectionType); // assert assertEquals(2, result.size()); assertNotNull(result.get(dialogInfo.getId())); assertNotNull(result.get(dialogInfo2.getId())); }
From source file:com.flexive.war.beans.admin.main.LockBean.java
/** * Synchronizes the list of results with the marked Ids (GUI) *//*from w ww. java 2 s .c om*/ private void synchMarkedMap() { if (results == null) { markedLocks = new ConcurrentHashMap<FxPK, Boolean>(0); return; } ConcurrentMap<FxPK, Boolean> tmp = new ConcurrentHashMap<FxPK, Boolean>(results.size()); for (FxLock l : results) { final FxPK resultPK = l.getLockedPK(); if (markedLocks.containsKey(resultPK)) tmp.put(resultPK, markedLocks.get(resultPK)); else tmp.put(resultPK, false); } markedLocks = new ConcurrentHashMap<FxPK, Boolean>(tmp.size()); markedLocks.putAll(tmp); }
From source file:com.googlecode.concurrentlinkedhashmap.ConcurrentMapTest.java
@Test(dataProvider = "guardedMap") public void replace_whenPopulated(ConcurrentMap<Integer, Integer> map) { map.put(1, 2);/* w ww .j av a 2 s . co m*/ assertThat(map.replace(1, 3), is(2)); assertThat(map.get(1), is(3)); assertThat(map.size(), is(1)); }
From source file:com.cubeia.firebase.server.lobby.systemstate.StateLobby.java
public int getSnapshotNodeCount() { int count = 0; for (SnapshotGenerator generator : generators.values()) { ConcurrentMap<LobbyPath, FullSnapshot> snapshots = generator.getFullSnapshots(); count += snapshots.size(); }/* w w w .j a v a 2 s .com*/ return count; }
From source file:com.cubeia.firebase.server.lobby.systemstate.StateLobby.java
public int getDeltaSnapshotNodeCount() { int count = 0; for (SnapshotGenerator generator : generators.values()) { ConcurrentMap<LobbyPath, DeltaSnapshot> snapshots = generator.getDeltaSnapshots(); count += snapshots.size(); }//from w w w . j av a 2s . c o m return count; }
From source file:com.googlecode.concurrentlinkedhashmap.ConcurrentMapTest.java
@Test(dataProvider = "guardedMap") public void replaceConditionally_whenPopulated(ConcurrentMap<Integer, Integer> map) { map.put(1, 2);/* w ww . j a v a 2s . co m*/ assertThat(map.replace(1, 3, 4), is(false)); assertThat(map.replace(1, 2, 3), is(true)); assertThat(map.get(1), is(3)); assertThat(map.size(), is(1)); }