Search in sources :

Example 1 with SwitchoverRequestPacket

use of org.mobicents.tools.heartbeat.packets.SwitchoverRequestPacket 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));
}
Also used : ChannelFuture(org.jboss.netty.channel.ChannelFuture) NodeStopRequestPacket(org.mobicents.tools.heartbeat.api.NodeStopRequestPacket) NodeShutdownRequestPacket(org.mobicents.tools.heartbeat.api.NodeShutdownRequestPacket) StartRequestPacket(org.mobicents.tools.heartbeat.api.StartRequestPacket) Packet(org.mobicents.tools.heartbeat.api.Packet) SwitchoverRequestPacket(org.mobicents.tools.heartbeat.packets.SwitchoverRequestPacket) HeartbeatRequestPacket(org.mobicents.tools.heartbeat.api.HeartbeatRequestPacket) NioClientSocketChannelFactory(org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory) ClientBootstrap(org.jboss.netty.bootstrap.ClientBootstrap) InetSocketAddress(java.net.InetSocketAddress) SwitchoverRequestPacket(org.mobicents.tools.heartbeat.packets.SwitchoverRequestPacket) ClientPipelineFactory(org.mobicents.tools.heartbeat.client.ClientPipelineFactory)

Aggregations

InetSocketAddress (java.net.InetSocketAddress)1 ClientBootstrap (org.jboss.netty.bootstrap.ClientBootstrap)1 ChannelFuture (org.jboss.netty.channel.ChannelFuture)1 NioClientSocketChannelFactory (org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory)1 HeartbeatRequestPacket (org.mobicents.tools.heartbeat.api.HeartbeatRequestPacket)1 NodeShutdownRequestPacket (org.mobicents.tools.heartbeat.api.NodeShutdownRequestPacket)1 NodeStopRequestPacket (org.mobicents.tools.heartbeat.api.NodeStopRequestPacket)1 Packet (org.mobicents.tools.heartbeat.api.Packet)1 StartRequestPacket (org.mobicents.tools.heartbeat.api.StartRequestPacket)1 ClientPipelineFactory (org.mobicents.tools.heartbeat.client.ClientPipelineFactory)1 SwitchoverRequestPacket (org.mobicents.tools.heartbeat.packets.SwitchoverRequestPacket)1