// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
package test;

import java.util.concurrent.CompletableFuture;

import jakarta.enterprise.concurrent.Asynchronous;
import jakarta.enterprise.context.ApplicationScoped;

@ApplicationScoped
public class Supp {
    public void m1() {
        try {
            Thread.sleep(100);
        } catch(InterruptedException ex) {
            // nothing
        }
    }
    @Asynchronous
    public void m2() {
        try {
            Thread.sleep(100);
        } catch(InterruptedException ex) {
            // nothing
        }
    }
    @Asynchronous
    public CompletableFuture<Void> m3() {
        try {
            Thread.sleep(100);
        } catch(InterruptedException ex) {
            // nothing
        }
        return Asynchronous.Result.complete(null);
    }
    @Asynchronous(executor = "java:module/concurrent/Executor100")
    public CompletableFuture<Void> m4() {
        try {
            Thread.sleep(100);
        } catch(InterruptedException ex) {
            // nothing
        }
        return Asynchronous.Result.complete(null);
    }
    @Asynchronous(executor = "java:module/concurrent/Executor2")
    public CompletableFuture<Void> m5() {
        try {
            Thread.sleep(100);
        } catch(InterruptedException ex) {
            // nothing
        }
        return Asynchronous.Result.complete(null);
    }
}
