/protocols/smpp/src/main/java/org/mobicents/protocols/smpp/event/ReceiverExceptionEvent.java

http://mobicents.googlecode.com/ · Java · 90 lines · 22 code · 9 blank · 59 comment · 0 complexity · c16967d13921e6a391098bb1e3f4f8d0 MD5 · raw file

  1. /*
  2. * JBoss, Home of Professional Open Source
  3. * Copyright 2011, Red Hat, Inc. and individual contributors
  4. * by the @authors tag. See the copyright.txt in the distribution for a
  5. * full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.mobicents.protocols.smpp.event;
  23. import org.mobicents.protocols.smpp.Session;
  24. import org.mobicents.protocols.smpp.SessionState;
  25. /**
  26. * Event generated by the receiver thread when a non-fatal exception is caught.
  27. * An application will receive this event type if the receiver thread catches an
  28. * exception which does not cause it to terminate. The exception which was
  29. * caught and the state the connection was in when it was caught are saved in
  30. * this event.
  31. *
  32. * @version $Id: ReceiverExceptionEvent.java 452 2009-01-15 16:56:36Z orank $
  33. */
  34. public class ReceiverExceptionEvent extends SMPPEvent {
  35. /**
  36. * The exception that was caught.
  37. */
  38. private Throwable exception;
  39. /**
  40. * The state the Connection was in when the exception was caught.
  41. */
  42. private SessionState connectionState;
  43. /**
  44. * Create a new ReceiverExceptionEvent.
  45. *
  46. * @param source The source Connection of this event.
  47. * @param t The exception being reported.
  48. */
  49. public ReceiverExceptionEvent(Session source, Throwable t) {
  50. super(RECEIVER_EXCEPTION, source);
  51. this.exception = t;
  52. }
  53. /**
  54. * Create a new ReceiverExceptionEvent.
  55. *
  56. * @param source The source Connection of this event.
  57. * @param t The exception being reported.
  58. * @param state The state the connection was in when the exception was
  59. * caught.
  60. */
  61. public ReceiverExceptionEvent(Session source, Throwable t, SessionState state) {
  62. super(RECEIVER_EXCEPTION, source);
  63. this.exception = t;
  64. this.connectionState = state;
  65. }
  66. /**
  67. * Get the exception which was caught.
  68. */
  69. public Throwable getException() {
  70. return exception;
  71. }
  72. /**
  73. * Get the state the connection was in when the exception was caught.
  74. *
  75. * @return the integer value representing the state of the connection.
  76. * @see SessionState
  77. */
  78. public SessionState getState() {
  79. return connectionState;
  80. }
  81. }