Skip to main content

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

Hi all,

for custom error handling (see older discussion on this list) we register a custom RegistrySharedObject implementation by overriding

protected IRemoteServiceContainer createRSContainer(
            @SuppressWarnings("rawtypes") final ServiceReference serviceReference, final Map<String, Object> properties,
            final ContainerTypeDescription containerTypeDescription)

in a custom IHostContainerSelector. After upgrading to the latest ECF release we recognized that this method is not called anymore, but the one with the added "String[] intents" argument. The implementation there seem to be very different from before so we currently don't know where to register our custom RegistrySharedObject.

Our code before (shortened):

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

ISharedObject so = manager.getSharedObject(adapterID);

if (so == null) {
  so = new P4RegistrySharedObject(); // <- Custom RegistrySharedObject
  manager.addSharedObject(adapterID, so, null);
}
return new RemoteServiceContainer(container, (IRemoteServiceContainerAdapter) so);

In the current implementation this code seems to be moved - somewhere in the area of AbstractHostContainerSelector.
I tried to suppy our RegistrySharedObject as argument for adapter to

return new RemoteServiceContainer(container, adapter);

but that does not seems to work as expected.

As shown the the below StackTrace below the instance of the RegistrySharedObject in the end is provided by RemoteServiceContainerAdapterFactory which is registered in

org.eclipse.ecf.internal.provider.remoteservice.Activator

as an adapter of the an IAdapterManager.
Registering an alternative Factory in the AdapterManager will probably not work, since i think i read that the first one will be returned in case there are multiple Adapters for the same id ... ?

Any hints on what is the best or expected way of registering our own Object are very welcome!

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



Back to the top