Search in sources :

Example 1 with BinderRunnable

use of org.mobicents.tools.smpp.balancer.impl.BinderRunnable in project load-balancer by RestComm.

the class BalancerDispatcher method bindRequested.

@Override
public void bindRequested(Long sessionId, ServerConnectionImpl serverConnection, Pdu packet) {
    // InvocationContext invocationContext = balancerRunner.getLatestInvocationContext();
    balancerRunner.balancerContext.smppRequestsToServer.getAndIncrement();
    balancerRunner.incMessages();
    balancerRunner.balancerContext.smppRequestsProcessedById.get(packet.getCommandId()).incrementAndGet();
    balancerRunner.balancerContext.smppBytesToServer.addAndGet(packet.getCommandLength());
    serverSessions.put(sessionId, serverConnection);
    SmppSessionConfiguration sessionConfig = serverConnection.getConfig();
    if (!serverConnection.getConfig().isUseSsl())
        sessionConfig.setUseSsl(false);
    else
        sessionConfig.setUseSsl(!balancerRunner.balancerContext.terminateTLSTraffic);
    counterConnections.compareAndSet(Integer.MAX_VALUE, 0);
    Node currNode = ctx.smppToProviderBalancerAlgorithm.processBindToProvider();
    sessionConfig.setHost(currNode.getIp());
    sessionConfig.setPort(Integer.parseInt((String) currNode.getProperties().get("smppPort")));
    clientSessions.put(sessionId, new ClientConnectionImpl(sessionId, sessionConfig, this, monitorExecutor, balancerRunner, packet, currNode));
    handlerService.execute(new BinderRunnable(sessionId, packet, serverSessions, clientSessions, currNode, balancerRunner));
}
Also used : SmppSessionConfiguration(com.cloudhopper.smpp.SmppSessionConfiguration) BinderRunnable(org.mobicents.tools.smpp.balancer.impl.BinderRunnable) Node(org.mobicents.tools.heartbeat.api.Node) ClientConnectionImpl(org.mobicents.tools.smpp.balancer.impl.ClientConnectionImpl)

Example 2 with BinderRunnable

use of org.mobicents.tools.smpp.balancer.impl.BinderRunnable in project load-balancer by RestComm.

the class BalancerDispatcher method connectionLost.

@Override
public void connectionLost(Long sessionId, Pdu packet, Node node) {
    serverSessions.get(sessionId).reconnectState(true);
    monitorExecutor.schedule(new BinderRunnable(sessionId, packet, serverSessions, clientSessions, node, balancerRunner), reconnectPeriod, TimeUnit.MILLISECONDS);
}
Also used : BinderRunnable(org.mobicents.tools.smpp.balancer.impl.BinderRunnable)

Aggregations

BinderRunnable (org.mobicents.tools.smpp.balancer.impl.BinderRunnable)2 SmppSessionConfiguration (com.cloudhopper.smpp.SmppSessionConfiguration)1 Node (org.mobicents.tools.heartbeat.api.Node)1 ClientConnectionImpl (org.mobicents.tools.smpp.balancer.impl.ClientConnectionImpl)1