Just annotate any class with @Extension and Jenkins will instantiate it as a singelton and manage it's lifecycle. You can get it via ExtensionList.lookup(YourClass.class)
And for good measure annotate it with @Restricted(NoExternalUse) to hinder other plugins from using it. /B On Tue, Apr 12, 2016 at 9:56 AM, Marcin Zajączkowski <msz...@wp.pl> wrote: > On Monday, April 11, 2016 at 6:29:59 PM UTC+2, Marcin Zajączkowski wrote: >> >> Hi, >> >> In the plugin implemented as Notifier (Rundeck plugin) I would like to >> add global cache (one, available for every job using that plugin) to not >> make the same REST call for various jobs (which on a Jenkins instance >> hundreds of jobs increase startup time slightly). >> >> Is there any mechanism (a place) in Jenkins which I could use to store >> those cached values? If not what is a preferred solution to implement cope >> with it? >> > > As In fact it is only needed when jobs are parsed at the Jenkins startup > (RundeckJobProjectLinker)Action is created for every build in the history, > so the requirements can be simplified to make it available only on master > (no need to propagate across slaves) and it can be transient (rebuilt on > reset). Static ConcurrentHashMap in that class would be probably the > easiest implementation, but it smells bad. Maybe there is a storage in > Jenkins to keep those shared values? > > Marcin > > > >> >> Marcin >> >> -- >> http://blog.solidsoft.info/ - Solid Soft - Working code is not enough >> >> -- > You received this message because you are subscribed to the Google Groups > "Jenkins Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jenkinsci-dev+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-dev/f879d1b3-b6a6-4352-ba6b-5946e76bc02d%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-dev/f879d1b3-b6a6-4352-ba6b-5946e76bc02d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Robert Sandell *Software Engineer* *CloudBees Inc.* -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CALzHZS1TB2PLDX4CTQTsJ4wBro6H%3DZRq71vKS-NNExx4Monziw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.