-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generally processing of exception with serial execution.
Signed-off-by: Achim Kraus <[email protected]>
- Loading branch information
Achim Kraus
committed
Jan 11, 2019
1 parent
a90366c
commit a94f267
Showing
12 changed files
with
468 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...ain/java/org/eclipse/californium/core/network/stack/FailureForwardingMessageObserver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2019 Bosch Software Innovations GmbH and others. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Eclipse Distribution License v1.0 which accompany this distribution. | ||
* | ||
* The Eclipse Public License is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* and the Eclipse Distribution License is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.html. | ||
* | ||
* Contributors: | ||
* Bosch Software Innovations GmbH - initial creation | ||
******************************************************************************/ | ||
package org.eclipse.californium.core.network.stack; | ||
|
||
import org.eclipse.californium.core.coap.Message; | ||
import org.eclipse.californium.core.coap.MessageObserverAdapter; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* Forward failures to other messages. | ||
* | ||
* Forward {@link #onCancel()}, {@link #onReject()}, {@link #onTimeout()}, and | ||
* {@link #onSendError(Throwable)} to provided message. Intended to be used for | ||
* blockwise transfers | ||
*/ | ||
public class FailureForwardingMessageObserver extends MessageObserverAdapter { | ||
|
||
protected static final Logger LOGGER = LoggerFactory.getLogger(FailureForwardingMessageObserver.class.getName()); | ||
|
||
protected final Message message; | ||
|
||
protected FailureForwardingMessageObserver(final Message message) { | ||
this.message = message; | ||
} | ||
|
||
@Override | ||
public void onCancel() { | ||
message.cancel(); | ||
} | ||
|
||
@Override | ||
public void onReject() { | ||
message.setRejected(true); | ||
} | ||
|
||
@Override | ||
public void onTimeout() { | ||
message.setTimedOut(true); | ||
} | ||
|
||
@Override | ||
public void onSendError(Throwable error) { | ||
message.setSendError(error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.