List of usage examples for java.util Collections synchronizedList
public static <T> List<T> synchronizedList(List<T> list)
From source file:it.anyplace.sync.discovery.utils.AddressRanker.java
private AddressRanker(Iterable<DeviceAddress> sourceAddresses) { this.sourceAddresses = Collections.unmodifiableList(Lists.newArrayList(sourceAddresses)); this.targetAddresses = Collections.synchronizedList(Lists.<DeviceAddress>newArrayList()); }
From source file:org.rifidi.edge.core.sensors.SensorSession.java
/** * Constructor./*from w w w .jav a 2 s.co m*/ * * @param ID * The ID of the session * @param sensor * The Sensor this session belongs to */ public SensorSession(String ID, AbstractSensor<?> sensor) { this.ID = ID; this.sensor = sensor; this.commands = Collections.synchronizedList(new LinkedList<CommandDTO>()); }
From source file:org.jactr.core.runtime.ACTRRuntime.java
protected ACTRRuntime() { _allModels = Collections.synchronizedList(new ArrayList<IModel>()); _eventDispatcher = new ACTREventDispatcher<ACTRRuntime, IACTRRuntimeListener>(); setConnector(new LocalConnector()); setWorkingDirectory(new File(System.getProperty("user.dir"))); }
From source file:org.lilyproject.repository.bulk.serial.ThreadedRecordWriter.java
public ThreadedRecordWriter(String lilyZk, int numThreads, String repositoryName, String tableName, boolean bulkMode) { this.lilyZk = lilyZk; this.repositoryName = repositoryName; this.tableName = tableName; this.bulkMode = bulkMode; executor = new ThreadPoolExecutor(numThreads, numThreads, 10, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(5)); executor.setRejectedExecutionHandler(new WaitPolicy()); threadLocalBulkIngesters = new ThreadLocal<BulkIngester>(); bulkIngesters = Collections.synchronizedList(Lists.<BulkIngester>newArrayList()); }
From source file:channellistmaker.listmaker.fileseeker.FileSeeker.java
/** * ???????/*ww w . j av a2 s. co m*/ * * @return ?????? ?????????null */ public synchronized List<File> seek() { if (this.SourceDir.isDirectory()) { List<File> list = Collections.synchronizedList(new ArrayList<File>()); Collection<File> files = FileUtils.listFiles(this.SourceDir, this.seekType, this.dirf); list.addAll(files); return list; } else { return null; } }
From source file:org.rdv.data.LocalChannelManager.java
/** * Creates the local channel manager. */ private LocalChannelManager() { channels = Collections.synchronizedList(new ArrayList<LocalChannel>()); }
From source file:org.apache.hadoop.util.PluginDispatcher.java
PluginDispatcher(Collection<T> plugins) {
this.plugins = Collections.synchronizedList(new ArrayList<T>(plugins));
executor = Executors.newSingleThreadExecutor();
}
From source file:com.taobao.weex.dom.WXRecyclerDomObject.java
@Override public void add(WXDomObject child, int index) { if (WXBasicComponentType.CELL_SLOT.equals(child.getType()) && child instanceof WXCellDomObject) { if (cellList == null) { cellList = Collections.synchronizedList(new ArrayList<WXCellDomObject>()); }//from w w w . j ava 2 s. co m cellList.add((WXCellDomObject) child); } else { super.add(child, index); } if (WXBasicComponentType.CELL.equals(child.getType()) || WXBasicComponentType.CELL_SLOT.equals(child.getType())) { if (!mIsPreCalculateCellWidth) { preCalculateCellWidth(); } if (mColumnWidth != 0 && mColumnWidth != Float.NaN) { child.getStyles().put(Constants.Name.WIDTH, mColumnWidth); } } }
From source file:net.jodah.failsafe.internal.actions.DoThrowAction.java
private DoThrowAction(DoThrowAction<R> action) { super(action); this.arguments = action.arguments; this.throwables = action.throwables; this.current = Collections.synchronizedList(new LinkedList<>(action.throwables)); }
From source file:org.apache.roller.weblogger.business.HitCountQueue.java
private HitCountQueue() { String sleep = WebloggerConfig.getProperty("hitcount.queue.sleepTime", "180"); try {/*from w w w .j ava 2 s . c o m*/ // multiply by 1000 because we expect input in seconds this.sleepTime = Integer.parseInt(sleep) * 1000; } catch (NumberFormatException nfe) { log.warn("Invalid sleep time [" + sleep + "], using default"); } // create the hits queue this.queue = Collections.synchronizedList(new ArrayList()); // start up a worker to process the hits at intervals HitCountProcessingJob job = new HitCountProcessingJob(); worker = new ContinuousWorkerThread("HitCountQueueProcessor", job, this.sleepTime); worker.start(); }