Search in sources :

Example 1 with Nullable

use of reactor.util.annotation.Nullable in project reactor-core by reactor.

the class WorkerTask method call.

@Override
@Nullable
public Void call() {
    THREAD.lazySet(this, Thread.currentThread());
    try {
        try {
            task.run();
        } catch (Throwable ex) {
            Schedulers.handleError(ex);
        }
    } finally {
        THREAD.lazySet(this, null);
        Composite o = parent;
        // note: the o != null check must happen after the compareAndSet for it to always mark task as DONE
        if (o != DISPOSED && PARENT.compareAndSet(this, o, DONE) && o != null) {
            o.remove(this);
        }
        Future f;
        for (; ; ) {
            f = future;
            if (f == SYNC_CANCELLED || f == ASYNC_CANCELLED || FUTURE.compareAndSet(this, f, FINISHED)) {
                break;
            }
        }
    }
    return null;
}
Also used : Future(java.util.concurrent.Future) Nullable(reactor.util.annotation.Nullable)

Example 2 with Nullable

use of reactor.util.annotation.Nullable in project reactor-core by reactor.

the class SchedulerTask method call.

@Override
@Nullable
public Void call() {
    thread = Thread.currentThread();
    try {
        try {
            task.run();
        } catch (Throwable ex) {
            Schedulers.handleError(ex);
        }
    } finally {
        thread = null;
        Future f;
        for (; ; ) {
            f = future;
            if (f == CANCELLED || FUTURE.compareAndSet(this, f, FINISHED)) {
                break;
            }
        }
    }
    return null;
}
Also used : Future(java.util.concurrent.Future) Nullable(reactor.util.annotation.Nullable)

Aggregations

Future (java.util.concurrent.Future)2 Nullable (reactor.util.annotation.Nullable)2