mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-02 19:36:41 +00:00
Javadoc and Formatting fixes. Also, extremely minor code changes which have been tested. This commit is only part one of two commits that aim to fix problems with formatting in our project. In part two I will modify the Google Java Style Guide (since it closely matches our code style) for our project so there is guidance on how to format and document. * Updated PlotSquared URL * Removed plugin acronyms * Fixed a typo * Fixed grammar * Use modern block id's * Update YouTube video URL
30 lines
633 B
Java
30 lines
633 B
Java
package com.boydti.fawe.beta.implementation.queue;
|
|
|
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
|
import java.util.function.Supplier;
|
|
|
|
public class QueuePool<T> extends ConcurrentLinkedQueue<T> implements Pool<T> {
|
|
private final Supplier<T> supplier;
|
|
|
|
public QueuePool(Supplier<T> supplier) {
|
|
this.supplier = supplier;
|
|
}
|
|
|
|
@Override
|
|
public T poll() {
|
|
T result = super.poll();
|
|
if (result == null) {
|
|
return supplier.get();
|
|
}
|
|
return result;
|
|
}
|
|
|
|
@Override
|
|
public void clear() {
|
|
if (!isEmpty()) {
|
|
super.clear();
|
|
}
|
|
}
|
|
}
|
|
|