Book Image

Extending Jenkins

By : Donald Simpson
Book Image

Extending Jenkins

By: Donald Simpson

Overview of this book

Jenkins CI is the leading open source continuous integration server. It is written in Java and has a wealth of plugins to support the building and testing of virtually any project. Jenkins supports multiple Software Configuration Management tools such as Git, Subversion, and Mercurial. This book explores and explains the many extension points and customizations that Jenkins offers its users, and teaches you how to develop your own Jenkins extensions and plugins. First, you will learn how to adapt Jenkins and leverage its abilities to empower DevOps, Continuous Integration, Continuous Deployment, and Agile projects. Next, you will find out how to reduce the cost of modern software development, increase the quality of deliveries, and thereby reduce the time to market. We will also teach you how to create your own custom plugins using Extension points. Finally, we will show you how to combine everything you learned over the course of the book into one real-world scenario.
Table of Contents (16 chapters)
Extending Jenkins
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Singletons


Before we move on from the high-level and design theory topic and take a look at implementing extensions in Jenkins, there is one more Java design pattern that we still need to cover—the Singleton pattern.

Singletons are used when you want to ensure that there will only be either zero or one instance of a given class.

Typically, this pattern occurs when you need to control concurrent actions—by ensuring that there is only a maximum of one instance possible, we can be sure that we will not face any concurrency or race conditions, as this class (and its code) will definitely be the only possible instance at any given time. Usually, a Singleton will be used by many different functions, and its purpose is to handle and manage this demand safely.

A common Singleton example is a logging utility. For example, a class that takes a message from several different areas of a system at any point in time. It then opens a log file and appends the message to the file. We wouldn't want two classes...