-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experimentally relax the constraints of the exchange executor.
Don't fail, when a null executor is passed in. Still not supported and may fail later, including hard to find race conditions. Signed-off-by: Achim Kraus <achim.kraus@cloudcoap.net>
- Loading branch information
Showing
3 changed files
with
115 additions
and
30 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
43 changes: 43 additions & 0 deletions
43
element-connector/src/main/java/org/eclipse/californium/elements/util/CheckedExecutor.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,43 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2023 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* https://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License | ||
* v1.0 which is available at | ||
* https://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
********************************************************************************/ | ||
package org.eclipse.californium.elements.util; | ||
|
||
import java.util.ConcurrentModificationException; | ||
import java.util.concurrent.Executor; | ||
|
||
/** | ||
* Checked owner executor. | ||
* | ||
* @since 3.9 | ||
*/ | ||
public interface CheckedExecutor extends Executor { | ||
|
||
/** | ||
* Assert, that the current thread executes the current job. | ||
* | ||
* @throws ConcurrentModificationException if current thread doesn't execute | ||
* the current job | ||
*/ | ||
void assertOwner(); | ||
|
||
/** | ||
* Check, if current thread executes the current job. | ||
* | ||
* @return {@code true}, if current thread executes the current job, | ||
* {@code false}, otherwise. | ||
*/ | ||
boolean checkOwner(); | ||
|
||
} |
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