use of org.mobicents.tools.sip.balancer.NodeRegisterRMIStub in project load-balancer by RestComm.
the class BlackholeAppServer method sendKeepAliveToBalancers.
private void sendKeepAliveToBalancers(ArrayList<SIPNode> info) {
if (sendHeartbeat) {
Thread.currentThread().setContextClassLoader(NodeRegisterRMIStub.class.getClassLoader());
try {
Registry registry = LocateRegistry.getRegistry(lbAddress, lbRMIport);
NodeRegisterRMIStub reg = (NodeRegisterRMIStub) registry.lookup("SIPBalancer");
reg.handlePing(info);
} catch (Exception e) {
e.printStackTrace();
}
}
}
use of org.mobicents.tools.sip.balancer.NodeRegisterRMIStub in project load-balancer by RestComm.
the class BlackholeAppServer method sendCleanShutdownToBalancers.
public void sendCleanShutdownToBalancers(ArrayList<SIPNode> info) {
Thread.currentThread().setContextClassLoader(NodeRegisterRMIStub.class.getClassLoader());
try {
Registry registry = LocateRegistry.getRegistry(lbAddress, lbRMIport);
NodeRegisterRMIStub reg = (NodeRegisterRMIStub) registry.lookup("SIPBalancer");
reg.forceRemoval(info);
stop();
// delay the OK for a while
Thread.sleep(2000);
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.mobicents.tools.sip.balancer.NodeRegisterRMIStub in project load-balancer by RestComm.
the class AppServerWithRmi method sendKeepAliveToBalancers.
private void sendKeepAliveToBalancers(ArrayList<SIPNode> info) {
if (sendHeartbeat) {
Thread.currentThread().setContextClassLoader(NodeRegisterRMIStub.class.getClassLoader());
if (balancers != null) {
for (String balancer : balancers.replaceAll(" ", "").split(",")) {
if (balancer.length() < 2)
continue;
String host;
String port;
int semi = balancer.indexOf(':');
if (semi > 0) {
host = balancer.substring(0, semi);
port = balancer.substring(semi + 1);
} else {
host = balancer;
port = "2000";
}
try {
Registry registry = LocateRegistry.getRegistry(host, Integer.parseInt(port));
NodeRegisterRMIStub reg = (NodeRegisterRMIStub) registry.lookup("SIPBalancer");
reg.handlePing(info);
} catch (Exception e) {
e.printStackTrace();
}
}
} else {
try {
Registry registry = LocateRegistry.getRegistry(lbAddress, lbRMIport);
NodeRegisterRMIStub reg = (NodeRegisterRMIStub) registry.lookup("SIPBalancer");
reg.handlePing(info);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
use of org.mobicents.tools.sip.balancer.NodeRegisterRMIStub in project load-balancer by RestComm.
the class AppServerWithRmi method sendCleanShutdownToBalancers.
public void sendCleanShutdownToBalancers(ArrayList<SIPNode> info) {
Thread.currentThread().setContextClassLoader(NodeRegisterRMIStub.class.getClassLoader());
try {
Registry registry = LocateRegistry.getRegistry(lbAddress, lbRMIport);
NodeRegisterRMIStub reg = (NodeRegisterRMIStub) registry.lookup("SIPBalancer");
reg.forceRemoval(info);
stop();
// delay the OK for a while
Thread.sleep(2000);
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations