List of usage examples for org.apache.commons.collections.list SynchronizedList decorate
public static List decorate(List list)
From source file:com.marvelution.hudson.plugins.apiv2.cache.activity.ActivitiesCache.java
/** * Getter for getActivities()//from www .j a v a2s . c om * * @return the getActivities() */ @SuppressWarnings("unchecked") private List<ActivityCache> getActivities() { return SynchronizedList.decorate(activities); }
From source file:com.marvelution.hudson.plugins.apiv2.cache.issue.IssuesCache.java
/** * Getter for issues//from w ww.j a va 2s .c o m * * @return the issues */ @SuppressWarnings("unchecked") private List<IssueCache> getIssues() { return SynchronizedList.decorate(issues); }
From source file:org.apache.carbondata.processing.loading.sort.unsafe.merger.UnsafeIntermediateMerger.java
public UnsafeIntermediateMerger(SortParameters parameters) { this.parameters = parameters; // processed file list this.rowPages = new ArrayList<UnsafeCarbonRowPage>(CarbonCommonConstants.CONSTANT_SIZE_TEN); this.mergedPages = new ArrayList<>(); this.executorService = Executors.newFixedThreadPool(parameters.getNumberOfCores(), new CarbonThreadFactory("UnsafeIntermediatePool:" + parameters.getTableName())); this.procFiles = SynchronizedList.decorate(new ArrayList<File>(CarbonCommonConstants.CONSTANT_SIZE_TEN)); this.mergerTask = new ArrayList<>(); Integer spillPercentage = CarbonProperties.getInstance().getSortMemorySpillPercentage(); this.spillSizeInSortMemory = UnsafeSortMemoryManager.INSTANCE.getUsableMemory() * spillPercentage / 100; }
From source file:org.sipfoundry.sipxrelay.DataShuffler.java
private static synchronized void checkWorkQueue() { Iterator<WorkItem> it = null; it = workQueue.iterator();/*from w w w . j a v a 2 s . co m*/ if (!workQueue.isEmpty()) { workQueue = SynchronizedList.decorate(new LinkedList<WorkItem>()); } while (it.hasNext()) { logger.debug("Got a work item"); WorkItem workItem = it.next(); it.remove(); workItem.doWork(); } }
From source file:reactor.io.net.tcp.SmokeTests.java
@SuppressWarnings("unchecked") private List<Integer> getClientDatas(int threadCount, final Sender sender, int count) throws Exception { final CountDownLatch latch = new CountDownLatch(1); final List<Integer> datas = SynchronizedList.decorate(new ArrayList<>()); windowsData.clear();// w w w .j a v a 2s . co m Thread.sleep(1500); Runnable srunner = new Runnable() { public void run() { try { sender.sendNext(count); } catch (Exception ie) { ie.printStackTrace(); } } }; Thread st = new Thread(srunner, "SenderThread"); st.start(); CountDownLatch thread = new CountDownLatch(threadCount); AtomicInteger counter = new AtomicInteger(); for (int i = 0; i < threadCount; ++i) { Runnable runner = new Runnable() { public void run() { try { boolean empty = false; while (true) { List<String> res = getClientDataPromise(); if (res == null) { if (empty) break; empty = true; continue; } List<Integer> collected = parseCollection(res); Collections.sort(collected); int size = collected.size(); //previous empty if (size == 0 && empty) break; datas.addAll(collected); counter.addAndGet(size); empty = size == 0; System.out.println("Client received " + size + " elements, current total: " + counter + ", batches: " + integerPostConcat + ", between [ " + (size > 0 ? collected.get(0) + " -> " + collected.get(size - 1) : "") + " ]"); } System.out.println("Client finished"); } catch (Exception ie) { ie.printStackTrace(); } finally { thread.countDown(); } } }; Thread t = new Thread(runner, "SmokeThread" + i); t.start(); } latch.countDown(); thread.await(500, TimeUnit.SECONDS); return datas; }