use of org.mobicents.tools.heartbeat.client.ClientPipelineFactory in project load-balancer by RestComm.
the class Client method start.
@Override
public void start() {
this.nioClientSocketChannelFactory = new NioClientSocketChannelFactory(executor, executor);
this.clientBootstrap = new ClientBootstrap(nioClientSocketChannelFactory);
this.clientBootstrap.setPipelineFactory(new ClientPipelineFactory(clientListener));
this.isa = new InetSocketAddress(lbAddress, lbPort);
}
use of org.mobicents.tools.heartbeat.client.ClientPipelineFactory in project load-balancer by RestComm.
the class Server method sendPacket.
@Override
public void sendPacket(String command, String host, int port) {
this.nioClientSocketChannelFactory = new NioClientSocketChannelFactory(executor, executor);
this.clientBootstrap = new ClientBootstrap(nioClientSocketChannelFactory);
this.clientBootstrap.setPipelineFactory(new ClientPipelineFactory(serverListener));
future = clientBootstrap.connect(new InetSocketAddress(host, port));
switch(command) {
case Protocol.STOP:
packet = new LBShutdownRequestPacket(lbAddress.getHostAddress(), lbPort);
break;
}
future.awaitUninterruptibly();
future.getChannel().write(createRequest(command));
}
use of org.mobicents.tools.heartbeat.client.ClientPipelineFactory in project load-balancer by RestComm.
the class Client method switchover.
@Override
public void switchover(String fromJvmRoute, String toJvmRoute) {
Packet packet = new SwitchoverRequestPacket(fromJvmRoute, toJvmRoute);
ClientBootstrap clientBootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(executor, executor));
clientBootstrap.setPipelineFactory(new ClientPipelineFactory(clientListener));
ChannelFuture future = clientBootstrap.connect(new InetSocketAddress(lbAddress, lbPort));
future.awaitUninterruptibly();
future.getChannel().write(createRequest(Protocol.SWITCHOVER, packet));
}
Aggregations