List of usage examples for java.util.concurrent ConcurrentHashMap ConcurrentHashMap
public ConcurrentHashMap()
From source file:com.uber.stream.kafka.chaperone.collector.KafkaMonitor.java
public KafkaMonitor(long checkIntervalInSec, String brokerList, String auditTopics, IAuditReporter auditReporter) {/*from w w w . j ava 2 s. c o m*/ this.checkIntervalInSec = checkIntervalInSec; this.brokerList = Arrays.asList(StringUtils.split(brokerList, ",")); this.auditTopics = Arrays.asList(StringUtils.split(auditTopics, ",")); this.auditReporter = auditReporter; this.brokerConsumer = new HashMap<>(); this.partitionLeader = new HashMap<>(); this.partitionLag = new ConcurrentHashMap<>(); this.partitionInjected = new HashSet<>(); cronExecutor = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat("kafka-monitor-%d").build()); }
From source file:org.apache.solr.core.BlobRepository.java
ConcurrentHashMap<String, BlobContent> createMap() {
return new ConcurrentHashMap<>();
}
From source file:com.polyvi.xface.extension.xmlhttprequest.XXMLHttpRequest.java
public XXMLHttpRequest(Context context) { super();// w w w .jav a 2s. c o m mRequestHeaders = new ConcurrentHashMap<String, String>(); mContext = context; mNetWork = new XHttpWorker(); mResponseText = ""; mState = State.UNSEND; }
From source file:org.apache.cxf.transport.jms.JMSConduit.java
public JMSConduit(EndpointInfo endpointInfo, EndpointReferenceType target, JMSConfiguration jmsConfig) { super(target); this.jmsConfig = jmsConfig; this.endpointInfo = endpointInfo; correlationMap = new ConcurrentHashMap<String, Exchange>(); conduitId = UUID.randomUUID().toString().replaceAll("-", ""); messageCount = new AtomicLong(0); }
From source file:com.clustercontrol.notify.view.action.NotifyDeleteAction.java
@Override public Object execute(ExecutionEvent event) throws ExecutionException { // ???//w w w. ja v a2s . c o m 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(); List<?> list = (List<?>) selection.toList(); Map<String, List<String>> deleteMap = new ConcurrentHashMap<String, List<String>>(); int size = 0; if (list != null && list.size() > 0) { for (Object obj : list) { List<?> objList = (List<?>) obj; String managerName = (String) objList.get(NotifyTableDefineNoCheckBox.MANAGER_NAME); if (deleteMap.get(managerName) != null) { continue; } deleteMap.put(managerName, new ArrayList<String>()); } String notifyId = null; for (Object obj : list) { List<?> objList = (List<?>) obj; notifyId = (String) objList.get(NotifyTableDefineNoCheckBox.NOTIFY_ID); String managerName = (String) objList.get(NotifyTableDefineNoCheckBox.MANAGER_NAME); deleteMap.get(managerName).add(notifyId); size++; } String[] args = new String[1]; String msg = null; if (size > 0) { if (size == 1) { args[0] = notifyId; msg = "message.notify.7"; } else { args[0] = Integer.toString(size); msg = "message.notify.51"; } } // ????????? DeleteNotify deleteNotify = new DeleteNotify(); boolean check = true; for (Map.Entry<String, List<String>> map : deleteMap.entrySet()) { String managerName = map.getKey(); // ?ID????????? if (deleteNotify.useCheck(managerName, map.getValue()) != Window.OK) { check = false; } } if (check) { if (MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString(msg, args)) == false) { return null; } boolean result = false; for (Map.Entry<String, List<String>> map : deleteMap.entrySet()) { result = result | deleteNotify.delete(map.getKey(), map.getValue()); } if (result) { composite.update(); } } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.notify.9")); } return null; }
From source file:de.rwth_aachen.comsys.audiosync.model.MusicProvider.java
public MusicProvider() { mMusicListByGenre = new ConcurrentHashMap<>(); mMusicListById = new ConcurrentHashMap<>(); mFavoriteTracks = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>()); createLocal("bis_spaeter.mp3"); createLocal("background.mp3"); createLocal("mandelsson.mp3"); createLocal("metronom.mp3"); }
From source file:com.rockagen.gnext.service.spring.KeyValueMapImpl.java
/** * Get the duplicate map/*from w w w .j av a2 s.com*/ * * @param key * @return */ public Map<String, String> getMap() { final Map<String, String> temp = new ConcurrentHashMap<String, String>(); temp.putAll(KEY_VALUE_MAP); return temp; }
From source file:com.clustercontrol.repository.view.action.NodeDeleteAction.java
/** * @see org.eclipse.core.commands.IHandler#execute */// w ww .j ava 2s . co m @Override public Object execute(ExecutionEvent event) throws ExecutionException { this.viewPart = HandlerUtil.getActivePart(event); // ??????ID? NodeListView nodeListView = null; try { nodeListView = (NodeListView) this.viewPart.getAdapter(NodeListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (nodeListView == null) { m_log.info("execute: view is null"); return null; } StructuredSelection selection = (StructuredSelection) nodeListView.getComposite().getTableViewer() .getSelection(); List<?> sList = (List<?>) selection.toList(); Map<String, List<String>> map = new ConcurrentHashMap<String, List<String>>(); for (Object obj : sList) { List<?> list = (List<?>) obj; String managerName = null; if (list != null) { managerName = (String) list.get(GetNodeListTableDefine.MANAGER_NAME); if (map.get(managerName) == null) { map.put(managerName, new ArrayList<String>()); } } } int size = 0; String facilityName = null; String facilityId = null; for (Object obj : sList) { List<?> list = (List<?>) obj; String managerName = null; if (list != null) { managerName = (String) list.get(GetNodeListTableDefine.MANAGER_NAME); String id = (String) list.get(GetNodeListTableDefine.FACILITY_ID); facilityName = (String) list.get(GetNodeListTableDefine.FACILITY_NAME); facilityId = id; map.get(managerName).add(id); size++; } } if (size > 0) { // ??????????? String msg = ""; String[] args = new String[2]; if (size == 1) { args[0] = facilityName; args[1] = facilityId; msg = "message.repository.1"; } else { args[0] = Integer.toString(size); msg = "message.repository.51"; } if (MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString(msg, args)) == false) { return null; } for (Map.Entry<String, List<String>> entry : map.entrySet()) { new DeleteNodeProperty().delete(entry.getKey(), entry.getValue()); } } // nodeListView.update(); return null; }
From source file:org.fishwife.jrugged.spring.TestCircuitBreakerBeanFactory.java
@Test public void testFindInvalidCircuitBreakerBean() { String breakerName = "testFindInvalid"; // Create a map with an invalid CircuitBreaker (non-bean) in it, and jam it in. ConcurrentHashMap<String, CircuitBreaker> invalidMap = new ConcurrentHashMap<String, CircuitBreaker>(); invalidMap.put(breakerName, new CircuitBreaker()); ReflectionTestUtils.setField(factory, "circuitBreakerMap", invalidMap); // Try to find it. CircuitBreakerBean foundBreaker = factory.findCircuitBreakerBean(breakerName); assertNull(foundBreaker);/*from w ww.j av a 2s .com*/ }
From source file:com.legstar.host.invoke.AbstractProgramInvoker.java
/** * Operation invoker constructor./* ww w. j a v a 2 s .c o m*/ * @param configFileName host invoker configuration file name * @param operationName operation name * @param hostProgram host program bean associated with operation */ public AbstractProgramInvoker(final String configFileName, final String operationName, final HostProgram hostProgram) { mConfigFileName = configFileName; mOperationName = operationName; mHostProgram = hostProgram; _hostInvokersCache = new ConcurrentHashMap<LegStarAddress, HostInvoker>(); }