From 0ce8154cf5fd45b67def9ec22730d4d95c21d520 Mon Sep 17 00:00:00 2001 From: Pierre De Rop Date: Thu, 11 Jun 2020 09:27:11 +0200 Subject: [PATCH] [FELIX-6286] Register the CommandProcessor after having opened the commands service tracker --- .../apache/felix/gogo/runtime/activator/Activator.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/activator/Activator.java b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/activator/Activator.java index 7f4f2420e0..d1904238ca 100644 --- a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/activator/Activator.java +++ b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/activator/Activator.java @@ -55,9 +55,9 @@ public class Activator implements BundleActivator public static final String CONTEXT = ".context"; - protected ServiceRegistration newProcessor(ThreadIO tio, BundleContext context) + protected CommandProcessorImpl newProcessor(ThreadIO tio, BundleContext context) { - processor = new CommandProcessorImpl(tio); + CommandProcessorImpl processor = new CommandProcessorImpl(tio); try { processor.addListener(new EventAdminListener(context)); @@ -73,7 +73,7 @@ protected ServiceRegistration newProcessor(ThreadIO tio, BundleContext contex processor.addCommand("osgi", processor, "removeCommand"); processor.addCommand("osgi", processor, "eval"); - return context.registerService(CommandProcessor.class.getName(), processor, null); + return processor; } public void start(final BundleContext context) throws Exception @@ -82,11 +82,13 @@ public void start(final BundleContext context) throws Exception threadio.start(); threadioRegistration = context.registerService(ThreadIO.class.getName(), threadio, null); - processorRegistration = newProcessor(threadio, context); + processor = newProcessor(threadio, context); commandTracker = trackOSGiCommands(context); commandTracker.open(); + processorRegistration = context.registerService(CommandProcessor.class.getName(), processor, null); + converterTracker = new ServiceTracker(context, Converter.class, null) { @Override