Skip to content

Package: SendResult

SendResult

nameinstructionbranchcomplexitylinemethod
SendResult()
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
SendResult(Throwable)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getException()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
isOK()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 2018, 2019 Oracle and/or its affiliates and others.
3: * All rights reserved.
4: *
5: * This program and the accompanying materials are made available under the
6: * terms of the Eclipse Public License v. 2.0, which is available at
7: * http://www.eclipse.org/legal/epl-2.0.
8: *
9: * This Source Code may also be made available under the following Secondary
10: * Licenses when the conditions for such availability set forth in the
11: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
12: * version 2 with the GNU Classpath Exception, which is available at
13: * https://www.gnu.org/software/classpath/license.html.
14: *
15: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16: */
17:
18: package jakarta.websocket;
19:
20: /**
21: * The result of asynchronously sending a web socket message. A SendResult is either ok indicating there was no problem,
22: * or is not OK in which case there was a problem and it carries an exception to indicate what the problem was.
23: *
24: * @author dannycoward
25: */
26: final public class SendResult {
27:
28: private final Throwable exception;
29: private final boolean isOK;
30:
31: /**
32: * Construct a SendResult carrying an exception.
33: *
34: * @param exception the exception causing a send failure.
35: */
36: public SendResult(Throwable exception) {
37: this.exception = exception;
38: this.isOK = false;
39: }
40:
41: /**
42: * Construct a SendResult signifying a successful send carrying no exception.
43: */
44: public SendResult() {
45: this.exception = null;
46: this.isOK = true;
47: }
48:
49: /**
50: * The problem sending the message.
51: *
52: * @return the problem or {@code null} if the send was successful.
53: */
54: public Throwable getException() {
55: return exception;
56: }
57:
58: /**
59: * Determines if this result is ok or not.
60: *
61: * @return whether the send was successful or not.
62: */
63: public boolean isOK() {
64: return this.isOK;
65: }
66: }