Are all jobs each run in separate JVMs?

112 views
Skip to first unread message

Laurence Bordowitz

unread,
Jun 22, 2015, 11:28:59 AM6/22/15
to Jenkins Dev
I think the answer to this question is probably no:

Q: Are all Jenkins jobs each run in separate JVM instances?

I'm asking this because I'm working on creating a plugin for the static code analysis tool sputnik, but it has some deficiencies... There's a class in it called "ConfigurationHolder" which holds a static mutable singleton instance of the sputnik configuration. If all plugins were run in the same JVM, starting a new job would immediately affect another job's configuration.

Also, what is the lifecycle of a plugin? I've done work on plugins before, but I still don't really know when the plugin instance gets created, run, etc.
 
-- Larry Bordowitz

Stephen Connolly

unread,
Jun 22, 2015, 12:27:22 PM6/22/15
to jenkin...@googlegroups.com
In general I dislike having plugins that run the actual tool within the JVM of Jenkins or the Slaves. There are all sorts of issues that you encounter such as class conflicts, dependency hell, etc.

The best way to run a build tool - in my opinion - is to fork a process specifically for that build tool. I would note that this is how Maven has been moving towards, IOW that the individual Maven plugins actually fork for their Java based tools rather than trying to shoehorn into the Maven JVM.

So my recommendation to you is that you fork a JVM for the build part, and do any post-processing of results in that forked JVM. That way you can completely control the classpath of the forked JVM and not worry about other things. It also allows you to have builds that work with different versions of the tool on the same Jenkins instance.

HTH

--
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-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/501668687.3194673.1434986923236.JavaMail.yahoo%40mail.yahoo.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages