List of usage examples for java.util.concurrent ConcurrentHashMap ConcurrentHashMap
public ConcurrentHashMap()
From source file:fr.mby.utils.common.prefs.StreamPreferences.java
/** * @param parent// www . j a v a 2 s . co m * @param name */ public StreamPreferences(final AbstractPreferences parent, final String name, final InputStream inputStream, final OutputStream outputStream) { super(parent, name); Assert.notNull(inputStream, "No InputStream provided !"); Assert.notNull(outputStream, "No OutputStream provided !"); Assert.isTrue(inputStream.markSupported(), "The provided InputStream does not support mark !"); this.inputStreamStorage = inputStream; this.outputStreamStorage = outputStream; this.prefsStorage = new ConcurrentHashMap<String, String>(); this.childrenStorage = new ConcurrentHashMap<String, AbstractPreferences>(); }
From source file:org.springframework.yarn.integration.convert.MindHolderToObjectConverter.java
/** * Instantiates a new mind holder to object converter. * * @param objectMapper the object mapper *//*from w w w.ja v a 2s. c o m*/ public MindHolderToObjectConverter(ObjectMapper objectMapper) { this.objectMapper = objectMapper; this.classCache = new ConcurrentHashMap<String, Class<? extends BaseObject>>(); }
From source file:ConcurrentHashSet.java
public ConcurrentHashSet() { super(new ConcurrentHashMap<E, Boolean>()); }
From source file:ar.com.zauber.commons.message.message.templates.MultipartMessageTemplate.java
/** * Creates the MultipartMessageTemplate. * /* w w w.java 2s . c om*/ * @param templates relates contenttypes with templates */ public MultipartMessageTemplate(final List<PartTemplate> templates, final String subject, final NotificationAddress address) { this(templates, subject, address, new ConcurrentHashMap<String, String>()); }
From source file:com.kixeye.chassis.transport.websocket.WebSocketSession.java
protected WebSocketSession(ActionInvokingWebSocket webSocket) { this.webSocket = webSocket; this.properties = new ConcurrentHashMap<>(); this.closeListeners = Collections.newSetFromMap(new ConcurrentHashMap<Runnable, Boolean>()); }
From source file:lab.mage.spring.cassandra.connector.core.TenantAwareCassandraMapperProvider.java
public TenantAwareCassandraMapperProvider(@Nonnull final Environment env, @Nonnull final Logger logger, @Nonnull final CassandraSessionProvider cassandraSessionProvider) { super();// w w w . j av a 2 s.co m Assert.notNull(env, "An environment must be given!"); Assert.notNull(logger, "A logger must be given!"); Assert.notNull(cassandraSessionProvider, "A Cassandra session provider must be given!"); this.env = env; this.logger = logger; this.cassandraSessionProvider = cassandraSessionProvider; this.managerCache = new ConcurrentHashMap<>(); }
From source file:org.jasig.portlet.proxy.search.util.SearchUtil.java
public void updateUrls(final String searchResultUrl, final PortletRequest request, String[] whitelistRegexes) { final String REWRITTEN_URLS_KEY = "rewrittenUrls"; // attempt to retrieve the list of rewritten URLs from the session final PortletSession session = request.getPortletSession(); ConcurrentMap<String, String> rewrittenUrls; synchronized (PortletUtils.getSessionMutex(session)) { rewrittenUrls = (ConcurrentMap<String, String>) session.getAttribute(REWRITTEN_URLS_KEY); // if the rewritten URLs list doesn't exist yet, create it if (rewrittenUrls == null) { rewrittenUrls = new ConcurrentHashMap<String, String>(); session.setAttribute(REWRITTEN_URLS_KEY, rewrittenUrls); }//from www . j a v a 2s . c o m } // if this URL matches our whitelist regex, rewrite it // to pass through this portlet for (String regex : whitelistRegexes) { if (StringUtils.isNotBlank(regex)) { final Pattern pattern = Pattern.compile(regex); // TODO share // compiled // regexes if (pattern.matcher(searchResultUrl).find()) { // record that we've rewritten this URL rewrittenUrls.put(searchResultUrl, searchResultUrl); log.debug("added [" + searchResultUrl + "] to rewrittenUrls"); } } } }
From source file:org.deviceconnect.message.event.AbstractEventManager.java
/** * EventManager??. */ public AbstractEventManager() { mHandlers = new ConcurrentHashMap<String, EventHandler>(); }
From source file:com.yahoo.flowetl.services.db.CachingDatabaseService.java
/** * Instantiates a new caching database service. *//*from www .j a va 2 s.c o m*/ public CachingDatabaseService() { super(); this.conCache = new ConcurrentHashMap<String, DataSource>(); }
From source file:com.clustercontrol.monitor.util.ScopeSearchRunUtil.java
@SuppressWarnings("unchecked") public ArrayList<ArrayList<Object>> searchInfo(List<String> managerList) { ArrayList<ArrayList<Object>> dispList = new ArrayList<ArrayList<Object>>(); Map<String, String> errMsgs = new ConcurrentHashMap<>(); long start = System.currentTimeMillis(); try {//from ww w . ja v a2 s.co m String threadName = Thread.currentThread().getName() + "-ScopeSearch"; List<RepositorySearchTask> searchList = new ArrayList<RepositorySearchTask>(); for (String managerName : managerList) { RepositorySearchTask task = null; task = new RepositorySearchTask(threadName, managerName, ContextProvider.getContext()); searchList.add(task); } List<Future<Map<String, List<?>>>> retList = getExecutorService().invokeAll(searchList); for (Future<Map<String, List<?>>> future : retList) { 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); for (ArrayList<Object> l : infoList) { dispList.add(l); } } if (ret.get(POS_ERROR) != null && ret.get(POS_ERROR) instanceof String) { errMsgs.put(managerName, (String) ret.get(POS_ERROR)); } } } } catch (InterruptedException e) { m_log.error(e.getMessage()); } catch (ExecutionException e) { m_log.error(e.getMessage()); } // if (0 < errMsgs.size()) { UIManager.showMessageBox(errMsgs, true); } long end = System.currentTimeMillis(); m_log.debug("time=" + (end - start)); return dispList; }