java.util.AbstractQueue Java Examples
The following examples show how to use
java.util.AbstractQueue.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FSStorage.java From fqueue with Apache License 2.0 | 6 votes |
/** * 获取指定名称的队列存储实例 如果不存存在,根据create参数决定是否创建 * * @param name * @return * @throws Exception */ private AbstractQueue<byte[]> getClientQueue(String name, boolean create) throws Exception { AbstractQueue<byte[]> queue = queuemMap.get(name); if (queue == null) { if (create == true) { lock.lock(); try { queue = queuemMap.get(name); if (queue == null) { queue = new FQueue(dbpath + "/" + name, logSize); queuemMap.put(name, queue); } } finally { lock.unlock(); } } } return queue; }
Example #2
Source File: FSStorage.java From fqueue with Apache License 2.0 | 6 votes |
/** * 获取指定名称的队列存储实例 如果不存存在,根据create参数决定是否创建 * * @param name * @return * @throws Exception */ private AbstractQueue<byte[]> getClientQueue(String name, boolean create) throws Exception { AbstractQueue<byte[]> queue = queuemMap.get(name); if (queue == null) { if (create == true) { lock.lock(); try { queue = queuemMap.get(name); if (queue == null) { queue = new FQueue(dbpath + "/" + name, logSize); queuemMap.put(name, queue); } } finally { lock.unlock(); } } } return queue; }
Example #3
Source File: QueuedBuildData.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public Queue<URI> getQueue(String projectName) { final LinkedHashSetQueue<URI> list = projectNameToChangedResource.get(projectName); if (list == null) return uris; return new AbstractQueue<URI>() { @Override public boolean offer(URI o) { return list.offer(o); } @Override public URI poll() { if (uris.isEmpty()) return list.poll(); return uris.poll(); } @Override public URI peek() { if (uris.isEmpty()) return list.peek(); return uris.peek(); } @Override public Iterator<URI> iterator() { return Iterators.concat(uris.iterator(), list.iterator()); } @Override public int size() { return uris.size() + list.size(); } }; }
Example #4
Source File: LoadThread.java From yuzhouwan with Apache License 2.0 | 5 votes |
public void run() { AbstractQueue<String> queue = new ArrayBlockingQueue<>(GCTest.countDownSize); for (int i = 0, finishedUnit = 0; ; i = i + 1) { // Simulate object use to force promotion into OldGen and then GC if (queue.size() >= GCTest.countDownSize) { for (int j = 0; j < GCTest.eachRemoveSize; j++) queue.remove(); finishedUnit++; // every 1000 removal is counted as 1 unit. if (System.currentTimeMillis() - TIME_ZERO > GCTest.duration * 1000) System.exit(0); System.out.println(SIMPLE_DATE_FORMAT.format(new Date()) + " finished Units (1K) = " + finishedUnit); } queue.add(new String(new char[GCTest.referenceSize]).replace('\0', 'a')); } }
Example #5
Source File: AbstractQueueJsonDeserializer.java From domino-jackson with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected AbstractQueue<T> newCollection() { return new PriorityQueue<T>(); }
Example #6
Source File: AbstractQueueRandomGeneratorTest.java From openpojo with Apache License 2.0 | 4 votes |
@Override protected Class<? extends Collection> getExpectedTypeClass() { return AbstractQueue.class; }
Example #7
Source File: AbstractQueueJsonDeserializer.java From gwt-jackson with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected AbstractQueue<T> newCollection() { return new PriorityQueue<T>(); }
Example #8
Source File: FSStorage.java From fqueue with Apache License 2.0 | 2 votes |
/** * 获取或者创建指定名称的队列存储实例 * * @param name * @return * @throws Exception */ private AbstractQueue<byte[]> getClientQueue(String name) throws Exception { return getClientQueue(name, true); }
Example #9
Source File: FSStorage.java From fqueue with Apache License 2.0 | 2 votes |
/** * 获取或者创建指定名称的队列存储实例 * * @param name * @return * @throws Exception */ private AbstractQueue<byte[]> getClientQueue(String name) throws Exception { return getClientQueue(name, true); }