PageRenderTime 29ms CodeModel.GetById 17ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/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
23package org.mobicents.protocols.smpp.event;
24
25import org.mobicents.protocols.smpp.Session;
26import org.mobicents.protocols.smpp.SessionState;
27
28/**
29 * Event generated by the receiver thread when a non-fatal exception is caught.
30 * An application will receive this event type if the receiver thread catches an
31 * exception which does not cause it to terminate. The exception which was
32 * caught and the state the connection was in when it was caught are saved in
33 * this event.
34 * 
35 * @version $Id: ReceiverExceptionEvent.java 452 2009-01-15 16:56:36Z orank $
36 */
37public class ReceiverExceptionEvent extends SMPPEvent {
38    /**
39     * The exception that was caught.
40     */
41    private Throwable exception;
42
43    /**
44     * The state the Connection was in when the exception was caught.
45     */
46    private SessionState connectionState;
47
48    /**
49     * Create a new ReceiverExceptionEvent.
50     * 
51     * @param source The source Connection of this event.
52     * @param t The exception being reported.
53     */
54    public ReceiverExceptionEvent(Session source, Throwable t) {
55        super(RECEIVER_EXCEPTION, source);
56        this.exception = t;
57    }
58
59    /**
60     * Create a new ReceiverExceptionEvent.
61     * 
62     * @param source The source Connection of this event.
63     * @param t The exception being reported.
64     * @param state The state the connection was in when the exception was
65     * caught.
66     */
67    public ReceiverExceptionEvent(Session source, Throwable t, SessionState state) {
68        super(RECEIVER_EXCEPTION, source);
69        this.exception = t;
70        this.connectionState = state;
71    }
72
73    /**
74     * Get the exception which was caught.
75     */
76    public Throwable getException() {
77        return exception;
78    }
79
80    /**
81     * Get the state the connection was in when the exception was caught.
82     * 
83     * @return the integer value representing the state of the connection.
84     * @see SessionState
85     */
86    public SessionState getState() {
87        return connectionState;
88    }
89}
90