X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.util%2Fsrc%2Forg%2Fargeo%2Fosgi%2Futil%2FOsgiRegister.java;h=5728b90db2609faf8da1266b0ea62306e9e0e3a9;hb=3c1cdc594d954520b14646102b366290bdad58c7;hp=7132b7c3f05d82aa55e6d7c744c2b516e063e1d8;hpb=9f729eeb8255a9d800ad2506735dda8cc215a135;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.util/src/org/argeo/osgi/util/OsgiRegister.java b/org.argeo.util/src/org/argeo/osgi/util/OsgiRegister.java index 7132b7c3f..5728b90db 100644 --- a/org.argeo.util/src/org/argeo/osgi/util/OsgiRegister.java +++ b/org.argeo.util/src/org/argeo/osgi/util/OsgiRegister.java @@ -5,16 +5,13 @@ import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; import java.util.concurrent.ForkJoinPool; -import org.argeo.util.register.Register; -import org.argeo.util.register.Singleton; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; -public class OsgiRegister implements Register { +public class OsgiRegister { private final BundleContext bundleContext; private Executor executor; @@ -26,8 +23,7 @@ public class OsgiRegister implements Register { this.executor = ForkJoinPool.commonPool(); } - @Override - public Singleton set(T obj, Class clss, Map attributes, Class... classes) { + public void set(T obj, Class clss, Map attributes, Class... classes) { CompletableFuture> srf = new CompletableFuture>(); CompletableFuture postRegistration = CompletableFuture.supplyAsync(() -> { List lst = new ArrayList<>(); @@ -40,18 +36,18 @@ public class OsgiRegister implements Register { srf.complete(sr); return obj; }, executor); - Singleton singleton = new Singleton(clss, postRegistration); - - shutdownStarting. // - thenCompose(singleton::prepareUnregistration). // - thenRunAsync(() -> { - try { - srf.get().unregister(); - } catch (InterruptedException | ExecutionException e) { - e.printStackTrace(); - } - }, executor); - return singleton; +// Singleton singleton = new Singleton(clss, postRegistration); + +// shutdownStarting. // +// thenCompose(singleton::prepareUnregistration). // +// thenRunAsync(() -> { +// try { +// srf.get().unregister(); +// } catch (InterruptedException | ExecutionException e) { +// e.printStackTrace(); +// } +// }, executor); +// return singleton; } public void shutdown() {