import org.jboss.aop.joinpoint.MethodInvocation; import org.jboss.ejb3.annotation.Pool; @Pool(value = "myPool", maxSize = 10, timeout = 10000) public class ExampleClass { @Inject private ManagedExecutor executor; public void executeConcurrentTasks() { for (int i = 0; i < 10; i++) { executor.execute(new ExampleTask(i)); } } private class ExampleTask implements Runnable { private int taskId; public ExampleTask(int taskId) { this.taskId = taskId; } public void run() { // Task execution logic here } } }


上一篇:
下一篇:
切换中文