Move AbstractHookQueue into Java

This commit is contained in:
R. Tyler Croy 2015-04-03 07:30:34 -07:00
parent 4fa2667c16
commit 5751ba80fc
2 changed files with 40 additions and 42 deletions

View File

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

View File

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