Search in sources :

Example 1 with NodeStopRequestPacket

use of org.mobicents.tools.heartbeat.api.NodeStopRequestPacket in project load-balancer by RestComm.

the class Client method sendPacket.

@Override
public synchronized void sendPacket(String command) {
    if (clientBootstrap != null && !executor.isShutdown()) {
        future = clientBootstrap.connect(isa);
        switch(command) {
            case Protocol.START:
                if (packet == null || !(packet instanceof StartRequestPacket)) {
                    node.getProperties().put(Protocol.SESSION_ID, "" + System.currentTimeMillis());
                    packet = new StartRequestPacket(node);
                }
                break;
            case Protocol.HEARTBEAT:
                if (packet != null && !(packet instanceof HeartbeatRequestPacket))
                    packet = new HeartbeatRequestPacket(node);
                break;
            case Protocol.SHUTDOWN:
                packet = new NodeShutdownRequestPacket(node);
                break;
            case Protocol.STOP:
                packet = new NodeStopRequestPacket(node);
                break;
        }
        future.awaitUninterruptibly();
        future.getChannel().write(createRequest(command, null));
    }
}
Also used : StartRequestPacket(org.mobicents.tools.heartbeat.api.StartRequestPacket) HeartbeatRequestPacket(org.mobicents.tools.heartbeat.api.HeartbeatRequestPacket) NodeStopRequestPacket(org.mobicents.tools.heartbeat.api.NodeStopRequestPacket) NodeShutdownRequestPacket(org.mobicents.tools.heartbeat.api.NodeShutdownRequestPacket)

Aggregations

HeartbeatRequestPacket (org.mobicents.tools.heartbeat.api.HeartbeatRequestPacket)1 NodeShutdownRequestPacket (org.mobicents.tools.heartbeat.api.NodeShutdownRequestPacket)1 NodeStopRequestPacket (org.mobicents.tools.heartbeat.api.NodeStopRequestPacket)1 StartRequestPacket (org.mobicents.tools.heartbeat.api.StartRequestPacket)1