All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fireflysource.common.actor.AbstractAsyncActor Maven / Gradle / Ivy

There is a newer version: 5.0.2
Show newest version
package com.fireflysource.common.actor;

import com.fireflysource.common.sys.Result;

import java.util.concurrent.CompletableFuture;

abstract public class AbstractAsyncActor extends AbstractActor {

    public AbstractAsyncActor() {
        super();
    }

    public AbstractAsyncActor(String address, Dispatcher dispatcher, Mailbox mailbox) {
        super(address, dispatcher, mailbox);
    }

    @Override
    public void onReceive(T message) {
        pause();
        onReceiveAsync(message).handle((result, throwable) -> {
            resume();
            return Result.DONE;
        });
    }

    abstract public CompletableFuture onReceiveAsync(T message);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy