List of usage examples for java.util.concurrent ConcurrentHashMap ConcurrentHashMap
public ConcurrentHashMap()
From source file:com.gemstone.gemfire.cache.lucene.internal.filesystem.FileSystemJUnitTest.java
@Before public void setUp() { fileRegion = new ConcurrentHashMap<String, File>(); chunkRegion = new ConcurrentHashMap<ChunkKey, byte[]>(); fileSystemStats = mock(FileSystemStats.class); system = new FileSystem(fileRegion, chunkRegion, fileSystemStats); }
From source file:com.twitter.ambrose.hive.reporter.AmbroseHiveProgressReporter.java
private void init() { jobIdToProgress = new ConcurrentHashMap<String, Integer>(); jobIdToNodeId = new ConcurrentHashMap<String, String>(); jobs = new CopyOnWriteArrayList<Job>(); completedJobIds = new CopyOnWriteArraySet<String>(); totalMRJobs = 0;// w w w . jav a 2 s. c o m workflowVersion = null; }
From source file:com.googlecode.jsfFlex.shared.tasks.TaskRunnerImpl.java
TaskRunnerImpl() { super();//from w ww .java 2 s.c o m _tasks = new LinkedList<AbstractTask>(); _queuedTasks = new ConcurrentHashMap<String, Future<Void>>(); }
From source file:ws.salient.session.Sessions.java
public Sessions(KnowledgeRepository repository, Profiles profiles, SessionStore store, Injector injector, ExecutorService commandExecutor, ExecutorService workItemExecutor) { this.injector = injector; this.store = store; // Set executors this.commandExecutor = commandExecutor; this.workItemExecutor = workItemExecutor; // Initialise singletons json = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); // Load configuration this.profiles = profiles; this.repository = repository; repository.setRemoteRepositories(profiles.getRemoteRepositories()); // Initialise caches sessions = new ConcurrentHashMap(); // Persist queued items on shutdown Runtime.getRuntime().addShutdownHook(new Thread() { @Override/* www . j a va2 s. c om*/ public void run() { shutdown(); } }); }
From source file:io.seldon.api.state.zk.ZkClientConfigHandler.java
@Autowired public ZkClientConfigHandler(ZkSubscriptionHandler handler) { this.handler = handler; this.newClientListeners = new ArrayList<>(); this.listeners = new HashSet<>(); this.clientsWithInitialConfig = new ConcurrentHashMap<>(); }
From source file:io.openmessaging.rocketmq.consumer.LocalMessageCache.java
LocalMessageCache(final DefaultMQPullConsumer rocketmqPullConsumer, final ClientConfig clientConfig) { consumeRequestCache = new LinkedBlockingQueue<>(clientConfig.getRmqPullMessageCacheCapacity()); this.consumedRequest = new ConcurrentHashMap<>(); this.pullOffsetTable = new ConcurrentHashMap<>(); this.rocketmqPullConsumer = rocketmqPullConsumer; this.clientConfig = clientConfig; this.cleanExpireMsgExecutors = Executors .newSingleThreadScheduledExecutor(new ThreadFactoryImpl("OMS_CleanExpireMsgScheduledThread_")); }
From source file:aidev.cocis.makerere.org.whiteflycounter.common.AgingCredentialsProvider.java
/** * Default constructor./*from www . j a v a2 s . co m*/ */ public AgingCredentialsProvider(int expiryInterval) { super(); this.credMap = new ConcurrentHashMap<AuthScope, Credentials>(); this.expiryInterval = expiryInterval; nextClearTimestamp = System.currentTimeMillis() + expiryInterval; }
From source file:io.github.minecraftgui.models.network.UserConnection.java
public UserConnection(NetworkController networkController, ArrayList<NetworkController.PluginInfo> pluginInfos, UUID uuid) {/* ww w .j a va 2 s.c o m*/ this.networkController = networkController; this.uuid = uuid; this.components = new ConcurrentHashMap<>(); this.userGuis = new ConcurrentHashMap<>(); this.fontsGenerate = new HashMap<>(); this.fonts = new ArrayList<>(); this.images = new HashMap<>(); this.pluginInfos = pluginInfos; this.onGuiOpenListeners = new ConcurrentHashMap<>(); this.onGuiCloseListeners = new ConcurrentHashMap<>(); for (NetworkController.PluginInfo plugin : pluginInfos) userGuis.put(plugin.getName(), new UserGui(this)); }
From source file:com.netflix.discovery.shared.Application.java
public Application(String name) { this.name = StringCache.intern(name); instancesMap = new ConcurrentHashMap<String, InstanceInfo>(); instances = new LinkedHashSet<InstanceInfo>(); }
From source file:io.seldon.clustering.recommender.jdo.JdoClusterFromReferrer.java
private void updateClusterMap() { PersistenceManager pm = JDOFactory.get().getPersistenceManager(client); if (pm != null) { Query query = pm.newQuery("javax.jdo.query.SQL", "select referrer,cluster from cluster_referrer"); query.setResultClass(ClusterReferrer.class); List<ClusterReferrer> res = (List<ClusterReferrer>) query.execute(); logger.info("Getting READ lock"); lock.writeLock().lock();//from w ww.j av a 2 s. c om try { ConcurrentHashMap<String, Integer> clusterMapNew = new ConcurrentHashMap<>(); for (ClusterReferrer r : res) { logger.info("Updating cluster map for " + client + " with referrer:" + r.getReferrer() + " cluster:" + r.getCluster()); clusterMapNew.put(r.getReferrer(), r.getCluster()); } clusterMap = clusterMapNew; } finally { lock.writeLock().unlock(); logger.info("Released WRITE lock"); } } else logger.error("Failed to get persistence manager for client " + client); }