}
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception
{
Message message = (Message) e.getMessage();
switch (message.getCode())
{
case WRAPPER_MSG_KEY:
// check if JVM sent us correct key
if (_controller._key.equals(message.getMessage()))
{
_controller.setState(JVMController.STATE_LOGGED_ON);
_controller.startupOK();
ctx.getChannel().write(new Message(Constants.WRAPPER_MSG_OKKEY, "" + _controller._wrappedProcess.getAppPid()));
if (_controller.isDebug())
_controller.getLog().info("Correct key");
}
// if not: announce it and close session
else
{
if (_controller.isDebug())
_controller.getLog().info("Wrong key -> closing session");
ctx.getChannel().write(new Message(Constants.WRAPPER_MSG_BADKEY, null));
ctx.getChannel().close();
}
break;
case Constants.WRAPPER_MSG_STOP:
if (_controller._wrappedProcess != null)