mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-27 19:47:49 +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 {
|
public abstract class Consumer<T> extends AbsRunnable {
|
||||||
|
|
||||||
final BlockingQueue<T> queue;
|
protected final BlockingQueue<T> queue;
|
||||||
boolean run;
|
protected boolean run;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor, defines queue.
|
* Constructor, defines queue.
|
||||||
@ -40,12 +40,12 @@ public abstract class Consumer<T> extends AbsRunnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void stop() {
|
protected void stop() {
|
||||||
run = false;
|
run = false;
|
||||||
super.cancel();
|
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
|
@Override
|
||||||
void consume(UUID uuid) {
|
protected void consume(UUID uuid) {
|
||||||
if (!Verify.notNull(handler, uuid)) {
|
if (!Verify.notNull(handler, uuid)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ class ClearConsumer extends Consumer<UUID> implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void clearVariables() {
|
protected void clearVariables() {
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
handler = null;
|
handler = null;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ class GetConsumer extends Consumer<Map<UUID, List<DBCallableProcessor>>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void consume(Map<UUID, List<DBCallableProcessor>> processors) {
|
protected void consume(Map<UUID, List<DBCallableProcessor>> processors) {
|
||||||
if (!Verify.notNull(processors, db)) {
|
if (!Verify.notNull(processors, db)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ class GetConsumer extends Consumer<Map<UUID, List<DBCallableProcessor>>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void clearVariables() {
|
protected void clearVariables() {
|
||||||
if (db != null) {
|
if (db != null) {
|
||||||
db = null;
|
db = null;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ class ProcessConsumer extends Consumer<HandlingInfo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void consume(HandlingInfo info) {
|
protected void consume(HandlingInfo info) {
|
||||||
if (!Verify.notNull(handler, info)) {
|
if (!Verify.notNull(handler, info)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ class ProcessConsumer extends Consumer<HandlingInfo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void clearVariables() {
|
protected void clearVariables() {
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
handler = null;
|
handler = null;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ class SaveConsumer extends Consumer<UserData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void consume(UserData data) {
|
protected void consume(UserData data) {
|
||||||
if (!Verify.notNull(handler, db, data)) {
|
if (!Verify.notNull(handler, db, data)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ class SaveConsumer extends Consumer<UserData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void clearVariables() {
|
protected void clearVariables() {
|
||||||
if (db != null) {
|
if (db != null) {
|
||||||
db = null;
|
db = null;
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ import java.util.concurrent.BlockingQueue;
|
|||||||
*/
|
*/
|
||||||
public abstract class Queue<T> {
|
public abstract class Queue<T> {
|
||||||
|
|
||||||
final BlockingQueue<T> queue;
|
protected final BlockingQueue<T> queue;
|
||||||
Setup<T> setup;
|
protected Setup<T> setup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor, defines queue.
|
* 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