List of usage examples for java.util.concurrent ConcurrentHashMap ConcurrentHashMap
public ConcurrentHashMap()
From source file:com.epam.reportportal.apache.http.impl.conn.InMemoryDnsResolver.java
/** * Builds a DNS resolver that will resolve the host names against a * collection held in-memory./* w ww . j a v a2 s . c o m*/ */ public InMemoryDnsResolver() { dnsMap = new ConcurrentHashMap<String, InetAddress[]>(); }
From source file:PalidromeArray.java
public PalidromeArray(PalidromeArray array) { this.totalLength = array.totalLength; this.halfLength = array.halfLength; this.isEven = array.isEven; this.array = new ConcurrentHashMap<BigInteger, BigInteger>(); for (BigInteger index : array.array.keySet()) this.array.put(index, array.array.get(index)); }
From source file:ambit2.database.DatasourceFactory.java
private DatasourceFactory() { datasources = new ConcurrentHashMap<String, DataSource>(); }
From source file:com.btmatthews.atlas.tenancy.support.spring.TenantScope.java
/** * Lookup or create a tenant scoped bean. If a bean has to be created and it supports the {@link TenantAware} * interface then the tenant domain object is injected via the * {@link TenantAware#setTenant(com.btmatthews.atlas.tenancy.support.domain.Tenant)} method. * * @param name The bean name./* w w w. ja v a2s . c o m*/ * @param objectFactory The factory used to create the bean if it does not already exist. * @return The existing or newly created bean. */ @Override public Object get(final String name, final ObjectFactory<?> objectFactory) { final String tenantId = getConversationId(); if (tenantId == null) { return objectFactory.getObject(); } else { final Map<String, Object> scope; if (scopes.containsKey(tenantId)) { scope = scopes.get(tenantId); } else { scope = new ConcurrentHashMap<String, Object>(); scopes.put(tenantId, scope); } final Object bean; if (scope.containsKey(name)) { bean = scope.get(name); } else { bean = objectFactory.getObject(); if (bean instanceof TenantAware) { ((TenantAware) bean).setTenant(TenantContextHolder.peek()); } scope.put(name, bean); } return bean; } }
From source file:ch.algotrader.broker.marketdata.ConsumerEventThrottler.java
public ConsumerEventThrottler(final double maxRatePerConnection, final double minRatePerConsumer) { Validate.notNull(maxRatePerConnection > 0, "Max rate per connection must be positive"); Validate.notNull(minRatePerConsumer > 0, "Min rate per consumer must be positive"); this.maxPeriodPerConnection = (int) (1000 / maxRatePerConnection); this.minPeriodPerConsumer = (int) (1000 / minRatePerConsumer); this.consumerLastEvent = new ConcurrentHashMap<>(); this.connectionLastEvent = new ConcurrentHashMap<>(); }
From source file:com.clustercontrol.performance.action.RecordController.java
/** * ?????//w w w. ja va 2s . co m * * @param ID * @return ? */ public Map<String, CollectorItemTreeItem> getItemCodeTreeMap(String managerName) { log.debug("getItemCodeTreeMap() : managerName=" + managerName); CollectorItemTreeItem treeItem = null; for (int i = 0; i <= this.errorCount; i++) { try { //TODO:?? // return bean.getItemCodeMap(); MonitorSettingEndpointWrapper wrapper = MonitorSettingEndpointWrapper.getWrapper(managerName); HashMapInfo hashMapInfo = wrapper.getItemCodeMap(); Map2 map2 = hashMapInfo.getMap2(); Map<String, CollectorItemTreeItem> rtnMap = new ConcurrentHashMap<String, CollectorItemTreeItem>(); for (Entry entry : map2.getEntry()) { log.trace("entry : key=" + entry.getKey()); treeItem = entry.getValue(); setTreeParent(treeItem); rtnMap.put(entry.getKey(), treeItem); } log.debug("getItemCodeTreeMap() : size=" + rtnMap.size()); return rtnMap; } catch (InvalidRole_Exception e) { log.error("getItemCodeTreeMap()", e); } catch (Exception e) { log.error("getItemCodeTreeMap()", e); } } return null; }
From source file:ch.algotrader.ordermgmt.DefaultOrderBook.java
public DefaultOrderBook() { this.orderMap = new ConcurrentHashMap<>(); this.extIdToIntIdMap = new ConcurrentHashMap<>(); this.orderExecMap = new ConcurrentHashMap<>(); this.revisionMap = new ConcurrentHashMap<>(); this.completedOrders = new ConcurrentLinkedDeque<>(); }
From source file:lab.mage.spring.cassandra.connector.core.CassandraSessionProvider.java
public CassandraSessionProvider(@Nonnull final Environment env, @Nonnull final Logger logger) { super();// w w w .j a va2s .co m Assert.notNull(env, "An environment must be given!"); Assert.notNull(logger, "A logger must be given!"); this.env = env; this.logger = logger; this.clusterCache = new ConcurrentHashMap<>(); this.sessionCache = new ConcurrentHashMap<>(); }
From source file:org.eclipse.aether.transport.http.LocalState.java
LocalState(RepositorySystemSession session, RemoteRepository repo, SslConfig sslConfig) { global = GlobalState.get(session);//from w w w .j a v a2s.c o m userToken = this; if (global == null) { connMgr = GlobalState.newConnectionManager(sslConfig); userTokenKey = null; expectContinueKey = null; authSchemePools = new ConcurrentHashMap<HttpHost, AuthSchemePool>(); } else { connMgr = global.getConnectionManager(sslConfig); userTokenKey = new CompoundKey(repo.getId(), repo.getUrl(), repo.getAuthentication(), repo.getProxy()); expectContinueKey = new CompoundKey(repo.getUrl(), repo.getProxy()); authSchemePools = global.getAuthSchemePools(); } }
From source file:edu.utah.further.osgi.shell.SpringApplicationListener.java
/** * @param bundleContext//w ww . j av a 2 s . co m */ public SpringApplicationListener(final BundleContext bundleContext) { this.states = new ConcurrentHashMap<>(); this.bundleContext = bundleContext; this.bundleContext.addBundleListener(this); this.registration = this.bundleContext.registerService(OsgiBundleApplicationContextListener.class.getName(), this, new Hashtable<>()); }