Chapter 11. The Relation Service

The relation service provides a facility to associate MBeans with each other. You use the metadata classes provided by the relation service to describe and then establish n-ary relationships between registered MBeans, as dictated by your application policies. You then use the relation service to maintain the consistency of those relationships so that those application policies are followed. The relation service must be implemented by every compliant JMX implementation.

In this chapter, we will examine the JMX relation service and see how to write code to use it. We will begin with an overview of the concepts employed by the relation service, such as roles and relations, then we will look at the relation service classes that implement these concepts. Next, we will see how to write code to use the relation service classes to describe relationships between MBeans used in the sample application. This chapter concludes with a look at the support classes provided by the relation service, their purpose, and how to use them.

The code we will develop in this chapter to describe relations, roles, etc. runs within an agent. Thus, I will use the terms “we” and “you” synonymously with “the agent.”

Introduction

To use the relation service effectively, you need to understand a few key concepts:

Role

A named category of functionality that is performed by an MBean. For example, in the sample application, there are two subclasses of Worker whose names correspond to ...

Get Java Management Extensions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.