List of usage examples for java.util Collections synchronizedMap
public static <K, V> Map<K, V> synchronizedMap(Map<K, V> m)
From source file:org.apache.hadoop.mapreduce.v2.app.rm.preemption.CheckpointAMPreemptionPolicy.java
public CheckpointAMPreemptionPolicy() { this(Collections.synchronizedSet(new HashSet<TaskAttemptId>()), Collections.synchronizedSet(new HashSet<TaskAttemptId>()), Collections.synchronizedMap(new HashMap<TaskId, TaskCheckpointID>()), Collections.synchronizedMap(new HashMap<TaskAttemptId, Resource>())); }
From source file:com.ondeck.datapipes.flow.ParallelExecuteVisitor.java
/** * Creates a {@code ParallelExecuteVisitor} with the specified {@code ExecutorService}. If using an * {@code ExecutorService} with a limited number of threads, make sure to provide enough threads for the flow or it * will result in deadlocks./*from www.ja va2s . com*/ * @param executor */ public ParallelExecuteVisitor(ExecutorService executor) { super(Collections.synchronizedMap(new HashMap<FlowStep<?>, Object>())); this.executor = executor; }
From source file:swift.application.filesystem.cs.SwiftFuseClient.java
SwiftFuseClient(long expFile) { this.attributes = Collections.synchronizedMap(new HashMap<String, GetAttrOperation.Result>()); this.expirationDateAttr = Collections.synchronizedMap(new HashMap<String, Long>()); this.defaultExpirationAttr = expFile; this.dirs = Collections.synchronizedMap(new HashMap<String, GetDirOperation.Result>()); this.expirationDateDir = Collections.synchronizedMap(new HashMap<String, Long>()); this.defaultExpirationDir = expFile; this.threads = Executors.newFixedThreadPool(2); Executors.newScheduledThreadPool(2).scheduleWithFixedDelay(this.removeExpired(), this.defaultExpirationAttr / 2, this.defaultExpirationAttr, TimeUnit.MILLISECONDS); }
From source file:com.evolveum.midpoint.prism.marshaller.PrismBeanInspector.java
private <V, P1, P2, P3> V find3(final Map<P1, Map<P2, Map<P3, V>>> cache, final P1 param1, final P2 param2, final P3 param3, final Getter3<V, P1, P2, P3> getter) { Map<P2, Map<P3, V>> cache2 = cache.computeIfAbsent(param1, k -> Collections.synchronizedMap(new HashMap<>())); return find2(cache2, param2, param3, (p, q) -> getter.get(param1, p, q)); }
From source file:eu.stratosphere.pact.client.web.JobSubmissionServlet.java
public JobSubmissionServlet(Configuration nepheleConfig, File jobDir, File planDir) { this.client = new Client(nepheleConfig); this.jobStoreDirectory = jobDir; this.planDumpDirectory = planDir; this.submittedJobs = Collections.synchronizedMap(new HashMap<Long, ProgramJobGraphPair>()); this.rand = new Random(System.currentTimeMillis()); }
From source file:de.escidoc.core.aa.business.cache.RequestAttributesCache.java
/** * Creates the attribute cache.<br/>The cache is implemented as a synchronized LRUMap (least-recently-used map), so * it can only grow to a certain size. The size is taken from the static field <code>usersCacheSize</code> that has * to be initialized before calling this method (this is not checked). *///ww w . ja v a2 s . c o m @SuppressWarnings("unchecked") private static void createAttributeCache() { attributesCache = Collections.synchronizedMap(new LRUMap(usersCacheSize)); }
From source file:gov.nih.nci.integration.caaers.invoker.CaAERSUpdateRegistrationServiceInvocationStrategy.java
/** * Constructor//from w w w . java2 s. c o m * * @param xsltTransformer - XSLTTransformer * @param client - CaAERSParticipantServiceWSClient object * @param retryCount - retry Count */ public CaAERSUpdateRegistrationServiceInvocationStrategy(XSLTTransformer xsltTransformer, CaAERSParticipantServiceWSClient client, int retryCount) { super(); this.xsltTransformer = xsltTransformer; this.client = client; this.retryCount = retryCount; final HashMap<String, IntegrationError> msgToErrMapBase = new LinkedHashMap<String, IntegrationError>(); msgToErrMapBase.put("User is not authorized on this Study", IntegrationError._1009); msgToErrMapBase.put("Unable to retrieve participant", IntegrationError._1010); msgToErrMapBase.put("Invalid Username/Password", IntegrationError._1011); msgToErrMapBase.put("User is not authorized on this Organization", IntegrationError._1012); msgToErrMapBase.put("could not be created in caAERS", IntegrationError._1014); msgToErrMapBase.put("Could not send Message", IntegrationError._1020); msgToErrMapBase.put("Study can't be changed while updating the Participant.", IntegrationError._1106); msgToErrMap = Collections.synchronizedMap(msgToErrMapBase); }
From source file:info.magnolia.cms.i18n.MessagesManager.java
/** * The lazzy LRU Map creates messages objects with a fault back to the default locale. *///from w w w . j a va2s .c om private static void intiLRUMap() { // FIXME use LRU //Map map = new LRUMap(20); Map map = new HashMap(); map = LazyMap.decorate(map, new Transformer() { public Object transform(Object input) { MessagesID id = (MessagesID) input; Messages msgs = new DefaultMessagesImpl(id.basename, id.locale); return msgs; } }); messages = Collections.synchronizedMap(map); }
From source file:org.apache.flink.client.web.JobSubmissionServlet.java
public JobSubmissionServlet(CliFrontend cli, File jobDir, File planDir) { this.cli = cli; this.jobStoreDirectory = jobDir; this.planDumpDirectory = planDir; this.submittedJobs = Collections.synchronizedMap(new HashMap<Long, JobGraph>()); this.rand = new Random(System.currentTimeMillis()); }
From source file:gov.nih.nci.integration.invoker.CaTissueUpdateSpecimenServiceInvocationStrategy.java
/** * Constructor/*from w ww . jav a2 s .c o m*/ * * @param retryCount - retryCount * @param caTissueSpecimenClient - caTissueSpecimenClient * @param xsltTransformer - xsltTransformer */ public CaTissueUpdateSpecimenServiceInvocationStrategy(int retryCount, CaTissueSpecimenClient caTissueSpecimenClient, XSLTTransformer xsltTransformer) { super(); this.retryCount = retryCount; this.caTissueSpecimenClient = caTissueSpecimenClient; this.xsltTransformer = xsltTransformer; final HashMap<String, IntegrationError> msgToErrMapBase = new LinkedHashMap<String, IntegrationError>(); msgToErrMapBase.put("Type is required", IntegrationError._1079); msgToErrMapBase.put("Specimen with the same LABEL already exists", IntegrationError._1080); msgToErrMapBase.put("Specimen Type is invalid", IntegrationError._1081); msgToErrMapBase.put("Tissue Side is invalid", IntegrationError._1082); msgToErrMapBase.put("Tissue Site is invalid", IntegrationError._1083); msgToErrMapBase.put("Specimen Collection Group not found in caTissue", IntegrationError._1084); msgToErrMapBase.put("Available Quantity cannot be greater than the Initial Quantity", IntegrationError._1085); msgToErrMapBase.put("Pathological Status is invalid", IntegrationError._1086); msgToErrMapBase.put("Collection Protocol Event can't be changed while updating the Specimen", IntegrationError._1087); msgToErrMapBase.put("Collection Protocol can't be changed while updating the Specimen", IntegrationError._1088); msgToErrMapBase.put("Specimen Class can't be changed while updating the Specimen", IntegrationError._1089); msgToErrMapBase.put("Specimen for given LABEL doesn't exist", IntegrationError._1090); msgToErrMapBase.put("Error occurred : Unable to rollback. Please check the logs.", IntegrationError._1093); msgToErrMapBase.put("\'Other Text\' should be provided only when a guidance of \'OTHER\' is selected.", IntegrationError._1095); msgToErrMapBase.put("Only one value for \'Guidance for breast core biopsy\' may be provided.", IntegrationError._1096); msgToErrMapBase.put("The value for \'Guidance for breast core biopsy\' is invalid.", IntegrationError._1097); msgToErrMapBase.put("Exception occurred while XSL transformation.", IntegrationError._1099); msgToErrMap = Collections.synchronizedMap(msgToErrMapBase); }