From 5751ba80fc79f56d030d7dcefc5a47f2bf1560d8 Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Fri, 3 Apr 2015 07:30:34 -0700 Subject: [PATCH] Move AbstractHookQueue into Java --- .../lookout/whoas/AbstractHookQueue.groovy | 42 ------------------- .../lookout/whoas/AbstractHookQueue.java | 40 ++++++++++++++++++ 2 files changed, 40 insertions(+), 42 deletions(-) delete mode 100644 src/main/groovy/com/github/lookout/whoas/AbstractHookQueue.groovy create mode 100644 src/main/groovy/com/github/lookout/whoas/AbstractHookQueue.java diff --git a/src/main/groovy/com/github/lookout/whoas/AbstractHookQueue.groovy b/src/main/groovy/com/github/lookout/whoas/AbstractHookQueue.groovy deleted file mode 100644 index 9de7aab..0000000 --- a/src/main/groovy/com/github/lookout/whoas/AbstractHookQueue.groovy +++ /dev/null @@ -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) -} diff --git a/src/main/groovy/com/github/lookout/whoas/AbstractHookQueue.java b/src/main/groovy/com/github/lookout/whoas/AbstractHookQueue.java new file mode 100644 index 0000000..f947ba9 --- /dev/null +++ b/src/main/groovy/com/github/lookout/whoas/AbstractHookQueue.java @@ -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); +}