Java Collections.synchronizedMap Examples

Java Collections.synchronizedMap - 30 examples found. These are the top rated real world Java examples of java.util.Collections.synchronizedMap extracted from open source projects. You can rate examples to help us improve the quality of examples.
  /** Constructor */
  public PrideInspectorContext() {
    // instantiate data access monitor
    this.dataAccessMonitor = new DataAccessMonitor();

    // data content pane cache
    this.dataContentPaneCache =
        Collections.synchronizedMap(new HashMap<DataAccessController, JComponent>());

    // data summary pane cache
    this.dataSummaryPaneCache =
        Collections.synchronizedMap(new HashMap<DataAccessController, JComponent>());

    // action map
    this.sharedActionCache =
        Collections.synchronizedMap(
            new HashMap<DataAccessController, Map<Class<? extends PrideAction>, PrideAction>>());

    // summary report tracker
    this.summaryReportTracker =
        Collections.synchronizedMap(new HashMap<DataAccessController, ListModel>());

    // by default the data source browser is invisible
    this.leftControlPaneVisible = false;

    // set the default path for opening/saving files
    this.setOpenFilePath(System.getProperty("user.dir"));
  }
 @Override
 public boolean onUnbind(final Intent intent) {
   final Map<String, DictionaryPool> oldPools = mDictionaryPools;
   mDictionaryPools = Collections.synchronizedMap(new TreeMap<String, DictionaryPool>());
   final Map<String, Dictionary> oldUserDictionaries = mUserDictionaries;
   mUserDictionaries = Collections.synchronizedMap(new TreeMap<String, Dictionary>());
   final Map<String, Dictionary> oldWhitelistDictionaries = mWhitelistDictionaries;
   mWhitelistDictionaries = Collections.synchronizedMap(new TreeMap<String, Dictionary>());
   for (DictionaryPool pool : oldPools.values()) {
     pool.close();
   }
   for (Dictionary dict : oldUserDictionaries.values()) {
     dict.close();
   }
   for (Dictionary dict : oldWhitelistDictionaries.values()) {
     dict.close();
   }
   if (null != mContactsDictionary) {
     // The synchronously loaded contacts dictionary should have been in one
     // or several pools, but it is shielded against multiple closing and it's
     // safe to call it several times.
     final SynchronouslyLoadedContactsDictionary dictToClose = mContactsDictionary;
     mContactsDictionary = null;
     dictToClose.close();
   }
   return false;
 }
 /**
  * Constructor
  *
  * @param delegator The delegator instance
  */
 public UserTransactionRegistryImpl(org.jboss.tm.usertx.UserTransactionRegistry delegator) {
   this.delegator = delegator;
   this.listeners =
       Collections.synchronizedMap(
           new HashMap<UserTransactionListener, UserTransactionListenerImpl>());
   this.providers =
       Collections.synchronizedMap(
           new HashMap<UserTransactionProvider, UserTransactionProviderImpl>());
 }
Example #4
0
 public SearchDirector(IIndexingParameters parameters) {
   logger = LogFactory.getLog(getClass());
   crawlers = Collections.synchronizedMap(new HashMap<String, ICrawler>());
   runnables = Collections.synchronizedMap(new HashMap<ICrawler, RunnableCrawler>());
   runningCrawlers = Collections.synchronizedMap(new HashMap<String, Thread>());
   idxMgr = new IndexManager(parameters);
   stopped = false;
   this.parameters = parameters;
   registerCrawlers();
   logger.info("SearchDirector created.");
 }
  private ProxyManager() {
    this.stratumAuthorizationManager = new AuthorizationManager();
    this.pools = Collections.synchronizedList(new ArrayList<Pool>());
    this.workerConnections = new CopyOnWriteArrayList<WorkerConnection>();
    this.users = Collections.synchronizedMap(new HashMap<String, User>());
    this.poolWorkerConnections =
        Collections.synchronizedMap(new HashMap<Pool, Set<WorkerConnection>>());
    this.poolSwitchingStrategyFactory = new PoolSwitchingStrategyFactory(this);

    setPoolSwitchingStrategy(ConfigurationManager.getInstance().getPoolSwitchingStrategy());
  }
Example #6
0
  static {
    accountsByID = Collections.synchronizedMap(new HashMap<Integer, Account>());
    accountsByEmail = Collections.synchronizedMap(new HashMap<String, Account>());
    charactersByID = Collections.synchronizedMap(new HashMap<Integer, PlayerCharacter>());
    charactersByName = Collections.synchronizedMap(new HashMap<String, PlayerCharacter>());
    playersByID = Collections.synchronizedMap(new HashMap<Integer, ActivePlayer>());

    // TODO: Remove hardcoded account, useful for testing.
    Account daniel = new Account("d@l.com", "abcdef");
    new PlayerCharacter("Wally", daniel, CombatClass.WARRIOR);
    new PlayerCharacter("Maggie", daniel, CombatClass.MAGE);
  }