diff --git a/wash/src/actor/ActorThread.java b/wash/src/actor/ActorThread.java index 558aa21..da1c8ce 100644 --- a/wash/src/actor/ActorThread.java +++ b/wash/src/actor/ActorThread.java @@ -10,14 +10,18 @@ public abstract class ActorThread extends Thread { /** Called by another thread, to send a message to this thread. */ public void send(M message) { + System.out.println(" # Sending message: " + message); q.offer(message); + System.out.println(" % Queue State: " + q); } /** Returns the first message in the queue, or blocks if none available. */ protected M receive() throws InterruptedException { - return q.take(); + M mess = q.take(); + System.out.println(" - Message taken: " + mess); + return mess; } - + /** Returns the first message in the queue, or blocks up to 'timeout' milliseconds if none available. Returns null if no message is obtained within 'timeout' milliseconds. */ @@ -27,7 +31,9 @@ public abstract class ActorThread extends Thread { protected Optional poll(long timeOut) { try { - return Optional.ofNullable(q.poll(timeOut, TimeUnit.MILLISECONDS)); + Optional m = Optional.ofNullable(q.poll(timeOut, TimeUnit.MILLISECONDS)); + System.out.println("Stolen: " + m); + return m; } catch (InterruptedException e) { return Optional.empty(); } catch (Exception e) {