Re: [akka-user] is it a good way to initialize Actor?

2015-05-31 Thread Konrad Malawski
Hi Harit, A few things to explain here. 1) Ok, so that process must be kept alive and restarted, got it. Then you can run that Actor on a dedicated PinnedDIspatcher (check the docs on how to pick a dispatcher for an Actor). 2) the onFailure { throw } won't work as you expect it to, since it's

Re: [akka-user] is it a good way to initialize Actor?

2015-05-31 Thread Harit Himanshu
I realized that the problem is with executing Future restarting Actor. I made another question in the spirit of isolating problems and is described in full detail here https://groups.google.com/d/msg/akka-user/P_vMC74ZfGY/YR3PzG4PoOsJ Thank you + Harit Himanshu On Friday, May 29, 2015 at

Re: [akka-user] is it a good way to initialize Actor?

2015-05-31 Thread Harit Himanshu
This is so awesome and wonderful to have you talk about that. I guess its all about the right timing. I was thinking exactly about this before my sleep last night. I hacked again this morning as a separate problem where Runner

Re: [akka-user] is it a good way to initialize Actor?

2015-05-30 Thread Harit Himanshu
I tried to model this problem and build out a structure where a long-running work is given to dispatcher (I believe it should be a separate dispatcher than to use a global one). But in this case, the supervisor never gets the failure message and never applies strategy on it. Here is my code

Re: [akka-user] is it a good way to initialize Actor?

2015-05-29 Thread Harit Himanshu
Thanks Konrad As mentioned def run: Unit = LogReaderDisruptor.main(Array()) is a method that is supposed to run forever, plus it required some setup(that is available on client's machine or test environment), it was not trivial to set it up for Unit Test, which is why I mocked that part out

Re: [akka-user] is it a good way to initialize Actor?

2015-05-29 Thread Konrad Malawski
When testing Actors one should rather test the behaviours (the messages sent to and from an Actor) instead of mocking. Please note that since mockito (great tool) holds values in thread locals and may not work as you'd expect it to with multithreaded code. Unless that has changed I'd recommend

Re: [akka-user] is it a good way to initialize Actor?

2015-05-29 Thread Konrad Malawski
def run: Unit = LogReaderDisruptor.main(Array()) is a method that is supposed to run forever, plus it required some setup (that is available on client's machine or test environment), By that do you mean that the main() is never returning? If so, then you're blocking the Actor and wasting an

Re: [akka-user] is it a good way to initialize Actor?

2015-05-29 Thread Harit Himanshu
By that do you mean that the main() is never returning? If so, then you're blocking the Actor and wasting an entire thread. Spawn this off on a dedicated dispatcher instead (see dispatchers and futures docs). Yes, this is suppose to run always, and even if it fails, it needs to restart, which is

[akka-user] is it a good way to initialize Actor?

2015-05-27 Thread Harit Himanshu
I need to run a static method on a Java class (provided as a jar dependency). I also wanted to be able to write test on that. I created a wrapper class in Scala that will call this method. It looks like object CurrentLogProcessor { } class CurrentLogProcessor { def run: Unit =