mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-27 03:27:37 +01:00
Made Queue more accessable. Added Processor
This commit is contained in:
parent
3a0cb7c33e
commit
812e44b598
@ -13,8 +13,8 @@ import java.util.concurrent.BlockingQueue;
|
||||
*/
|
||||
public abstract class Consumer<T> extends AbsRunnable {
|
||||
|
||||
final BlockingQueue<T> queue;
|
||||
boolean run;
|
||||
protected final BlockingQueue<T> queue;
|
||||
protected boolean run;
|
||||
|
||||
/**
|
||||
* Constructor, defines queue.
|
||||
@ -40,12 +40,12 @@ public abstract class Consumer<T> extends AbsRunnable {
|
||||
}
|
||||
}
|
||||
|
||||
void stop() {
|
||||
protected void stop() {
|
||||
run = false;
|
||||
super.cancel();
|
||||
}
|
||||
|
||||
abstract void clearVariables();
|
||||
protected abstract void clearVariables();
|
||||
|
||||
abstract void consume(T toConsume);
|
||||
protected abstract void consume(T toConsume);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ class ClearConsumer extends Consumer<UUID> implements Runnable {
|
||||
}
|
||||
|
||||
@Override
|
||||
void consume(UUID uuid) {
|
||||
protected void consume(UUID uuid) {
|
||||
if (!Verify.notNull(handler, uuid)) {
|
||||
return;
|
||||
}
|
||||
@ -88,7 +88,7 @@ class ClearConsumer extends Consumer<UUID> implements Runnable {
|
||||
}
|
||||
|
||||
@Override
|
||||
void clearVariables() {
|
||||
protected void clearVariables() {
|
||||
if (handler != null) {
|
||||
handler = null;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ class GetConsumer extends Consumer<Map<UUID, List<DBCallableProcessor>>> {
|
||||
}
|
||||
|
||||
@Override
|
||||
void consume(Map<UUID, List<DBCallableProcessor>> processors) {
|
||||
protected void consume(Map<UUID, List<DBCallableProcessor>> processors) {
|
||||
if (!Verify.notNull(processors, db)) {
|
||||
return;
|
||||
}
|
||||
@ -89,7 +89,7 @@ class GetConsumer extends Consumer<Map<UUID, List<DBCallableProcessor>>> {
|
||||
}
|
||||
|
||||
@Override
|
||||
void clearVariables() {
|
||||
protected void clearVariables() {
|
||||
if (db != null) {
|
||||
db = null;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ class ProcessConsumer extends Consumer<HandlingInfo> {
|
||||
}
|
||||
|
||||
@Override
|
||||
void consume(HandlingInfo info) {
|
||||
protected void consume(HandlingInfo info) {
|
||||
if (!Verify.notNull(handler, info)) {
|
||||
return;
|
||||
}
|
||||
@ -88,7 +88,7 @@ class ProcessConsumer extends Consumer<HandlingInfo> {
|
||||
}
|
||||
|
||||
@Override
|
||||
void clearVariables() {
|
||||
protected void clearVariables() {
|
||||
if (handler != null) {
|
||||
handler = null;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class SaveConsumer extends Consumer<UserData> {
|
||||
}
|
||||
|
||||
@Override
|
||||
void consume(UserData data) {
|
||||
protected void consume(UserData data) {
|
||||
if (!Verify.notNull(handler, db, data)) {
|
||||
return;
|
||||
}
|
||||
@ -106,7 +106,7 @@ class SaveConsumer extends Consumer<UserData> {
|
||||
}
|
||||
|
||||
@Override
|
||||
void clearVariables() {
|
||||
protected void clearVariables() {
|
||||
if (db != null) {
|
||||
db = null;
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ import java.util.concurrent.BlockingQueue;
|
||||
*/
|
||||
public abstract class Queue<T> {
|
||||
|
||||
final BlockingQueue<T> queue;
|
||||
Setup<T> setup;
|
||||
protected final BlockingQueue<T> queue;
|
||||
protected Setup<T> setup;
|
||||
|
||||
/**
|
||||
* Constructor, defines queue.
|
||||
|
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Licence is provided in the jar as license.yml also here:
|
||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.queue.processing;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public interface Processor<T> {
|
||||
public void process(T object);
|
||||
}
|
Loading…
Reference in New Issue
Block a user