Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] How to register a custom RegistrySharedObject Implementation

Hi All,

In my previous note I provide an implementation of createContainer/4.   I believe I left out one necessary line...see // it's necessary... below

On 11/26/2018 10:48 AM, Scott Lewis wrote:
<stuff deleted>

This method can then be overridden something like this:

protected IContainer createContainer(ServiceReference serviceReference,
            Map<String, Object> properties,
            ContainerTypeDescription containerTypeDescription, String[] intents)
            throws SelectContainerException {
         // call superclass to create container instance
         IContainer container = super.createContainer(serviceReference, properties, containerTypeDescription, intents);

           // it's necessary to call getAdapter, so that the RegistrySharedObject gets added to the just-created container.

        container
                .getAdapter(IRemoteServiceContainerAdapter.class);

final ID adapterID = IDFactory.getDefault().createStringID(IRemoteServiceContainerAdapter.class.getName());
final ISharedObjectManager manager = container.getSharedObjectManager();

// Remove any existing registry shared object

         manager.removeSharedObject(adapterID);

         // add yours

         ISharedObject  so = new P4RegistrySharedObject(); // <- Custom RegistrySharedObject
         manager.addSharedObject(adapterID, so, null);

         // and return container

         return container;

}


Does this make sense?

Scott




Thanks!
Bye Peter

The callstack for the initialization:

Thread [main] (Suspended)
                owns: RemoteServiceContainerAdapterFactory (id=358)
                owns: AuthHostContainerSelector  (id=82)
RemoteServiceContainerAdapterFactory.createAdapter(ISharedObjectContainer, Class, ID) line: 25 RemoteServiceContainerAdapterFactory(AbstractSharedObjectContainerAdapterFactory).getSharedObjectAdapter(ISharedObjectContainer, Class) line: 93 RemoteServiceContainerAdapterFactory(AbstractSharedObjectContainerAdapterFactory).getContainerAdapter(IContainer, Class) line: 51 RemoteServiceContainerAdapterFactory(AbstractContainerAdapterFactory).getAdapter(Object, Class) line: 32                 AdapterManager.getAdapter(Object, String, boolean) line: 333
                AdapterManager.loadAdapter(Object, String) line: 366
TCPServerSOContainer(SOContainer).getAdapter(Class) line: 298
AuthHostContainerSelector(AbstractContainerSelector).hasRemoteServiceContainerAdapter(IContainer) line: 70 AuthHostContainerSelector(AbstractHostContainerSelector).selectExistingHostContainers(ServiceReference, Map<String,Object>, String[], String[], String[]) line: 121 AuthHostContainerSelector(HostContainerSelector).selectHostContainers(ServiceReference, Map<String,Object>, String[], String[], String[]) line: 69 AuthHostContainerSelector.selectHostContainers(ServiceReference, Map<String,Object>, String[], String[], String[]) line: 37
                RemoteServiceAdmin$1.run() line: 300
AccessController.doPrivileged(PrivilegedExceptionAction<T>) line: not available [native method] RemoteServiceAdmin.exportService(ServiceReference<?>, Map<String,?>) line: 298 TopologyManagerImpl(AbstractTopologyManager).handleServiceRegistering(ServiceReference) line: 466 TopologyManagerImpl(AbstractTopologyManager).handleEvent(ServiceEvent, Map) line: 425                 TopologyManagerImpl.handleEvent(ServiceEvent, Map) line: 69
BasicTopologyManager(TopologyManager).event(ServiceEvent, Map) line: 246
                ServiceRegistry$6.call(Object, ServiceRegistration<?>) line: 1238 ServiceRegistry.notifyHookPrivileged(BundleContextImpl, ServiceRegistrationImpl<?>, HookContext) line: 1280
ServiceRegistry.notifyHooksPrivileged(HookContext) line: 1263
ServiceRegistry.notifyEventListenerHooksPrivileged(ServiceEvent, Map<BundleContext,Collection<ListenerInfo>>) line: 1235
ServiceRegistry.publishServiceEventPrivileged(ServiceEvent) line: 841
ServiceRegistry.publishServiceEvent(ServiceEvent) line: 801
ServiceRegistrationImpl<S>.register(Dictionary<String,?>) line: 127
ServiceRegistry.registerService(BundleContextImpl, String[], Object, Dictionary<String,?>) line: 225                 BundleContextImpl.registerService(String[], Object, Dictionary<String,?>) line: 464 InstanceProcess.registerService(ServiceComponentProp, boolean, ComponentInstanceImpl) line: 536                 InstanceProcess.buildComponents(Vector, boolean) line: 260
                Resolver.getEligible(ServiceEvent) line: 343
                SCRManager.serviceChanged(ServiceEvent) line: 222
FilteredServiceListener.serviceChanged(ServiceEvent) line: 109
                BundleContextImpl.dispatchEvent(Object, Object, int, Object) line: 914 EventManager.dispatchEvent(Set<Entry<K,V>>, EventDispatcher<K,V,E>, int, E) line: 230
ListenerQueue<K,V,E>.dispatchEventSynchronous(int, E) line: 148
ServiceRegistry.publishServiceEventPrivileged(ServiceEvent) line: 862
ServiceRegistry.publishServiceEvent(ServiceEvent) line: 801
ServiceRegistrationImpl<S>.register(Dictionary<String,?>) line: 127
ServiceRegistry.registerService(BundleContextImpl, String[], Object, Dictionary<String,?>) line: 225                 BundleContextImpl.registerService(String[], Object, Dictionary<String,?>) line: 464                 BundleContextImpl.registerService(String, Object, Dictionary<String,?>) line: 482 BundleContextImpl.registerService(Class<S>, S, Dictionary<String,?>) line: 998

_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/ecf-dev


_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/ecf-dev




Back to the top