use of jgnash.util.EncryptionManager in project jgnash by ccavanaugh.
the class DistributedLockServer method startServer.
public boolean startServer(final char[] password) {
boolean result = false;
// If a password has been specified, create an EncryptionManager
if (password != null && password.length > 0) {
encryptionManager = new EncryptionManager(password);
}
eventLoopGroup = new NioEventLoopGroup();
final ServerBootstrap bootstrap = new ServerBootstrap();
try {
bootstrap.group(eventLoopGroup).channel(NioServerSocketChannel.class).childHandler(new Initializer()).childOption(ChannelOption.SO_KEEPALIVE, true);
final ChannelFuture future = bootstrap.bind(port);
future.sync();
if (future.isDone() && future.isSuccess()) {
logger.info("Distributed Lock Server started successfully");
result = true;
} else {
logger.info("Failed to start the Distributed Lock Server");
}
} catch (final InterruptedException e) {
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
stopServer();
}
return result;
}
Aggregations