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.google.code.pentahoflashcharts.charts.PentahoOFC4JChartHelper.java
@SuppressWarnings({ "unchecked" }) protected static Map getChartFactories() { if (factories == null) { factories = Collections.synchronizedMap(createChartFactoryMap()); }/*from w ww .j ava2s .c o m*/ return factories; }
From source file:org.apache.ambari.view.hive.resources.jobs.ResultsPaginationController.java
private Map<String, Cursor> getResultsCache() { if (resultsCache == null) { PassiveExpiringMap<String, Cursor> resultsCacheExpiringMap = new PassiveExpiringMap<String, Cursor>( new CustomTimeToLiveExpirationPolicy(EXPIRING_TIME)); resultsCache = Collections.synchronizedMap(resultsCacheExpiringMap); }//from ww w .ja va 2 s . c o m return resultsCache; }
From source file:com.launchkey.example.springmvc.AuthManager.java
@Autowired public AuthManager(LaunchKeyConfig config) throws ConfigurationException, IOException { final Long rocketKey = config.getRocketKey(); final String secretKey = config.getSecretKey(); final String privateKeyLocation = config.getPrivateKeyLocation(); boolean halt = false; if (rocketKey == null) { log.error("launchkey.rocket-key property not provided"); halt = true;/*ww w. java2s. c om*/ } if (secretKey == null) { log.error("launchkey.secret-key property not provided"); halt = true; } if (privateKeyLocation == null) { log.error("launchkey.private-key-location property not provided"); halt = true; } if (halt) throw new ConfigurationException("Missing required LaunchKey configuration"); BufferedReader br = new BufferedReader(new FileReader(privateKeyLocation)); StringBuilder sb = new StringBuilder(); try { String line = br.readLine(); while (line != null) { sb.append(line); sb.append("\n"); line = br.readLine(); } } finally { br.close(); } String privateKey = sb.toString(); LaunchKeyClient launchKeyClient = LaunchKeyClient.factory(rocketKey, secretKey, privateKey, new BouncyCastleProvider()); this.authService = launchKeyClient.auth(); this.sessionAuthenticationMap = Collections.synchronizedMap(new HashMap<String, Boolean>()); this.sessionAuthRequestMap = new ConcurrentHashMap<String, String>(); this.userHashSessionMap = new ConcurrentHashMap<String, List<String>>(); }
From source file:org.jdesktop.wonderland.modules.service.PendingManager.java
/** * Constructor, takes the root directory of the module manager *//* ww w . ja v a2 s .c o m*/ public PendingManager(File root) { /* Create the pending directory if it does not exist */ this.pendingFile = new File(root, PENDING_DIR); try { ModuleManagerUtils.makeDirectory(this.pendingFile); } catch (java.io.IOException excp) { ModuleManager.getLogger().log(Level.SEVERE, "[MODULES] Failed to Create Pending Directory ", excp); } /* Read the map of pending modules */ this.pendingModules = Collections.synchronizedMap(this.fetchModules()); }
From source file:uk.ac.sanger.cgp.dbcon.sqllibs.SqlLibraries.java
/** * Private default constructor to avoid class initalisation *///from ww w .j a v a 2s .com private SqlLibraries() { super(); libraries = Collections.synchronizedMap(new LinkedHashMap()); }
From source file:com.intel.cosbench.controller.service.COSBControllerService.java
public void init() { if (this.context == null) { LOGGER.error("Controller Context is not initialized."); System.exit(-1);//from www .j a v a2 s . c om } // initialize workload archiver and loader String archive_dir = context.getArchive_dir(); archiver = new SimpleWorkloadArchiver(archive_dir); loader = new SimpleWorkloadLoader(archive_dir); count = new AtomicInteger(archiver.getTotalWorkloads()); order = new AtomicInteger(0); processors = new HashMap<String, WorkloadProcessor>(); processors = Collections.synchronizedMap(processors); int concurrency = context.getConcurrency(); executor = new OrderThreadPoolExecutor(concurrency, concurrency, 0L, TimeUnit.MILLISECONDS, new PriorityBlockingQueue<Runnable>(memRepo.getMaxCapacity(), new OrderFutureComparator())); }
From source file:com.emc.ecs.sync.filter.GladinetMappingFilter.java
public GladinetMappingFilter() { dirCache = Collections.synchronizedMap(new WeakHashMap<String, String>()); idCache = Collections.synchronizedMap(new WeakHashMap<String, ObjectId>()); random = new Random(); baseDir = ""; }
From source file:org.kepler.objectmanager.ObjectManager.java
/** * Empty constructor//w w w.ja v a 2 s . c o m */ public ObjectManager() { //_namedObjs = new WeakHashMap<KeplerLSID, NamedObj>(1); HashMap<KeplerLSID, NamedObj> hashMap = new HashMap<KeplerLSID, NamedObj>(1); _namedObjs = Collections.synchronizedMap(hashMap); }
From source file:gov.nih.nci.integration.caaers.invoker.CaAERSRegistrationServiceInvocationStrategy.java
/** * Constructor/*from w ww . j a v a 2s.co m*/ * * @param xsltTransformer - XSLTTransformer * @param client - CaAERSParticipantServiceWSClient * @param retryCount - retryCount */ public CaAERSRegistrationServiceInvocationStrategy(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("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); msgToErrMap = Collections.synchronizedMap(msgToErrMapBase); }
From source file:org.eclipse.php.internal.core.model.PerFileModelAccessCache.java
/** * Constructs new cache/*from w w w. j a v a2 s.c o m*/ * * @param sourceModule * Current file */ public PerFileModelAccessCache(ISourceModule sourceModule) { this.sourceModule = sourceModule; allTraitsCache = Collections.synchronizedMap(new HashMap<String, Collection<IType>>()); allTypesCache = Collections.synchronizedMap(new HashMap<String, Collection<IType>>()); allNamespacesCache = Collections.synchronizedMap(new HashMap<String, Collection<IType>>()); }