mirror of https://github.com/reiseburo/whoas
Move AbstractHookQueue into Java
This commit is contained in:
parent
4fa2667c16
commit
5751ba80fc
|
@ -1,42 +0,0 @@
|
|||
package com.github.lookout.whoas
|
||||
|
||||
|
||||
/**
|
||||
* Interface defining how 'HookQueue' providers should behave
|
||||
*
|
||||
* This allows for different queueing implementations behind whoas
|
||||
*/
|
||||
abstract class AbstractHookQueue {
|
||||
protected Boolean started = false
|
||||
|
||||
void start() {
|
||||
if (started) {
|
||||
throw new IllegalStateException()
|
||||
}
|
||||
started = true
|
||||
}
|
||||
|
||||
void stop() {
|
||||
if (!started) {
|
||||
throw new IllegalStateException()
|
||||
return
|
||||
}
|
||||
started = false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the size of the queue, may not be implemented by some providers
|
||||
* in which case it will return -1
|
||||
*/
|
||||
abstract int getSize()
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract void pop(QueueAction action) throws Exception
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract Boolean push(HookRequest request)
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.github.lookout.whoas;
|
||||
|
||||
/**
|
||||
* Interface defining how 'HookQueue' providers should behave
|
||||
*
|
||||
* This allows for different queueing implementations behind whoas
|
||||
*/
|
||||
public abstract class AbstractHookQueue {
|
||||
protected Boolean started = false;
|
||||
|
||||
public void start() {
|
||||
if (started) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
started = true;
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if (!started) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
started = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the size of the queue, may not be implemented by some providers
|
||||
* in which case it will return -1
|
||||
*/
|
||||
public abstract int getSize();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public abstract void pop(QueueAction action) throws Exception;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public abstract Boolean push(HookRequest request);
|
||||
}
|
Loading…
Reference in New Issue