Seems like they should all be active. You may need to check with the felix-dev list about Felix SCR's handling of this.
--

BJ Hargrave
Senior Technical Staff Member, IBM // office: +1 386 848 1781
OSGi Fellow and CTO of the OSGi Alliance // mobile: +1 386 848 3788
hargr...@us.ibm.com
 
 
----- Original message -----
From: "Thomas Driessen" <thomas.driessen...@gmail.com>
Sent by: osgi-dev-boun...@mail.osgi.org
To: osgi-dev@mail.osgi.org
Cc:
Subject: [osgi-dev] Components are not started, although marked with immediate=true
Date: Fri, Feb 17, 2017 2:46 PM
 
Hi,
 
I have a problem with immediate services and hoped that you guys maybe can help.
 
I'm currently trying to implement several services within one bundle (see below for code).
I have set all of them to be immediate (by immediate=true), but still, when I start the OSGi container with my bundle in it, only Con1, InDataPort1 and OutDataPort1 are active. The rest is satisfied but not active according to felix.scr console output:
 
g! list
BundleId Component Name Default State
   Component Id State      PIDs (Factory PID)
[  10]   test.Con1  enabled
   [   0] [active      ]
[  10]   test.InDataPort1  enabled
   [   1] [active      ]
[  10]   test.OutDataPort1  enabled
   [   2] [active      ]
[  10]   test.Process1  enabled
   [   3] [satisfied   ]
[  10]   test.Thread1_1  enabled
   [   4] [satisfied   ]
[  10]   test.Thread1_2  enabled
   [   5] [satisfied   ] 
 
Am I doing something wrong?
I assumed that all services should be started as soon as they are satisfied.
 
Any advice is highly appreciated.
 
Kind regards,
Thomas
 

@Component(immediate = true, service = IProcess.class, property = "de.uniaugsburg.smds.aadl2osgi.component.uid=test.Process1")
public class Process1 implements IProcess {
  
 @Reference(target = "(uid=test.Thread1_1)")
 private volatile IPeriodicThread thread1;
 
 @Reference(target = "(uid=test.Thread1_2)")
 private volatile IPeriodicThread thread2;
}
 
 
@Component(service = IPeriodicThread.class, property = "de.uniaugsburg.smds.aadl2osgi.component.uid=test.Thread1_1", immediate = true)
public class Thread1_1 implements IPeriodicThread {
  
 @Reference(target = "(uid=test.OutDataPort1)")
 private volatile IOutDataPort outport;
  
 @Activate
 public void initialize_FW() {
   init();
 }
 
 @Deactivate
 public void finalize_FW() {
   deinit();
 }
}
 
 
@Component(service = IPeriodicThread.class, property = "de.uniaugsburg.smds.aadl2osgi.component.uid=test.Thread1_2", immediate = true)
public class Thread1_2 implements IPeriodicThread {
  
 @Reference(target = "(uid=test.InDataPort1)")
 private volatile IOutDataPort outport;
  
 @Activate
 public void initialize_FW() {
   init();
 }
 
 @Deactivate
 public void finalize_FW() {
   deinit();
 }
}
 
 
@Component(service = IOutDataPort.class, property = "uid=test.OutDataPort1", immediate = true)
public class OutDataPort1 implements IOutDataPort {

 @Reference(target = "(target=test.OutDataPort1)", cardinality = ReferenceCardinality.OPTIONAL, policyOption = ReferencePolicyOption.GREEDY)
 private volatile IPortConnection incomingPortConnections;
 
 private volatile Set outgoingPortConnections = new ConcurrentSkipListSet();
 
 @Reference(target = "(source=test.OutDataPort1)", cardinality = ReferenceCardinality.OPTIONAL, policyOption = ReferencePolicyOption.GREEDY)
 public void addOutgoingPortConnection(final IPortConnection con) {
   outgoingPortConnections.add(con);
 }
 
 public void removeOutgoingPortConnection(final IPortConnection con) {
   outgoingPortConnections.remove(con);
 }
}
 
 
@Component(service = IInDataPort.class, property = "uid=test.InDataPort1", immediate = true)
@SuppressWarnings("all")
public class InDataPort1 implements IInDataPort {

 @Reference(target = "(target=test.InDataPort1)", cardinality = ReferenceCardinality.OPTIONAL, policyOption = ReferencePolicyOption.GREEDY)
 private volatile IPortConnection incomingPortConnections;
 
 private volatile Set outgoingPortConnections = new ConcurrentSkipListSet();
 
 @Reference(target = "(source=test.InDataPort1)", cardinality = ReferenceCardinality.OPTIONAL, policyOption = ReferencePolicyOption.GREEDY)
 public void addOutgoingPortConnection(final IPortConnection con) {
   outgoingPortConnections.add(con);
 }
 
 public void removeOutgoingPortConnection(final IPortConnection con) {
   outgoingPortConnections.remove(con);
 }
}
 
 
@Component(service = IPortConnection.class, property = { "source=test.OutDataPort1", "target=test.InDataPort1" }, immediate = true)
public class Con1 implements IPortConnection {
 @Reference(cardinality = ReferenceCardinality.OPTIONAL, policyOption = ReferencePolicyOption.GREEDY, target = "(uid=test.OutDataPort1)")
 private volatile IOutDataPort source;
 
 @Reference(cardinality = ReferenceCardinality.OPTIONAL, policyOption = ReferencePolicyOption.GREEDY, target = "(uid=test.InDataPort1)")
 private volatile IInDataPort target;
}
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev
 

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to