mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-08 16:18:05 +03:00
exceptions raised by Future / Event can be Throwable instances as earlier, instead of Exception
This commit is contained in:
@@ -31,7 +31,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
|||||||
*
|
*
|
||||||
* @see Future
|
* @see Future
|
||||||
*/
|
*/
|
||||||
public class Event<T extends Exception>
|
public class Event<T extends Throwable>
|
||||||
extends Future<Boolean, T> {
|
extends Future<Boolean, T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
|||||||
* For atomic operations on a future, e.g. checking if a value is set and if it is not then setting it - in other words,
|
* For atomic operations on a future, e.g. checking if a value is set and if it is not then setting it - in other words,
|
||||||
* Compare-And-Set type operations - the associated lock for the future should be acquired while doing so.
|
* Compare-And-Set type operations - the associated lock for the future should be acquired while doing so.
|
||||||
*/
|
*/
|
||||||
public class Future<V, T extends Exception> {
|
public class Future<V, T extends Throwable> {
|
||||||
|
|
||||||
private final Logger log;
|
private final Logger log;
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ public class Future<V, T extends Exception> {
|
|||||||
*
|
*
|
||||||
* @param e the error
|
* @param e the error
|
||||||
*/
|
*/
|
||||||
public void error(Exception e) {
|
public void error(Throwable e) {
|
||||||
lock();
|
lock();
|
||||||
try {
|
try {
|
||||||
pendingEx = chainer.chain(e);
|
pendingEx = chainer.chain(e);
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ import java.util.Collection;
|
|||||||
|
|
||||||
public class FutureUtils {
|
public class FutureUtils {
|
||||||
|
|
||||||
public static void alertAll(Exception x, Future... futures) {
|
public static void alertAll(Throwable x, Future... futures) {
|
||||||
for (Future f : futures)
|
for (Future f : futures)
|
||||||
f.error(x);
|
f.error(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void alertAll(Exception x, Collection<? extends Future> futures) {
|
public static void alertAll(Throwable x, Collection<? extends Future> futures) {
|
||||||
for (Future f : futures)
|
for (Future f : futures)
|
||||||
f.error(x);
|
f.error(x);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user