JB, for top of my head - Quartz is passed only QuartzJob class, that gets created "when needed". Meaning - I can not pass any non-serializable data/object to the Job - as ( in my case ) Jobs are persistent in Oracle and scheduled/started at later time - in few minutes or few day, weeks, months ... In some cases also Karaf is restarted in between ( from the time Job was created and before it job is scheduled/started )
So usecase is: Quartz Job is created and scheduled ( meaning written to Oracle ) , due to time span or SW/HW failure Karaf is restarted - when times comes to start/schedule Quartz Job -- the environment is ( in most cases ) different in a way, I can not relay on any passed in object. I imagine also when running on distributed environment it would be a problem? ( I did not come to this at this point -- one more milestone ahead ). Thanks for the support (y) Kind Regards, Miroslav V V tor., 11. sep. 2018 ob 13:47 je oseba Jean-Baptiste Onofré < j...@nanthrax.net> napisala: > By the way, why don't you pass the bundle context to your job > implementation QuartzJob ? > > Regards > JB > > On 11/09/2018 13:46, Jean-Baptiste Onofré wrote: > > FrameworkUtil.getBundle(Foo.class).getBundleContext(); > > > > Regards > > JB > > > > On 11/09/2018 13:43, Miroslav Beranič wrote: > >> Hi all, > >> > >> some junior question, but would like to make it correct way. > >> > >> Is it possible and if it is, how - to get access to BundleContext ( and > >> other OSGi environment ) from some plain Java object ? > >> > >> for example > >> > >> there is an Activator or a Compontent ( class with annotation @Component > >> ) that has code like: > >> > >> MyClass inst = new MyClass(); > >> inst.doSomeAction(); > >> > >> How would it be possible to get access to BundleContext from inside of > >> the method doSomeAction() ? > >> > >> ( this is related to my Scheduler work - as I would need access to > >> BundleContext from inside of a Quartz job, job is executed later on some > >> day - and even Karaf restart can happen ) > >> > >> > >> Kind Regards, > >> Miroslav > >> > >> > >> > >> -- > >> Miroslav Beranič > >> MIBESIS > >> +386(0)40/814-843 > >> miroslav.bera...@mibesis.si <mailto:miroslav.bera...@mibesis.si> > >> http://www.mibesis.si > > > > -- > Jean-Baptiste Onofré > jbono...@apache.org > http://blog.nanthrax.net > Talend - http://www.talend.com > -- Miroslav Beranič MIBESIS +386(0)40/814-843 miroslav.bera...@mibesis.si http://www.mibesis.si