Package ie.omk.smpp.event

Examples of ie.omk.smpp.event.ReceiverExitEvent


    @Override
    public void update(Connection source, SMPPEvent event) {
      log.info(getLogHead() + "an SMPPEvent was received: " + event.toString());

      if (event.getType() == SMPPEvent.RECEIVER_EXIT && started) {
        ReceiverExitEvent exitEvent = (ReceiverExitEvent) event;

        String msg = getLogHead() + "Received an exit event (ReceiverExitEvent) with reason " + exitEvent.getReason()
            + ", state is " + exitEvent.getState();
        if (exitEvent.getReason() == ReceiverExitEvent.EXCEPTION) {
          msg += ": " + exitEvent.getException().getMessage();
        }
        log.error(msg, exitEvent.getException());

        // restart the connection if there was an exception
        if (exitEvent.getReason() == ReceiverExitEvent.EXCEPTION) {
          bound = false;
          status = MonitorStatusBuilder.failed("received an exit event");

          try { connection.closeLink(); } catch (Exception e) {}
View Full Code Here


                               + x.getMessage());
                   }
                   if (state == BINDING) {
                       // bind timeout has expired
                       LOGGER.debug("Bind timeout.");
                       exitEvent = new ReceiverExitEvent(this, null, state);
                       ((ReceiverExitEvent) exitEvent).setReason(
                               ReceiverExitEvent.BIND_TIMEOUT);
                       setState(UNBOUND);
                   } else {
                       eventDispatcher.notifyObservers(this,
                               new ReceiverExceptionEvent(this, x));
                   }
                   continue;
               } catch (IOException x) {
                   LOGGER.warn("I/O Exception caught", x);
                   ReceiverExceptionEvent ev = new ReceiverExceptionEvent(
                           this, x, state);
                   eventDispatcher.notifyObservers(this, ev);
                   smppEx++;
                   if (smppEx > tooManyIOEx) {
                       LOGGER.warn("Too many IOExceptions in receiver thread", x);
                       throw x;
                   }
                   continue;
               }

                // Reset smppEx back to zero if we reach here, as packet
                // reception was successful.
                smppEx = 0;

                // Tell all the observers about the new packet
                LOGGER.info("Notifying observers of packet received");
                eventDispatcher.notifyObservers(this, pak);
            } // end while
            if (exitEvent == null) {
                // Notify observers that the thread is exiting with no error..
                exitEvent = new ReceiverExitEvent(this, null, state);
            }
        } catch (Exception x) {
            LOGGER.debug("Fatal exception in receiver thread: " + x.getMessage(), x);
            exitEvent = new ReceiverExitEvent(this, x, state);
            setState(UNBOUND);
        } finally {
            // make sure other code doesn't try to restart the rcvThread..
            rcvThread = null;
        }
View Full Code Here

                               + x.getMessage());
                   }
                   if (state == BINDING) {
                       // bind timeout has expired
                       LOGGER.debug("Bind timeout.");
                       exitEvent = new ReceiverExitEvent(this, null, state);
                       ((ReceiverExitEvent) exitEvent).setReason(
                               ReceiverExitEvent.BIND_TIMEOUT);
                       setState(UNBOUND);
                   } else {
                       eventDispatcher.notifyObservers(this,
                               new ReceiverExceptionEvent(this, x));
                   }
                   continue;
               } catch (IOException x) {
                   LOGGER.warn("I/O Exception caught", x);
                   ReceiverExceptionEvent ev = new ReceiverExceptionEvent(
                           this, x, state);
                   eventDispatcher.notifyObservers(this, ev);
                   smppEx++;
                   if (smppEx > tooManyIOEx) {
                       LOGGER.warn("Too many IOExceptions in receiver thread", x);
                       throw x;
                   }
                   continue;
               }

                // Reset smppEx back to zero if we reach here, as packet
                // reception was successful.
                smppEx = 0;

                // Tell all the observers about the new packet
                LOGGER.info("Notifying observers of packet received");
                eventDispatcher.notifyObservers(this, pak);
            } // end while
            if (exitEvent == null) {
                // Notify observers that the thread is exiting with no error..
                exitEvent = new ReceiverExitEvent(this, null, state);
            }
        } catch (Exception x) {
            LOGGER.debug("Fatal exception in receiver thread: " + x.getMessage(), x);
            exitEvent = new ReceiverExitEvent(this, x, state);
            setState(UNBOUND);
        } finally {
            // make sure other code doesn't try to restart the rcvThread..
            rcvThread = null;
        }
View Full Code Here

TOP

Related Classes of ie.omk.smpp.event.ReceiverExitEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.