List of usage examples for java.util.concurrent ConcurrentHashMap ConcurrentHashMap
public ConcurrentHashMap()
From source file:jetbrains.exodus.entitystore.Explainer.java
public void start(Object origin) { if (origin != null) { if (queries.get(origin) == null) { Map<String, Object> map = new ConcurrentHashMap<>(); queries.put(origin, map);/*from w w w.j a v a2 s . c om*/ map.put(INSTANTIATED_FROM, "\nat " + stripStackTrace(new Throwable())); } else { queries.get(origin).put(CONCURRENT_TRAVERSE_WARNING, ""); } } }
From source file:com.clustercontrol.jobmanagement.view.action.EnableJobKickAction.java
/** * ?/* w w w. j ava 2 s. c o m*/ */ @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; } // ??? this.viewPart = HandlerUtil.getActivePart(event); // ??? JobKickListView view = null; try { view = (JobKickListView) this.viewPart.getAdapter(JobKickListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } JobKickListComposite composite = view.getComposite(); StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection(); Object[] objs = selection.toArray(); String[] args; Map<String, List<String>> map = new ConcurrentHashMap<String, List<String>>(); StringBuffer targetList = new StringBuffer();//?() StringBuffer successList = new StringBuffer();//?(?) StringBuffer failureList = new StringBuffer();//?() for (int i = 0; i < objs.length; i++) { String managerName = (String) ((ArrayList<?>) objs[i]).get(GetJobKickTableDefine.MANAGER_NAME); String jobkickId = (String) ((ArrayList<?>) objs[i]).get(GetJobKickTableDefine.JOBKICK_ID); Integer type = JobKickTypeMessage .stringToType((String) ((ArrayList<?>) objs[i]).get(GetJobKickTableDefine.TYPE)); if (type == JobKickConstant.TYPE_MANUAL) { // ? continue; } if (map.get(managerName) == null) { map.put(managerName, new ArrayList<String>()); } map.get(managerName).add(jobkickId); targetList.append(jobkickId + "\n"); } // 1???????? if (objs.length == 0) { MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.job.24")); return null; } // ?(NG) args = new String[] { targetList.toString() }; if (!MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.job.68", args))) { return null; } boolean hasRole = true; // for (Map.Entry<String, List<String>> entry : map.entrySet()) { String managerName = entry.getKey(); JobEndpointWrapper wrapper = JobEndpointWrapper.getWrapper(managerName); for (String targetId : entry.getValue()) { try { wrapper.setJobKickStatus(targetId, true); successList.append(targetId + "(" + managerName + ")" + "\n"); } catch (InvalidRole_Exception e) { failureList.append(targetId + "\n"); m_log.warn("run() setJobKickStatus jobkickId=" + targetId + ", " + e.getMessage(), e); hasRole = false; } catch (Exception e) { failureList.append(targetId + "\n"); m_log.warn("run() setJobKickStatus jobkickId=" + targetId + ", " + e.getMessage(), e); } } } if (!hasRole) { // ???????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } // ? if (successList.length() != 0) { args = new String[] { successList.toString() }; MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.job.69", args)); } // if (failureList.length() != 0) { args = new String[] { failureList.toString() }; MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.job.70", args)); } // ? composite.update(); return null; }
From source file:com.clustercontrol.hub.view.action.LogTransferEnableAction.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; }/*from w w w . j a v a2s. c o m*/ // ??? this.viewPart = HandlerUtil.getActivePart(event); if (!(viewPart instanceof TransferView)) { return null; } TransferView logTransfarView = null; try { logTransfarView = (TransferView) viewPart.getAdapter(TransferView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (logTransfarView == null) { return null; } StructuredSelection selection = null; if (logTransfarView.getLogTransferComposite().getTableViewer() .getSelection() instanceof StructuredSelection) { selection = (StructuredSelection) logTransfarView.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.enable.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(true); try { wrapper.modifyTransferInfo(info); sucTransferIds.append(transferId + "(" + managerName + ")" + ", "); } catch (InvalidSetting_Exception | HinemosUnknown_Exception | InvalidRole_Exception | InvalidUserPass_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.enable.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.enable.setting"), Messages.getString("failed"), failTransferIds })); } logTransfarView.update(); return null; }
From source file:com.clustercontrol.jobmanagement.view.action.DisableJobKickAction.java
/** * ?//from ww w .jav a2 s.c o m */ @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; } // ??? this.viewPart = HandlerUtil.getActivePart(event); // ??? JobKickListView view = null; try { view = (JobKickListView) this.viewPart.getAdapter(JobKickListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } JobKickListComposite composite = view.getComposite(); StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection(); Object[] objs = selection.toArray(); String[] args; Map<String, List<String>> map = new ConcurrentHashMap<String, List<String>>(); StringBuffer targetList = new StringBuffer();//?() StringBuffer successList = new StringBuffer();//?(?) StringBuffer failureList = new StringBuffer();//?() for (int i = 0; i < objs.length; i++) { String managerName = (String) ((ArrayList<?>) objs[i]).get(GetJobKickTableDefine.MANAGER_NAME); String jobkickId = (String) ((ArrayList<?>) objs[i]).get(GetJobKickTableDefine.JOBKICK_ID); Integer type = JobKickTypeMessage .stringToType((String) ((ArrayList<?>) objs[i]).get(GetJobKickTableDefine.TYPE)); if (type == JobKickConstant.TYPE_MANUAL) { // ? continue; } if (map.get(managerName) == null) { map.put(managerName, new ArrayList<String>()); } map.get(managerName).add(jobkickId); targetList.append(jobkickId + "\n"); } // 1???????? if (objs.length == 0) { MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.job.24")); return null; } // ?(NG) args = new String[] { targetList.toString() }; if (!MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.job.71", args))) { return null; } boolean hasRole = true; // for (Map.Entry<String, List<String>> entry : map.entrySet()) { String managerName = entry.getKey(); JobEndpointWrapper wrapper = JobEndpointWrapper.getWrapper(managerName); for (String targetId : entry.getValue()) { try { wrapper.setJobKickStatus(targetId, false); successList.append(targetId + "(" + managerName + ")" + "\n"); } catch (InvalidRole_Exception e) { failureList.append(targetId + "\n"); m_log.warn("run() setJobKickStatus jobkickId=" + targetId + ", " + e.getMessage(), e); hasRole = false; } catch (Exception e) { failureList.append(targetId + "\n"); m_log.warn("run() setJobKickStatus jobkickId=" + targetId + ", " + e.getMessage(), e); } } } if (!hasRole) { // ???????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } // ? if (successList.length() != 0) { args = new String[] { successList.toString() }; MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.job.72", args)); } // if (failureList.length() != 0) { args = new String[] { failureList.toString() }; MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.job.73", args)); } // ? composite.update(); return null; }
From source file:com.clustercontrol.notify.view.action.NotifyEnableAction.java
/** * //from w w w. ja v a 2 s . c o m */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { // ??? this.viewPart = HandlerUtil.getActivePart(event); NotifyListView view = null; try { view = (NotifyListView) this.viewPart.getAdapter(NotifyListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } NotifyListComposite composite = (NotifyListComposite) view.getListComposite(); StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection(); Object[] objs = selection.toArray(); // 1???????? if (objs.length == 0) { MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.notify.8")); return null; } // 1?????? String notifyId = null; String[] args; StringBuffer targetList = new StringBuffer(); StringBuffer successList = new StringBuffer(); StringBuffer failureList = new StringBuffer(); Map<String, List<String>> enableMap = new ConcurrentHashMap<String, List<String>>(); for (int i = 0; i < objs.length; i++) { String managerName = (String) ((ArrayList<?>) objs[i]).get(NotifyTableDefineNoCheckBox.MANAGER_NAME); enableMap.put(managerName, new ArrayList<String>()); } for (int i = 0; i < objs.length; i++) { notifyId = (String) ((ArrayList<?>) objs[i]).get(NotifyTableDefineNoCheckBox.NOTIFY_ID); String managerName = (String) ((ArrayList<?>) objs[i]).get(NotifyTableDefineNoCheckBox.MANAGER_NAME); enableMap.get(managerName).add(notifyId); targetList.append(notifyId + "\n"); } // ?(NG) args = new String[] { targetList.toString() }; if (!MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.notify.34", args))) { return null; } boolean hasRole = true; // for (Map.Entry<String, List<String>> map : enableMap.entrySet()) { String managerName = map.getKey(); NotifyEndpointWrapper wrapper = NotifyEndpointWrapper.getWrapper(map.getKey()); for (String targetId : map.getValue()) { try { wrapper.setNotifyStatus(targetId, true); successList.append(targetId + "(" + managerName + ")" + "\n"); } catch (InvalidRole_Exception e) { failureList.append(targetId + "\n"); m_log.warn("run() setNotifyStatus targetId=" + targetId + ", " + e.getMessage(), e); hasRole = false; } catch (Exception e) { failureList.append(targetId + "\n"); m_log.warn("run() setNotifyStatus targetId=" + targetId + ", " + e.getMessage(), e); } } } if (!hasRole) { // ???????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } // ? if (successList.length() != 0) { args = new String[] { successList.toString() }; MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.notify.35", args)); } // if (failureList.length() != 0) { args = new String[] { failureList.toString() }; MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.notify.36", args)); } // ? composite.update(); return null; }
From source file:com.clustercontrol.notify.view.action.NotifyDisableAction.java
/** * //from ww w. ja va 2s . c om */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { // ??? this.viewPart = HandlerUtil.getActivePart(event); NotifyListView view = null; try { view = (NotifyListView) this.viewPart.getAdapter(NotifyListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } NotifyListComposite composite = (NotifyListComposite) view.getListComposite(); StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection(); Object[] objs = selection.toArray(); // 1???????? if (objs.length == 0) { MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.notify.8")); return null; } // 1?????? String notifyId = null; String[] args; StringBuffer targetList = new StringBuffer(); StringBuffer successList = new StringBuffer(); StringBuffer failureList = new StringBuffer(); Map<String, List<String>> disableMap = new ConcurrentHashMap<String, List<String>>(); for (int i = 0; i < objs.length; i++) { String managerName = (String) ((ArrayList<?>) objs[i]).get(NotifyTableDefineNoCheckBox.MANAGER_NAME); disableMap.put(managerName, new ArrayList<String>()); } for (int i = 0; i < objs.length; i++) { notifyId = (String) ((ArrayList<?>) objs[i]).get(NotifyTableDefineNoCheckBox.NOTIFY_ID); String managerName = (String) ((ArrayList<?>) objs[i]).get(NotifyTableDefineNoCheckBox.MANAGER_NAME); disableMap.get(managerName).add(notifyId); targetList.append(notifyId + "\n"); } // ?(NG) args = new String[] { targetList.toString() }; if (!MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.notify.37", args))) { return null; } boolean hasRole = true; // for (Map.Entry<String, List<String>> map : disableMap.entrySet()) { String managerName = map.getKey(); NotifyEndpointWrapper wrapper = NotifyEndpointWrapper.getWrapper(managerName); for (String targetId : map.getValue()) { try { wrapper.setNotifyStatus(targetId, false); successList.append(targetId + "(" + managerName + ")" + "\n"); } catch (InvalidRole_Exception e) { failureList.append(targetId + "\n"); m_log.warn("run() setNotifyStatus targetId=" + targetId + ", " + e.getMessage(), e); hasRole = false; } catch (Exception e) { failureList.append(targetId + "\n"); m_log.warn("run() setNotifyStatus targetId=" + targetId + ", " + e.getMessage(), e); } } } if (!hasRole) { // ???????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } // ? if (successList.length() != 0) { args = new String[] { successList.toString() }; MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.notify.38", args)); } // if (failureList.length() != 0) { args = new String[] { failureList.toString() }; MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.notify.39", args)); } // ? composite.update(); return null; }
From source file:blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.java
private ConcurrentHashMap<BlockPos, Set<Connection>> getMultimap(int dimension) { if (directConnections.get(dimension) == null) { ConcurrentHashMap<BlockPos, Set<Connection>> mm = new ConcurrentHashMap<BlockPos, Set<Connection>>(); directConnections.put(dimension, mm); }/*ww w. j av a 2s. c o m*/ return directConnections.get(dimension); }
From source file:com.clustercontrol.calendar.view.action.CalendarDeleteAction.java
/** * Handler execution/*from w w w. j a v a 2s. co m*/ */ @Override public Object execute(final ExecutionEvent event) throws ExecutionException { this.window = HandlerUtil.getActiveWorkbenchWindow(event); // In case this action has been disposed if (null == this.window || !isEnabled()) { return null; } this.viewPart = HandlerUtil.getActivePart(event); // ?????ID? CalendarListView calendarListView = null; try { calendarListView = (CalendarListView) this.viewPart.getAdapter(CalendarListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (calendarListView == null) { m_log.info("execute: view is null"); return null; } Map<String, List<String>> map = calendarListView.getSelectedItem(); String[] args = new String[1]; String msg = null; int i = 0; String calId = null; for (Map.Entry<String, List<String>> entry : map.entrySet()) { for (String id : entry.getValue()) { calId = id; i++; } } if (i > 0) { // ??????????? if (i == 1) { msg = "message.calendar.7"; args[0] = calId; } else { msg = "message.calendar.71"; args[0] = Integer.toString(i); } Map<String, String> errorMsgs = new ConcurrentHashMap<>(); StringBuffer messageArg = new StringBuffer(); i = 0; if (MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString(msg, args))) { for (Map.Entry<String, List<String>> entry : map.entrySet()) { String managerName = entry.getKey(); CalendarEndpointWrapper wrapper = CalendarEndpointWrapper.getWrapper(managerName); if (i > 0) { messageArg.append(", "); } messageArg.append(managerName); try { wrapper.deleteCalendar(entry.getValue()); } catch (Exception e) { if (e instanceof InvalidRole_Exception) { // ??? errorMsgs.put(managerName, Messages.getString("message.accesscontrol.16")); } else { errorMsgs.put(managerName, Messages.getString("message.calendar.6") + ", " + HinemosMessage.replace(e.getMessage())); } } i++; } // if (0 < errorMsgs.size()) { UIManager.showMessageBox(errorMsgs, true); } else { args[0] = messageArg.toString(); // ?? MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.calendar.5", args)); } // calendarListView.update(); } } return null; }
From source file:com.github.wolfdogs.kemono.util.event.RootEventManager.java
public RootEventManager() { handlerEntryContainersMap = new ConcurrentHashMap<>(); }
From source file:com.vmware.thinapp.manualmode.util.JobMonitorService.java
public JobMonitorService() { perfTasks = new ConcurrentHashMap<JobMonitorTicket, ScheduledFuture<?>>(); executor = Executors.newScheduledThreadPool(MIN_PERF_TASK_THREADS); }