PicassoExecutorService(ThreadFactory threadFactory) { super(DEFAULT_THREAD_COUNT, DEFAULT_THREAD_COUNT, 0, TimeUnit.MILLISECONDS, new PriorityBlockingQueue<Runnable>(), threadFactory); }
TimeBasedTaskScheduler( SystemNanoClock clock, ThreadPoolManager pools ) { this.clock = clock; this.pools = pools; delayedTasks = new PriorityBlockingQueue<>( 42, DEADLINE_COMPARATOR ); }
public CustomLooper() { pendingMessages = new PriorityBlockingQueue<>(); removedMessages = new CopyOnWriteArraySet<>(); }
@Override public Queue<String> create(String[] elements) { return new PriorityBlockingQueue<>(MinimalCollection.of(elements)); } })
/** * Creates an empty {@code PriorityBlockingQueue} with the ordering given by its elements' natural * ordering. * * @since 11.0 (requires that {@code E} be {@code Comparable} since 15.0). */ @GwtIncompatible // PriorityBlockingQueue public static <E extends Comparable> PriorityBlockingQueue<E> newPriorityBlockingQueue() { return new PriorityBlockingQueue<E>(); }
/** * Creates a {@code PriorityBlockingQueue} containing the given elements. * * <p><b>Note:</b> If the specified iterable is a {@code SortedSet} or a {@code PriorityQueue}, * this priority queue will be ordered according to the same ordering. * * @since 11.0 (requires that {@code E} be {@code Comparable} since 15.0). */ @GwtIncompatible // PriorityBlockingQueue public static <E extends Comparable> PriorityBlockingQueue<E> newPriorityBlockingQueue( Iterable<? extends E> elements) { if (elements instanceof Collection) { return new PriorityBlockingQueue<E>(Collections2.cast(elements)); } PriorityBlockingQueue<E> queue = new PriorityBlockingQueue<E>(); Iterables.addAll(queue, elements); return queue; }
/** * Creates a prioritized taskmaster which uses {@link Comparable} Tasks to establish priority. The <em>least</em> * task (according to the Comparable interface) is processed first. */ public static <T extends Task & Comparable<? super T>> TaskMaster<T> createPriorityTaskMaster(String name, int threads, int queueSize) { return new TaskMaster<>(name, threads, new PriorityBlockingQueue<>(queueSize)); }
/** * Creates an empty {@code PriorityBlockingQueue} with the ordering given by its elements' natural * ordering. * * @since 11.0 (requires that {@code E} be {@code Comparable} since 15.0). */ @GwtIncompatible // PriorityBlockingQueue public static <E extends Comparable> PriorityBlockingQueue<E> newPriorityBlockingQueue() { return new PriorityBlockingQueue<E>(); }
/** * Creates an empty {@code PriorityBlockingQueue} with the ordering given by its elements' natural * ordering. * * @since 11.0 (requires that {@code E} be {@code Comparable} since 15.0). */ @GwtIncompatible // PriorityBlockingQueue public static <E extends Comparable> PriorityBlockingQueue<E> newPriorityBlockingQueue() { return new PriorityBlockingQueue<E>(); }
/** * Creates an empty {@code PriorityBlockingQueue} with the ordering given by its elements' natural * ordering. * * @since 11.0 (requires that {@code E} be {@code Comparable} since 15.0). */ @GwtIncompatible // PriorityBlockingQueue public static <E extends Comparable> PriorityBlockingQueue<E> newPriorityBlockingQueue() { return new PriorityBlockingQueue<E>(); }
/** * Creates a {@code PriorityBlockingQueue} containing the given elements. * * <p><b>Note:</b> If the specified iterable is a {@code SortedSet} or a {@code PriorityQueue}, * this priority queue will be ordered according to the same ordering. * * @since 11.0 (requires that {@code E} be {@code Comparable} since 15.0). */ @GwtIncompatible // PriorityBlockingQueue public static <E extends Comparable> PriorityBlockingQueue<E> newPriorityBlockingQueue( Iterable<? extends E> elements) { if (elements instanceof Collection) { return new PriorityBlockingQueue<E>(Collections2.cast(elements)); } PriorityBlockingQueue<E> queue = new PriorityBlockingQueue<E>(); Iterables.addAll(queue, elements); return queue; }
/** * Returns a new cached thread pool with the given thread count and * {@link UncaughtThrowableStrategy} to use when loading frames of animations. */ // Public API. @SuppressWarnings("WeakerAccess") public static GlideExecutor newAnimationExecutor( int threadCount, UncaughtThrowableStrategy uncaughtThrowableStrategy) { return new GlideExecutor( new ThreadPoolExecutor( 0 /* corePoolSize */, threadCount, KEEP_ALIVE_TIME_MS, TimeUnit.MILLISECONDS, new PriorityBlockingQueue<Runnable>(), new DefaultThreadFactory( ANIMATION_EXECUTOR_NAME, uncaughtThrowableStrategy, true))); }
/** * Returns a new fixed thread pool with the given thread count, thread name prefix, * and {@link com.bumptech.glide.load.engine.executor.GlideExecutor.UncaughtThrowableStrategy}. * * <p>Source executors allow network operations on their threads. * * @param threadCount The number of threads. * @param name The prefix for each thread name. * @param uncaughtThrowableStrategy The {@link * com.bumptech.glide.load.engine.executor.GlideExecutor.UncaughtThrowableStrategy} to use to * handle uncaught exceptions. */ // Public API. @SuppressWarnings("WeakerAccess") public static GlideExecutor newSourceExecutor( int threadCount, String name, UncaughtThrowableStrategy uncaughtThrowableStrategy) { return new GlideExecutor( new ThreadPoolExecutor( threadCount /* corePoolSize */, threadCount /* maximumPoolSize */, 0 /* keepAliveTime */, TimeUnit.MILLISECONDS, new PriorityBlockingQueue<Runnable>(), new DefaultThreadFactory(name, uncaughtThrowableStrategy, false))); }
/** * Returns a new fixed thread pool with the given thread count, thread name prefix, * and {@link com.bumptech.glide.load.engine.executor.GlideExecutor.UncaughtThrowableStrategy}. * * <p>Disk cache executors do not allow network operations on their threads. * * @param threadCount The number of threads. * @param name The prefix for each thread name. * @param uncaughtThrowableStrategy The {@link * com.bumptech.glide.load.engine.executor.GlideExecutor.UncaughtThrowableStrategy} to use to * handle uncaught exceptions. */ // Public API. @SuppressWarnings("WeakerAccess") public static GlideExecutor newDiskCacheExecutor( int threadCount, String name, UncaughtThrowableStrategy uncaughtThrowableStrategy) { return new GlideExecutor( new ThreadPoolExecutor( threadCount /* corePoolSize */, threadCount /* maximumPoolSize */, 0 /* keepAliveTime */, TimeUnit.MILLISECONDS, new PriorityBlockingQueue<Runnable>(), new DefaultThreadFactory(name, uncaughtThrowableStrategy, true))); }
public CustomLooper() { pendingMessages = new PriorityBlockingQueue<>(); removedMessages = new CopyOnWriteArraySet<>(); }
/** * Creates a {@code PriorityBlockingQueue} containing the given elements. * * <p><b>Note:</b> If the specified iterable is a {@code SortedSet} or a {@code PriorityQueue}, * this priority queue will be ordered according to the same ordering. * * @since 11.0 (requires that {@code E} be {@code Comparable} since 15.0). */ @GwtIncompatible // PriorityBlockingQueue public static <E extends Comparable> PriorityBlockingQueue<E> newPriorityBlockingQueue( Iterable<? extends E> elements) { if (elements instanceof Collection) { return new PriorityBlockingQueue<E>(Collections2.cast(elements)); } PriorityBlockingQueue<E> queue = new PriorityBlockingQueue<E>(); Iterables.addAll(queue, elements); return queue; }
public static List<BlockingQueue<Object>> blockingQueues() { return ImmutableList.<BlockingQueue<Object>>of( new LinkedBlockingQueue<Object>(), new LinkedBlockingQueue<Object>(10), new SynchronousQueue<Object>(), new ArrayBlockingQueue<Object>(10), new LinkedBlockingDeque<Object>(), new LinkedBlockingDeque<Object>(10), new PriorityBlockingQueue<Object>(10, Ordering.arbitrary())); }
public QueuedExecutions(final long capacity) { this.capacity = capacity; this.queuedFlowMap = new ConcurrentHashMap<>(); this.queuedFlowList = new PriorityBlockingQueue<>(10, new ExecutableFlowPriorityComparator()); }
public TriggerScannerThread(final long scannerInterval) { this.triggers = new PriorityBlockingQueue<>(1, new TriggerComparator()); this.setName("TriggerRunnerManager-Trigger-Scanner-Thread"); this.scannerInterval = scannerInterval; }
@Before public void setUp() throws Exception { walQueue = new PriorityBlockingQueue<>(); pathWatcher = new PathWatcher(); final WALFactory wals = new WALFactory(CONF, tn.getMethodName()); wals.getWALProvider().addWALActionsListener(pathWatcher); log = wals.getWAL(info); }