Made Queue more accessable. Added Processor

This commit is contained in:
Rsl1122 2017-08-20 14:10:03 +03:00
parent 3a0cb7c33e
commit 812e44b598
7 changed files with 29 additions and 15 deletions

View File

@ -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);
} }

View File

@ -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;
} }

View File

@ -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;
} }

View File

@ -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;
} }

View File

@ -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;
} }

View File

@ -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.

View File

@ -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);
}