1 17 package org.apache.servicemix.beanflow.support; 18 19 import java.util.concurrent.Executor ; 20 21 27 public class AsynchronousNotifier implements Notifier { 28 29 private final Notifier delegate; 30 private final Executor executor; 31 32 public AsynchronousNotifier(Executor executor) { 33 this(executor, new SynchronousNotifier()); 34 } 35 36 public AsynchronousNotifier(Executor executor, Notifier delegate) { 37 this.executor = executor; 38 this.delegate = delegate; 39 } 40 41 public void addRunnable(Runnable listener) { 42 delegate.addRunnable(listener); 43 } 44 45 public void removeRunnable(Runnable listener) { 46 delegate.removeRunnable(listener); 47 } 48 49 public void run() { 50 executor.execute(delegate); 51 } 52 53 } 54 | Popular Tags |