I have a simple GPars actor:
class ConsoleActor extends DefaultActor {
protected void act() {
loop {
react { Msg msg ->
switch (msg.type) {
case MsgType.Read:
sender.send(System.console().readLine())
break
}
}
}
}
}
But when I try to send a message to force the actor to read from Console, i get a NPE:
An exception occurred in the Actor thread Actor Thread 3 java.lang.NullPointerException: Cannot invoke method readLine() on null object
Why this happens and how to read from console in a GPars Actor?