Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » DS Services being activated multiple times
DS Services being activated multiple times [message #1803104] Fri, 22 February 2019 13:19 Go to next message
Aistis Kaikaris is currently offline Aistis KaikarisFriend
Messages: 33
Registered: March 2018
Member
Good day.

I'm not sure if this is the right forum for this question, but i'm developing bundles by first running them on eclipse equinox runtime, and i face a couple of peculiar problems that i don't understand:

1) Some of my declarative services get activated and deactivated 2 times when launching the runtime. Why would this happen, i'm not aware that i'm doing anything that would cause them to do so?

2) When i log the activators and deactivators on DS services, deactivation methods are shown as being called the last, even though the services are active. Is this due to the logger, or is something else happening here?

3) When i have a list:

private List<AlarmResponder> alarmsToCall;

	@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "unbindAlarmResponder")
	protected void bindAlarmResponder(AlarmResponder alarmResponder) {
		LOG.info("Dispatcher has registered : {}", alarmResponder.getClass().getSimpleName());
		this.alarmsToCall.add(alarmResponder);
	}
	
	protected void unbindAlarmResponder(AlarmResponder alarmResponder) {
		this.alarmsToCall.remove(alarmResponder);
	}


the unbind method is always called (on all the members of the list) after all the bind method calls, and the list becomes empty (after being filled) every time. If i remove the unbind method, the services in the list get bound and are present when i do something with them. I have not been able to make the unbind method work as i would expect it to work.

Are these issues only eclipse specific, or am i doing something wrong?

[Updated on: Fri, 22 February 2019 13:21]

Report message to a moderator

Re: DS Services being activated multiple times [message #1803337 is a reply to message #1803104] Wed, 27 February 2019 05:56 Go to previous message
Aistis Kaikaris is currently offline Aistis KaikarisFriend
Messages: 33
Registered: March 2018
Member
Ok, so it seems when you pass an int argument to the deactivator method, it tells you about the reason the service/component was deactivated:

0 - unspecified
1 - The component was disabled
2 - A reference became unsatisfied
3 - A configuration was changed
4 - A configuration was deleted
5 - The component was disposed

I figured out that one of the services was a configurable component and it's being modified on startup (i presume it's loading the last saved configuration after it's already been activated), so all it's clients get restarted as well. For the other one i'm getting "0", so the problem is unspecified.

The dynamic bind problem disappeared when i changed the class from service to a simple component. Not sure why that would do anything, since on further inspection the service was not being used by anyone, but at least that seems to help.

[Updated on: Wed, 27 February 2019 05:58]

Report message to a moderator

Previous Topic:Java Util Logging and OSGI - custom formatter not used
Next Topic:p2 .settings
Goto Forum:
  


Current Time: Thu Apr 25 04:09:25 GMT 2024

Powered by FUDForum. Page generated in 0.03324 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top