List of usage examples for java.util.concurrent ConcurrentHashMap ConcurrentHashMap
public ConcurrentHashMap()
From source file:com.mnt.base.stream.comm.PacketProcessorManager.java
private void initProcessorMap() { packetProcessorMap = new ConcurrentHashMap<String, PacketProcessor>(); }
From source file:com.amazonaws.services.iot.client.shadow.AbstractAwsIotDevice.java
protected AbstractAwsIotDevice(String thingName) { this.thingName = thingName; reportedProperties = getDeviceProperties(true, false); updatableProperties = getDeviceProperties(false, true); commandManager = new AwsIotDeviceCommandManager(this); deviceSubscriptions = new ConcurrentHashMap<>(); for (String topic : getDeviceTopics()) { deviceSubscriptions.put(topic, false); }/*from ww w . j a v a2s . c om*/ jsonObjectMapper = new ObjectMapper(); SimpleModule module = new SimpleModule(); module.addSerializer(AbstractAwsIotDevice.class, new AwsIotJsonSerializer()); jsonObjectMapper.registerModule(module); localVersion = new AtomicLong(-1); }
From source file:com.sa.npopa.samples.hbase.rest.client.Client.java
private void initialize(Cluster cluster, boolean sslEnabled) { this.cluster = cluster; this.sslEnabled = sslEnabled; MultiThreadedHttpConnectionManager manager = new MultiThreadedHttpConnectionManager(); HttpConnectionManagerParams managerParams = manager.getParams(); managerParams.setConnectionTimeout(2000); // 2 s managerParams.setDefaultMaxConnectionsPerHost(10); managerParams.setMaxTotalConnections(100); extraHeaders = new ConcurrentHashMap<String, String>(); this.httpClient = new HttpClient(manager); HttpClientParams clientParams = httpClient.getParams(); clientParams.setVersion(HttpVersion.HTTP_1_1); }
From source file:com.liferay.portlet.InvokerPortletImpl.java
public static Map<String, InvokerPortletResponse> getResponses(HttpSession session) { Map<String, InvokerPortletResponse> responses = (Map<String, InvokerPortletResponse>) session .getAttribute(WebKeys.CACHE_PORTLET_RESPONSES); if (responses == null) { responses = new ConcurrentHashMap<String, InvokerPortletResponse>(); session.setAttribute(WebKeys.CACHE_PORTLET_RESPONSES, responses); }// w w w . ja va2s .c o m return responses; }
From source file:ws.salient.aws.s3.AmazonS3Repository.java
public AmazonS3Repository(Aether aether) { this.aether = aether; kie = KieServices.Factory.get();//from www . ja va 2s . c o m knowledgeBases = new ConcurrentHashMap(); repositories = new LinkedHashSet(); }
From source file:com.bigdata.dastor.locator.TokenMetadata.java
public TokenMetadata(BiMap<Token, InetAddress> tokenToEndPointMap) { if (tokenToEndPointMap == null) tokenToEndPointMap = HashBiMap.create(); this.tokenToEndPointMap = tokenToEndPointMap; bootstrapTokens = HashBiMap.create(); leavingEndPoints = new HashSet<InetAddress>(); pendingRanges = new ConcurrentHashMap<String, Multimap<Range, InetAddress>>(); sortedTokens = sortTokens();//from www . j a va 2 s .c o m }
From source file:jp.co.acroquest.endosnipe.data.db.ConnectionManager.java
/** * ????//from ww w. ja va 2 s .c om */ private ConnectionManager() { this.dataSourceList_ = new ArrayList<DataSourceEntry>(); this.connectionPoolMap_ = new ConcurrentHashMap<String, ObjectPool>(); this.initializedDatabaseSet_ = new CopyOnWriteArraySet<String>(); }
From source file:com.clustercontrol.hub.view.action.LogTransferDisableAction.java
@Override public Object execute(ExecutionEvent event) throws ExecutionException { this.window = HandlerUtil.getActiveWorkbenchWindow(event); // In case this action has been disposed if (null == this.window || !isEnabled()) { return null; }// w w w . jav a 2 s. co m // ??? this.viewPart = HandlerUtil.getActivePart(event); if (!(viewPart instanceof TransferView)) { return null; } TransferView logTransferView = null; try { logTransferView = (TransferView) viewPart.getAdapter(TransferView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (logTransferView == null) { return null; } StructuredSelection selection = null; if (logTransferView.getLogTransferComposite().getTableViewer() .getSelection() instanceof StructuredSelection) { selection = (StructuredSelection) logTransferView.getLogTransferComposite().getTableViewer() .getSelection(); } if (selection == null) { return null; } List<?> sList = (List<?>) selection.toList(); Map<String, List<String>> transferIdMap = new ConcurrentHashMap<String, List<String>>(); for (Object obj : sList) { List<?> list = (List<?>) obj; String managerName = null; if (list == null) { continue; } managerName = (String) list.get(GetTransferTableDefine.MANAGER_NAME); if (transferIdMap.get(managerName) == null) { transferIdMap.put(managerName, new ArrayList<String>()); } } StringBuffer idbuf = new StringBuffer(); int size = 0; for (Object obj : sList) { List<?> list = (List<?>) obj; String transferId = null; String managerName = null; if (list != null) { transferId = (String) list.get(GetTransferTableDefine.TRANSFER_ID); managerName = (String) list.get(GetTransferTableDefine.MANAGER_NAME); transferIdMap.get(managerName).add(transferId); if (size > 0) { idbuf.append(", "); } idbuf.append(transferId); size++; } } if (MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.hub.log.transfer.confirm.action", new Object[] { Messages.getString("hub.log.transfer.id"), Messages.getString("hub.log.transfer.disable.setting"), idbuf.toString() })) == false) { return null; } StringBuffer sucTransferIds = new StringBuffer(); StringBuffer failTransferIds = new StringBuffer(); for (Map.Entry<String, List<String>> entry : transferIdMap.entrySet()) { String managerName = entry.getKey(); HubEndpointWrapper wrapper = HubEndpointWrapper.getWrapper(managerName); for (String transferId : entry.getValue()) { try { TransferInfo info = wrapper.getTransferInfo(transferId); info.setValidFlg(false); try { wrapper.modifyTransferInfo(info); sucTransferIds.append(transferId + "(" + managerName + "), "); } catch (InvalidRole_Exception | InvalidUserPass_Exception | InvalidSetting_Exception | LogTransferNotFound_Exception e) { m_log.debug("execute modifyLogTransfer, " + e.getMessage()); failTransferIds.append(transferId + ", "); } } catch (HinemosUnknown_Exception | InvalidRole_Exception | InvalidUserPass_Exception e) { m_log.debug("execute getLogTransfer, " + e.getMessage()); failTransferIds.append(transferId + ", "); } } } //????? if (sucTransferIds.length() > 0) { sucTransferIds.setLength(sucTransferIds.length() - 2); MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.hub.log.transfer.action.result", new Object[] { Messages.getString("hub.log.transfer.id"), Messages.getString("hub.log.transfer.disable.setting"), Messages.getString("successful"), sucTransferIds })); } //???? if (failTransferIds.length() > 0) { failTransferIds.setLength(failTransferIds.length() - 2); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hub.log.transfer.action.result", new Object[] { Messages.getString("hub.log.transfer.id"), Messages.getString("hub.log.transfer.disable.setting"), Messages.getString("failed"), failTransferIds })); } logTransferView.update(); return null; }
From source file:com.amazonaws.services.iot.client.shadow.AwsIotDeviceCommandManager.java
public AwsIotDeviceCommandManager(AbstractAwsIotDevice device) { this.pendingCommands = new ConcurrentHashMap<>(); this.device = device; this.objectMapper = new ObjectMapper(); }