List of usage examples for java.util Collections synchronizedMap
public static <K, V> Map<K, V> synchronizedMap(Map<K, V> m)
From source file:com.intel.cosbench.driver.service.COSBDriverService.java
public void init() { handlers = new HashMap<String, MissionHandler>(); handlers = Collections.synchronizedMap(handlers); executor = Executors.newCachedThreadPool(); }
From source file:org.apache.tapestry.enhance.DefaultComponentClassEnhancer.java
/** * @param resolver resource resolver used to locate classes * @param disableValidation if true, then validation (of unimplemented abstract methods) * is skipped//from w ww .j a v a 2 s .co m */ public DefaultComponentClassEnhancer(IResourceResolver resolver, boolean disableValidation) { _cachedClasses = Collections.synchronizedMap(new HashMap()); _resolver = resolver; _factory = createEnhancedClassFactory(); _disableValidation = disableValidation; }
From source file:org.rifidi.designer.library.EntityLibraryRegistry.java
/** * private constructor Singleton pattern. * /* ww w . ja va2 s.co m*/ */ private EntityLibraryRegistry() { libraries = Collections.synchronizedList(new ArrayList<EntityLibrary>()); references = Collections.synchronizedMap(new HashMap<String, EntityLibraryReference>()); entityClasses = Collections.synchronizedList(new ArrayList<Class>()); IExtensionRegistry registry = Platform.getExtensionRegistry(); registry.addRegistryChangeListener(this, "org.rifidi.designer.library"); point = registry.getExtensionPoint("org.rifidi.designer.library"); if (point == null) { logger.fatal("Extension point org.rifidi.designer.library missing!!"); return; } for (IExtension extension : point.getExtensions()) { fillLibraries(extension, true); } internalPoint = registry.getExtensionPoint("org.rifidi.designer.entities.internal"); for (IExtension extension : internalPoint.getExtensions()) { fillInternalClasses(extension, true); } }
From source file:org.eclipse.ecr.core.storage.sql.net.MapperServlet.java
public MapperServlet(String repositoryName) { this.repositoryName = repositoryName; eventQueues = Collections.synchronizedMap(new HashMap<String, InvalidationsQueue>()); }
From source file:com.hp.alm.ali.idea.entity.tree.HierarchicalEntityModel.java
public HierarchicalEntityModel(Project project, String entityType, boolean multiRoot, boolean initRoot) { super(new DefaultMutableTreeNode()); this.project = project; this.entityType = entityType; this.restService = project.getComponent(RestService.class); this.entityService = project.getComponent(EntityService.class); this.multiRoot = multiRoot; map = Collections.synchronizedMap(new HashMap<String, EntityNode>()); status = new DummyStatusIndicator(); if (initRoot) { initRootEntity();/* w ww. ja v a 2s .c o m*/ } }
From source file:org.kiji.mapreduce.KeyValueStoreReaderFactory.java
/** * Creates a KeyValueStoreReaderFactory. * * @param storeBindings defines the set of KeyValueStores available, and the * names by which they are registered. *///from w w w.j a v a 2 s.co m public KeyValueStoreReaderFactory(Map<String, KeyValueStore<?, ?>> storeBindings) { mKeyValueStores = Collections.unmodifiableMap(storeBindings); mStoreReaders = Collections.synchronizedMap(new HashMap<String, KeyValueStoreReader<?, ?>>()); }
From source file:org.mule.session.DefaultMuleSession.java
public DefaultMuleSession(MuleSession session) { this.id = session.getId(); this.securityContext = session.getSecurityContext(); this.valid = session.isValid(); this.properties = Collections.synchronizedMap(new CaseInsensitiveHashMap/* <String, Object> */()); for (String key : session.getPropertyNamesAsSet()) { this.properties.put(key, session.getProperty(key)); }//from w w w . j a v a2 s .com }
From source file:net.sf.l2j.gameserver.instancemanager.AwayManager.java
private AwayManager() { _awayPlayers = Collections.synchronizedMap(new WeakHashMap<L2PcInstance, RestoreData>()); }
From source file:org.apache.ambari.view.utils.ambari.RemoteCluster.java
/** * Constructor for RemoteCluster/*from w w w . j a v a 2 s. c o m*/ * @param ambariClusterUrl Ambari Server Cluster REST API URL (for example: http://ambari.server:8080/api/v1/clusters/c1) * @param urlStreamProvider stream provider with authorization support */ public RemoteCluster(String ambariClusterUrl, URLStreamProvider urlStreamProvider) { this.baseUrl = ambariClusterUrl; this.urlStreamProvider = urlStreamProvider; String[] parts = ambariClusterUrl.split("/"); this.name = parts[parts.length - 1]; PassiveExpiringMap<String, JSONObject> configurations = new PassiveExpiringMap<String, JSONObject>(10000L); // keep cache for 10 seconds configurationCache = Collections.synchronizedMap(configurations); }
From source file:org.apache.hadoop.mapred.ResourceJobQueueListener.java
/** * For clients that want to provide their own job priorities. * @param jobQueue A collection whose iterator returns jobs in priority order. *///from ww w . ja v a 2 s .c om protected ResourceJobQueueListener(Map<JobSchedulingInfo, JobInProgress> jobQueue) { this.jobQueue = Collections.synchronizedMap(jobQueue); }