List of usage examples for java.util Collections synchronizedSet
public static <T> Set<T> synchronizedSet(Set<T> s)
From source file:mitm.djigzo.web.pages.Domains.java
@SetupRender public void setupGrid() { if (selected == null) { selected = Collections.synchronizedSet(new HashSet<String>()); } else {//from w ww .ja v a 2s .c o m selected.clear(); } /* * set initial sorting if sorting is not yet set */ if (grid.getSortModel().getColumnSort(DOMAIN_COLUMN) == ColumnSort.UNSORTED) { grid.getSortModel().updateSort(DOMAIN_COLUMN); } }
From source file:com.google.maps.android.clustering.algo.GridBasedAlgorithm.java
@Override public void removeItemsNotInRectangle(LatLngBounds bounds) { synchronized (mItems) { Set<T> toRemove = Collections.synchronizedSet(new HashSet<T>()); for (T item : mItems) { if (!bounds.contains(item.getPosition())) { toRemove.add(item);//from w w w . ja v a 2s. c om } } mItems.removeAll(toRemove); } }
From source file:de.clusteval.framework.repository.RepositoryObject.java
/** * Instantiates a new repository object. * //from www .ja va2 s .c o m * @param repository * The repository this object is registered in. * @param register * Whether this object should be registered implicitely in the * repository or if the user wants to register manually later. * @param changeDate * The changedate of this object can be used for identification * and equality checks of objects. * @param absPath * The absolute path of this object is used for identification * and equality checks of objects. * @throws RegisterException */ public RepositoryObject(final Repository repository, final boolean register, final long changeDate, final File absPath) throws RegisterException { super(); this.repository = repository; this.changeDate = changeDate; this.listener = Collections.synchronizedSet(new HashSet<RepositoryListener>()); this.absPath = absPath; this.log = LoggerFactory.getLogger(this.getClass()); if (register) this.register(); }
From source file:mitm.djigzo.web.components.JamesRepositoryManager.java
@SetupRender public void setupRender() { if (selected == null) { selected = Collections.synchronizedSet(new HashSet<String>()); } else {/*from w ww. j a va2 s.c o m*/ selected.clear(); } }
From source file:org.apache.hadoop.hbase.client.transactional.TransactionState.java
public TransactionState(final long transactionId) { this.transactionId = transactionId; setStatus(TransState.STATE_ACTIVE); countLock = new Object(); commitSendLock = new Object(); requestPendingCount = 0;//w ww.j ava2s. c o m requestReceivedCount = 0; commitSendDone = false; hasError = false; ddlTrans = false; if (getCHMVariable) { String concurrentHM = System.getenv("DTM_USE_CONCURRENTHM"); if (concurrentHM != null) { useConcurrentHM = (Integer.parseInt(concurrentHM) == 0) ? false : true; } if (LOG.isTraceEnabled()) { if (useConcurrentHM) { LOG.trace("Using ConcurrentHashMap synchronization to synchronize participatingRegions"); } else { LOG.trace("Using synchronizedSet to synchronize participatingRegions"); } } getCHMVariable = false; } if (useConcurrentHM) { participatingRegions = Collections .newSetFromMap((new ConcurrentHashMap<TransactionRegionLocation, Boolean>())); } else { participatingRegions = Collections.synchronizedSet(new HashSet<TransactionRegionLocation>()); } String localTxns = System.getenv("DTM_LOCAL_TRANSACTIONS"); if (localTxns != null) { localTransaction = (Integer.parseInt(localTxns) == 0) ? false : true; //System.out.println("TS begin local txn id " + transactionId); if (LOG.isTraceEnabled()) LOG.trace("TransactionState local transaction begun: " + transactionId); } else { localTransaction = false; if (LOG.isTraceEnabled()) LOG.trace("TransactionState global transaction begun: " + transactionId); } }
From source file:mitm.djigzo.web.pages.SMS.java
@SetupRender @Secured({ FactoryRoles.ROLE_ADMIN, FactoryRoles.ROLE_SMS_MANAGER }) public void setupGrid() { if (selected == null) { selected = Collections.synchronizedSet(new HashSet<Long>()); } else {//www .j a v a 2s. com selected.clear(); } if (propertySortColumnMap.size() == 0) { propertySortColumnMap.put("phonenumber", SortColumn.PHONENUMBER); propertySortColumnMap.put("created", SortColumn.CREATED); propertySortColumnMap.put("lasttry", SortColumn.LAST_TRY); } }
From source file:com.amazon.alexa.avs.NotificationManager.java
NotificationManager(NotificationIndicator indicator, SimpleAudioPlayer audioPlayer, BasicHttpClient httpClient, FileDataStore<NotificationsStatePayload> dataStore) { this.notificationIndicator = indicator; this.player = audioPlayer; this.assets = Collections.synchronizedMap(new HashMap<String, File>()); this.indicatorExecutor = Executors.newSingleThreadExecutor(); this.assetDownloader = Executors.newCachedThreadPool(); this.allowPersistentIndicator = new AtomicBoolean(true); this.httpClient = httpClient; this.isSetIndicatorPersisted = new AtomicBoolean(false); this.indicatorStatus = Status.NONE; this.dataStore = dataStore; this.indicatorFutures = Collections.synchronizedSet(new HashSet<Future<?>>()); this.activeAudioAsset = new AtomicReference<String>(""); this.resLoader = Thread.currentThread().getContextClassLoader(); }
From source file:com.gokuai.yunkuandroidsdk.imageutils.ImageCache.java
/** * Initialize the cache, providing all parameters. * * @param cacheParams The cache parameters to initialize the cache *///from w w w . j a v a 2 s .co m private void init(ImageCacheParams cacheParams) { mCacheParams = cacheParams; // Set up memory cache if (mCacheParams.memoryCacheEnabled) { // If we're running on Honeycomb or newer, then if (Utils.hasHoneycomb()) { mReusableBitmaps = Collections.synchronizedSet(new HashSet<SoftReference<Bitmap>>()); } mMemoryCache = new LruCache<String, BitmapDrawable>(mCacheParams.memCacheSize) { /** * Notify the removed entry that is no longer being cached */ @Override protected void entryRemoved(boolean evicted, String key, BitmapDrawable oldValue, BitmapDrawable newValue) { if (RecyclingBitmapDrawable.class.isInstance(oldValue)) { // The removed entry is a recycling drawable, so notify it // that it has been removed from the memory cache ((RecyclingBitmapDrawable) oldValue).setIsCached(false); } else { // The removed entry is a standard BitmapDrawable if (Utils.hasHoneycomb()) { // We're running on Honeycomb or later, so add the bitmap // to a SoftRefrence set for possible use with inBitmap later mReusableBitmaps.add(new SoftReference<Bitmap>(oldValue.getBitmap())); } } } /** * Measure item size in kilobytes rather than units which is more practical * for a bitmap cache */ @Override protected int sizeOf(String key, BitmapDrawable value) { final int bitmapSize = getBitmapSize(value) / 1024; return bitmapSize == 0 ? 1 : bitmapSize; } }; } // By default the disk cache is not initialized here as it should be initialized // on a separate thread due to disk access. if (cacheParams.initDiskCacheOnCreate) { // Set up disk cache initDiskCache(); } }
From source file:mitm.djigzo.web.pages.ca.CARequests.java
@SetupRender @Secured({ FactoryRoles.ROLE_ADMIN, FactoryRoles.ROLE_PKI_MANAGER }) protected void setupRender() { if (selected == null) { selected = Collections.synchronizedSet(new HashSet<String>()); } else {//from w ww . j av a2 s . com selected.clear(); } }
From source file:edu.cornell.mannlib.vitro.webapp.tboxreasoner.impl.BasicTBoxReasonerDriver.java
public BasicTBoxReasonerDriver(OntModel assertionsModel, Model inferencesModel, OntModel fullModel, TBoxReasoner reasoner, ReasonerConfiguration reasonerConfiguration) { this.lockableAssertionsModel = new LockableOntModel(assertionsModel); this.lockableInferencesModel = new LockableModel(inferencesModel); this.lockableFullModel = new LockableOntModel(fullModel); this.reasoner = reasoner; this.reasonerConfiguration = reasonerConfiguration; this.listener = new ConfiguredReasonerListener(reasonerConfiguration, this); this.pendingChangeSets = Collections.synchronizedSet(new HashSet<TBoxChanges>()); this.executorService = Executors.newFixedThreadPool(1, new VitroBackgroundThread.Factory("TBoxReasoner")); assertionsModel.getBaseModel().register(listener); fullModel.getBaseModel().register(listener); doInitialReasoning();/*from www. j ava2 s. c om*/ }