Abraham Menacherry
unread,Apr 27, 2011, 3:58:09 AM4/27/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jetlang-dev
Hi,
If a callback throws a runtime exception, then any subsequent calls to
channel.publish does not invoke the callback. Is this the expected
behavior? Or am I doing something wrong. Is there any work around to
"re-start" the fiber in such scenario?
Code snippet:
final CountDownLatch latch = new CountDownLatch(2);
Fiber fiber = new ThreadFiber();
fiber.start();
MemoryChannel<Integer> channel = new MemoryChannel<Integer>();
Callback<Integer> exceptionCallBack = new Callback<Integer>()
{
@Override
public void onMessage(Integer message)
{
System.out.println("received " + message);
latch.countDown();
throw new NullPointerException();
}
};
channel.subscribe(fiber,exceptionCallBack);
channel.publish(1);// throws the NPE as expected
//Any futher calls to publish has no effect, it is not getting picked
up, no more NPE's get thrown
channel.publish(2);// No effect
Thanks,
Abraham.