An activate method is able to start its own threads, but it sounds like this may not be the right approach for you.
What do you mean when you say "which would sleep and wait for others to join before proceeding for next action”? This sounds a lot like you should be using the OSGi service registry and referencing services rather than sleeping. That way your activate method will not need to wait. As for your current problem - is that code snippet really the component? The output indicates that you have a deactivate method defined as well. Regards, Tim > On 26 Oct 2016, at 09:43, <manoj.vrajam...@wipro.com> > <manoj.vrajam...@wipro.com> wrote: > > No…none of the others have activate() in them.. This is the first time I am > writing an activate() method… > > Plaese note: I just want a method in this bundle to be invoked on running the > framework. I thought activate() would be the right one. But I understand from > your comments that activate should not have a thread sleeping (which I > eventually planned). So, then activate() would not help me, right ? > > Could you propose as to what I should do alternatively to invoke a function > (which would sleep and wait for others to join before proceeding for next > action) on start up? > > > From: osgi-dev-boun...@mail.osgi.org <mailto:osgi-dev-boun...@mail.osgi.org> > [mailto:osgi-dev-boun...@mail.osgi.org > <mailto:osgi-dev-boun...@mail.osgi.org>] On Behalf Of Timothy Ward > Sent: 26 October 2016 13:03 > To: OSGi Developer Mail List <osgi-dev@mail.osgi.org > <mailto:osgi-dev@mail.osgi.org>> > Subject: Re: [osgi-dev] Understanding activate > > ** This mail has been sent from an external source ** > > I note that there are a number of other DS components present - are any of > the others showing the same issue? > > I’m making a guess here, but do any of the other components have Activate > methods which can block the activation Thread? > > Felix SCR owns a background worker thread which is used for a number of > different tasks. In components like this one the thread will be used to > invoke the activate method. If a component is blocks that thread then it may > cause your whole SCR to get “stuck”. This is one of several reasons why > activate methods should not block for long periods. > > Your problem may be totally unrelated to this, but it is worth checking. > > Regards, > > Tim > > > On 26 Oct 2016, at 09:11, manoj.vrajam...@wipro.com > <mailto:manoj.vrajam...@wipro.com> wrote: > > Please find my code snippet + the scr diagnostics ..below: > > ============ > @Component(name = "com.wipro.iot.Alljoyn", immediate = true) > public class AlljoynImpl { > > @Activate > public void activate() > { > System.out.println("starting....."); > } > } > > > ============ > > g! > g! scr:list > Name BundleId DefaultEnabled > [com.wipro.iot.Alljoyn] [ 6] [true] > [com.wipro.iot.DeviceManager] [ 1] [true] > [com.wipro.iot.GatewayDevice] [ 2] [true] > [com.wipro.iot.HueLight] [ 3] [true] > [com.wipro.iot.LampDevice] [ 4] [true] > [com.wipro.iot.MobilePhone] [ 5] [true] > [com.wipro.iot.poc] [ 7] [true] > [org.eclipse.equinox.event] [ 18] [true] > [osgi.enroute.configurer.simple.provider.Configurer] [ 22] [true] > [osgi.enroute.dto.bndlib.provider.DTOsProvider] [ 23] [true] > [osgi.enroute.logger.simple.provider.LoggerAdminImpl] [ 26] [true] > [osgi.enroute.logger.simple.provider.LoggerComponentImpl] [ 26] [true] > [osgi.enroute.rest.simple] [ 27] [true] > [osgi.enroute.simple.server] [ 29] [true] > [osgi.executor.provider] [ 24] [true] > g! > g! > g! > g! scr:info com.wipro.iot.Alljoyn > *** Bundle: com.wipro.iot.alljoyn.adapter (6) > Component Description: > Name: com.wipro.iot.Alljoyn > Default State: enabled > Activation: immediate > Configuration Policy: optional > Activate Method: activate > Deactivate Method: deactivate > Modified Method: - > Configuration Pid: [com.wipro.iot.Alljoyn] > Services: Service Scope: null > Properties: > Component Configuration: > ComponentId: 5 > State: satisfied > Properties: > component.id = 5 > component.name = com.wipro.iot.Alljoyn > g! > g! > g! > > From: osgi-dev-boun...@mail.osgi.org <mailto:osgi-dev-boun...@mail.osgi.org> > <osgi-dev-boun...@mail.osgi.org <mailto:osgi-dev-boun...@mail.osgi.org>> on > behalf of Tim Ward <tim.w...@paremus.com <mailto:tim.w...@paremus.com>> > Sent: 26 October 2016 12:04:44 > To: OSGi Developer Mail List > Subject: Re: [osgi-dev] Understanding activate > > ** This mail has been sent from an external source ** > Manoj, > > As Bernd suggested, it would be a good idea to run the Felix SCR diagnostic > commands. > > scr:list will list the DS components in the runtime. If you don't see your > component in the output then you need to check the bundle you're building to > see if you've forgotten to include the DS component. > > scr:info <component name> will give detailed information about the component, > including what state it is in. > > Regards, > > Tim > > Sent from my iPhone > > On 26 Oct 2016, at 07:31, <manoj.vrajam...@wipro.com > <mailto:manoj.vrajam...@wipro.com>> <manoj.vrajam...@wipro.com > <mailto:manoj.vrajam...@wipro.com>> wrote: > > Bernd…I am on Enroute Eclipse/Bndtools and clicking on “Debug OSGi” to run > the application. > > From: osgi-dev-boun...@mail.osgi.org <mailto:osgi-dev-boun...@mail.osgi.org> > [mailto:osgi-dev-boun...@mail.osgi.org > <mailto:osgi-dev-boun...@mail.osgi.org>] On Behalf Of Bernd Eckenfels > Sent: 26 October 2016 10:55 > To: OSGi Developer Mail List <osgi-dev@mail.osgi.org > <mailto:osgi-dev@mail.osgi.org>> > Subject: Re: [osgi-dev] Understanding activate > > ** This mail has been sent from an external source ** > How do you build and install your bundle? Make sure the resulting JAR > actually contains the SCR descriptor for the component and also ensure the DS > service is actually available in the runtime. Other than that, the actual > code can be correct (depending on your actual imports which was not shown). > > If this contains Felix Services and gogo Shell you can use scr:list command > to verify. > > Gruss > Bernd > -- > http://bernd.eckenfels.net <http://bernd.eckenfels.net/> > > > > > > On Wed, Oct 26, 2016 at 7:07 AM +0200, <manoj.vrajam...@wipro.com > <mailto:manoj.vrajam...@wipro.com>> wrote: > > Hi All, > > @Component(immediate = true) > public class SampleImpl { > > @Activate > public void activate() > { > System.out.println("starting....."); > } > } > > How to invoke this ? activate() is not getting invoked when I run this simple > application. > > Thanks, > Manoj > The information contained in this electronic message and any attachments to > this message are intended for the exclusive use of the addressee(s) and may > contain proprietary, confidential or privileged information. If you are not > the intended recipient, you should not disseminate, distribute or copy this > e-mail. Please notify the sender immediately and destroy all copies of this > message and any attachments. WARNING: Computer viruses can be transmitted via > email. The recipient should check this email and any attachments for the > presence of viruses. The company accepts no liability for any damage caused > by any virus transmitted by this email. www.wipro.com <http://www.wipro.com/> > The information contained in this electronic message and any attachments to > this message are intended for the exclusive use of the addressee(s) and may > contain proprietary, confidential or privileged information. If you are not > the intended recipient, you should not disseminate, distribute or copy this > e-mail. Please notify the sender immediately and destroy all copies of this > message and any attachments. WARNING: Computer viruses can be transmitted via > email. The recipient should check this email and any attachments for the > presence of viruses. The company accepts no liability for any damage caused > by any virus transmitted by this email. www.wipro.com <http://www.wipro.com/> > _______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org <mailto:osgi-dev@mail.osgi.org> > https://mail.osgi.org/mailman/listinfo/osgi-dev > <https://mail.osgi.org/mailman/listinfo/osgi-dev> > The information contained in this electronic message and any attachments to > this message are intended for the exclusive use of the addressee(s) and may > contain proprietary, confidential or privileged information. If you are not > the intended recipient, you should not disseminate, distribute or copy this > e-mail. Please notify the sender immediately and destroy all copies of this > message and any attachments. WARNING: Computer viruses can be transmitted via > email. The recipient should check this email and any attachments for the > presence of viruses. The company accepts no liability for any damage caused > by any virus transmitted by this email. www.wipro.com > <http://www.wipro.com/>_______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org <mailto:osgi-dev@mail.osgi.org> > https://mail.osgi.org/mailman/listinfo/osgi-dev > <https://mail.osgi.org/mailman/listinfo/osgi-dev> > > The information contained in this electronic message and any attachments to > this message are intended for the exclusive use of the addressee(s) and may > contain proprietary, confidential or privileged information. If you are not > the intended recipient, you should not disseminate, distribute or copy this > e-mail. Please notify the sender immediately and destroy all copies of this > message and any attachments. WARNING: Computer viruses can be transmitted via > email. The recipient should check this email and any attachments for the > presence of viruses. The company accepts no liability for any damage caused > by any virus transmitted by this email. www.wipro.com > <http://www.wipro.com/>_______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org <mailto:osgi-dev@mail.osgi.org> > https://mail.osgi.org/mailman/listinfo/osgi-dev > <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