Search in sources :

Example 16 with UnrecoverablePduException

use of com.cloudhopper.smpp.type.UnrecoverablePduException in project load-balancer by RestComm.

the class MServerConnectionImpl method sendUnbindRequest.

@Override
public void sendUnbindRequest(Pdu packet) {
    Integer currSequence = lastSequenceNumberSent.incrementAndGet();
    sequenceMap.put(currSequence, new CustomerPacket(null, packet.getSequenceNumber()));
    packet.setSequenceNumber(currSequence);
    ChannelBuffer buffer = null;
    try {
        buffer = transcoder.encode(packet);
    } catch (UnrecoverablePduException e) {
        logger.error("Encode error: ", e);
    } catch (RecoverablePduException e) {
        logger.error("Encode error: ", e);
    }
    serverState = ServerState.UNBINDING;
    if (logger.isDebugEnabled())
        logger.debug("LB sent unbind request (" + packet + ") to server " + channel.getRemoteAddress().toString() + ". session ID : " + sessionId);
    channel.write(buffer);
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) RecoverablePduException(com.cloudhopper.smpp.type.RecoverablePduException) UnrecoverablePduException(com.cloudhopper.smpp.type.UnrecoverablePduException) ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer)

Example 17 with UnrecoverablePduException

use of com.cloudhopper.smpp.type.UnrecoverablePduException in project load-balancer by RestComm.

the class MServerConnectionImpl method sendBindResponse.

@Override
public void sendBindResponse(Pdu packet) {
    if (packetMap.containsKey(packet.getSequenceNumber())) {
        TimerData data = packetMap.remove(packet.getSequenceNumber());
        if (data != null) {
            data.getRunnable().cancel();
            data.getScheduledFuture().cancel(false);
        }
    }
    ChannelBuffer buffer = null;
    try {
        buffer = transcoder.encode(packet);
    } catch (UnrecoverablePduException e) {
        logger.error("Encode error: ", e);
    } catch (RecoverablePduException e) {
        logger.error("Encode error: ", e);
    }
    if (logger.isDebugEnabled())
        logger.debug("LB  sent response (" + packet + ") to server " + channel.getRemoteAddress().toString() + ". session ID : " + sessionId);
    serverState = ServerState.BOUND;
    channel.write(buffer);
}
Also used : TimerData(org.mobicents.tools.smpp.balancer.timers.TimerData) RecoverablePduException(com.cloudhopper.smpp.type.RecoverablePduException) UnrecoverablePduException(com.cloudhopper.smpp.type.UnrecoverablePduException) ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer)

Example 18 with UnrecoverablePduException

use of com.cloudhopper.smpp.type.UnrecoverablePduException in project load-balancer by RestComm.

the class MServerConnectionImpl method generateEnquireLink.

@Override
public void generateEnquireLink() {
    Pdu packet = new EnquireLink();
    packet.setSequenceNumber(lastSequenceNumberSent.incrementAndGet());
    ChannelBuffer buffer = null;
    try {
        buffer = transcoder.encode(packet);
    } catch (UnrecoverablePduException e) {
        logger.error("Encode error: ", e);
    } catch (RecoverablePduException e) {
        logger.error("Encode error: ", e);
    }
    if (logger.isDebugEnabled())
        logger.debug("LB sent enquire_link request (" + packet + ") to server " + channel.getRemoteAddress().toString() + ". session ID : " + sessionId);
    channel.write(buffer);
}
Also used : Pdu(com.cloudhopper.smpp.pdu.Pdu) EnquireLink(com.cloudhopper.smpp.pdu.EnquireLink) RecoverablePduException(com.cloudhopper.smpp.type.RecoverablePduException) UnrecoverablePduException(com.cloudhopper.smpp.type.UnrecoverablePduException) ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer)

Example 19 with UnrecoverablePduException

use of com.cloudhopper.smpp.type.UnrecoverablePduException in project load-balancer by RestComm.

the class MServerConnectionImpl method sendResponse.

@Override
public void sendResponse(Pdu packet) {
    if (packetMap.containsKey(packet.getSequenceNumber())) {
        TimerData data = packetMap.remove(packet.getSequenceNumber());
        if (data != null) {
            data.getRunnable().cancel();
            data.getScheduledFuture().cancel(false);
        }
    }
    ChannelBuffer buffer = null;
    try {
        buffer = transcoder.encode(packet);
    } catch (UnrecoverablePduException e) {
        logger.error("Encode error: ", e);
    } catch (RecoverablePduException e) {
        logger.error("Encode error: ", e);
    }
    if (logger.isDebugEnabled())
        logger.debug("LB sent SMPP response (" + packet + ") to server " + channel.getRemoteAddress().toString() + ". session ID : " + sessionId);
    channel.write(buffer);
}
Also used : TimerData(org.mobicents.tools.smpp.balancer.timers.TimerData) RecoverablePduException(com.cloudhopper.smpp.type.RecoverablePduException) UnrecoverablePduException(com.cloudhopper.smpp.type.UnrecoverablePduException) ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer)

Example 20 with UnrecoverablePduException

use of com.cloudhopper.smpp.type.UnrecoverablePduException in project load-balancer by RestComm.

the class ClientConnectionImpl method generateEnquireLink.

@Override
public void generateEnquireLink() {
    Pdu packet = new EnquireLink();
    packet.setSequenceNumber(lastSequenceNumberSent.incrementAndGet());
    ChannelBuffer buffer = null;
    try {
        buffer = transcoder.encode(packet);
    } catch (UnrecoverablePduException e) {
        logger.error("Encode error: ", e);
    } catch (RecoverablePduException e) {
        logger.error("Encode error: ", e);
    }
    isEnquireLinkSent = true;
    connectionCheck = new ServerTimerConnectionCheck(this);
    // connectionCheckServerSideTimer = monitorExecutor.schedule(connectionCheck,timeoutConnectionCheckServerSide,TimeUnit.MILLISECONDS);
    if (logger.isDebugEnabled())
        logger.debug("LB sent enquire_link to " + channel.getRemoteAddress().toString() + ". sessionId : " + sessionId);
    channel.write(buffer);
}
Also used : Pdu(com.cloudhopper.smpp.pdu.Pdu) EnquireLink(com.cloudhopper.smpp.pdu.EnquireLink) RecoverablePduException(com.cloudhopper.smpp.type.RecoverablePduException) UnrecoverablePduException(com.cloudhopper.smpp.type.UnrecoverablePduException) ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer) ServerTimerConnectionCheck(org.mobicents.tools.smpp.balancer.timers.ServerTimerConnectionCheck)

Aggregations

RecoverablePduException (com.cloudhopper.smpp.type.RecoverablePduException)26 UnrecoverablePduException (com.cloudhopper.smpp.type.UnrecoverablePduException)26 ChannelBuffer (org.jboss.netty.buffer.ChannelBuffer)26 TimerData (org.mobicents.tools.smpp.balancer.timers.TimerData)10 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)8 EnquireLink (com.cloudhopper.smpp.pdu.EnquireLink)4 Pdu (com.cloudhopper.smpp.pdu.Pdu)4 BaseBind (com.cloudhopper.smpp.pdu.BaseBind)2 BindReceiver (com.cloudhopper.smpp.pdu.BindReceiver)2 BindTransceiver (com.cloudhopper.smpp.pdu.BindTransceiver)2 BindTransmitter (com.cloudhopper.smpp.pdu.BindTransmitter)2 GenericNack (com.cloudhopper.smpp.pdu.GenericNack)2 ServerTimerConnectionCheck (org.mobicents.tools.smpp.balancer.timers.ServerTimerConnectionCheck)1