List of usage examples for java.util.concurrent ConcurrentHashMap ConcurrentHashMap
public ConcurrentHashMap()
From source file:ConcurrentHashSet.java
public ConcurrentHashSet(Collection<E> c) { super(new ConcurrentHashMap<E, Boolean>(), c); }
From source file:cn.isif.util_plus.util.PreferencesCookieStore.java
/** * Construct a persistent cookie store./*from www . j ava 2 s.c o m*/ */ public PreferencesCookieStore(Context context) { cookiePrefs = context.getSharedPreferences(COOKIE_PREFS, Context.MODE_PRIVATE); cookies = new ConcurrentHashMap<String, Cookie>(); // Load any previously stored cookies into the store String storedCookieNames = cookiePrefs.getString(COOKIE_NAME_STORE, null); if (storedCookieNames != null) { String[] cookieNames = TextUtils.split(storedCookieNames, ","); for (String name : cookieNames) { String encodedCookie = cookiePrefs.getString(COOKIE_NAME_PREFIX + name, null); if (encodedCookie != null) { Cookie decodedCookie = decodeCookie(encodedCookie); if (decodedCookie != null) { cookies.put(name, decodedCookie); } } } // Clear out expired cookies clearExpired(new Date()); } }
From source file:com.superman.droidokhttp.core.RequestParams.java
private void init() { headerMap = new ConcurrentHashMap<String, String>(); urlParams = new ConcurrentHashMap<String, String>(); fileParams = new ConcurrentHashMap<String, FileWrapper>(); byteParams = new ConcurrentHashMap<String, byte[]>(); headerMap.put("charset", "UTF-8"); //?/* www .j a v a2 s .c o m*/ Map<String, String> commonParams = DroidOkHttpManager.getOkHttpFinal().getCommonParams(); if (commonParams != null && commonParams.size() > 0) { urlParams.putAll(commonParams); } //header Map<String, String> commonHeader = DroidOkHttpManager.getOkHttpFinal().getCommonHeaderMap(); if (commonHeader != null && commonHeader.size() > 0) { headerMap.putAll(commonHeader); } if (httpCycleContext != null) { httpTaskKey = httpCycleContext.getHttpTaskKey(); } }
From source file:org.apache.niolex.config.event.ConfigEventDispatcher.java
/** * Add an event listener who care this event. * @param groupName//from w ww . ja v a 2s .c om * @param listener */ public void addListener(String groupName, IPacketWriter listener) { ConcurrentHashMap<IPacketWriter, String> queue = clients.get(groupName); if (queue == null) { queue = new ConcurrentHashMap<IPacketWriter, String>(); ConcurrentHashMap<IPacketWriter, String> tmp = clients.putIfAbsent(groupName, queue); if (tmp != null) { queue = tmp; } } queue.put(listener, ""); }
From source file:com.ushahidi.swiftriver.core.dropqueue.DropHandlerTest.java
@Before public void setup() { mockAmqpTemplate = mock(AmqpTemplate.class); dropsMap = new HashMap<String, RawDrop>(); mockCallbackQueue = mock(Queue.class); deliveryFramesMap = new ConcurrentHashMap<String, DeliveryFrame>(); dropHandler = new DropHandler(); dropHandler.setAmqpTemplate(mockAmqpTemplate); dropHandler.setCallbackQueue(mockCallbackQueue); dropHandler.setDropsMap(dropsMap);//from w ww. j a va2 s .co m dropHandler.setObjectMapper(objectMapper); dropHandler.setDeliveryFramesMap(deliveryFramesMap); }
From source file:org.schedoscope.metascope.service.MetascopeDataDistributionService.java
public MetascopeDataDistributionService() { this.runningJobs = new ConcurrentHashMap<String, Boolean>(); }
From source file:com.playhaven.android.diagnostic.test.PHTestCase.java
public PHTestCase(Class<ACTIVITY> activityClass) { super(activityClass); this.activityClass = activityClass; latches = new ConcurrentHashMap<String, CountDownLatch>(); }
From source file:com.fheebiy.http.lite.apache.StandardHttpRequestRetryHandler.java
/** * Default constructor//from w ww.ja v a2 s .co m */ public StandardHttpRequestRetryHandler(final int retryCount, final boolean requestSentRetryEnabled) { super(retryCount, requestSentRetryEnabled); this.idempotentMethods = new ConcurrentHashMap<String, Boolean>(); this.idempotentMethods.put("GET", Boolean.TRUE); this.idempotentMethods.put("HEAD", Boolean.TRUE); this.idempotentMethods.put("PUT", Boolean.TRUE); this.idempotentMethods.put("DELETE", Boolean.TRUE); this.idempotentMethods.put("OPTIONS", Boolean.TRUE); this.idempotentMethods.put("TRACE", Boolean.TRUE); }
From source file:com.clustercontrol.monitor.util.StatusSearchRunUtil.java
@SuppressWarnings("unchecked") public Map<String, ArrayList<ArrayList<Object>>> searchInfo(List<String> managerList, String facilityId, StatusFilterInfo filter) {/*from w w w.j a va 2 s.co m*/ Map<String, ArrayList<ArrayList<Object>>> dispDataMap = new ConcurrentHashMap<>(); Map<String, String> errMsgs = new ConcurrentHashMap<>(); long start = System.currentTimeMillis(); try { String threadName = Thread.currentThread().getName() + "-StatusSearch"; List<StatusSearchTask> searchList = new ArrayList<StatusSearchTask>(); for (String managerName : managerList) { StatusSearchTask task = null; task = new StatusSearchTask(threadName, managerName, facilityId, filter, ContextProvider.getContext()); searchList.add(task); } List<Future<Map<String, List<?>>>> list = getExecutorService().invokeAll(searchList); for (Future<Map<String, List<?>>> future : list) { if (future == null || future.get() == null) { continue; } Map<String, List<?>> map = future.get(); for (Map.Entry<String, List<?>> entry : map.entrySet()) { //?1?? String managerName = entry.getKey(); List<?> ret = entry.getValue(); if (ret.get(POS_INFO) != null && ret.get(POS_INFO) instanceof ArrayList) { ArrayList<ArrayList<Object>> infoList = (ArrayList<ArrayList<Object>>) ret.get(POS_INFO); dispDataMap.put(managerName, infoList); } if (ret.get(POS_ERROR) != null && ret.get(POS_ERROR) instanceof String) { String errList = (String) ret.get(POS_ERROR); errMsgs.put(managerName, errList); } } } } catch (InterruptedException e) { m_log.error(e.getMessage() + e.getClass().getName()); } catch (ExecutionException e) { m_log.error(e.getMessage() + e.getClass().getName()); } // if (0 < errMsgs.size()) { UIManager.showMessageBox(errMsgs, true); } long end = System.currentTimeMillis(); m_log.debug("time=" + (end - start)); return dispDataMap; }
From source file:com.couchbase.lite.support.PersistentCookieStore.java
/** * Construct a persistent cookie store.// w w w .j a v a 2s . c o m */ public PersistentCookieStore(Database db) { this.dbWeakRef = new WeakReference<Database>(db); cookies = new ConcurrentHashMap(); // Load any previously stored cookies into the store loadPreviouslyStoredCookies(db); // Clear out expired cookies clearExpired(new Date()); }