|
JMX in Action Benjamin G. Sullins and Mark B. Whipple 2002 | 424 pages ISBN: 1930110561 |
|||
![]() |
$20.00 | PDF ebook | |
![]() |
$39.95 | Softbound print book | |
Table of Contents
preface xvii
acknowledgments xix
about this book xxi
about the cover illustration xxvi
- Part 1 Getting started 1
- 1 Resource management and JMX 3
- 1.1 Resource management 4
- Today’s management environment 5
- The ideal management environment 6
- Management for the real world 7
- 1.2 Providing a Java solution: Java Management Extensions 8
- Benefits of using JMX 9
- Essential JMX terms 11
- 1.3 The JMX architecture 14
- Example: managing the bicycle shop server 14
- The distributed layer 16
- The agent layer 17
- The instrumentation layer 18
- Notifications 19
- 1.4 Using JMX as an application architecture 20
- 1.5 JMX in use today 21
- 1.6 Developing with JMX 21
- 1.7 Summary 22
- 2 “Hello World,” the JMX way 23
- 2.1 Getting started 24
- A JMX architecture refresher 24
- Setting up the development environment 25
- 2.2 Managing your first resource 26
- Writing the HelloWorld MBean 27
- 2.3 Creating a JMX agent 29
- Writing the HelloAgent class 30
- More about object names 33
- 2.4 Running the agent 35
- Compiling the agent 35
- Running the agent 35
- Contacting the agent 35
- 2.5 Working with the HTML adapter 36
- Agent View 36
- MBean View 38
- Admin View 40
- Registering/unregistering MBeans on the HelloAgent 41
- 2.6 Using MBean notifications 43
- Adding notification code to the HelloWorld MBean 43
- Changes to the HelloAgent class 46
- 2.7 Summary 48
- 3 Building a foundation 51
- 3.1 The scope of the agent 52
- Using the HTML adapter 52
- Using the RMI connector 53
- 3.2 Writing the JMXBookAgent class 54
- Class definition and constructor 54
- Adding agent connectivity 55
- Finishing with a main() method 57
- 3.3 Writing the RMIClientFactory class 58
- 3.4 Writing the ExceptionUtil class 59
- 3.5 Running the agent 60
- Connecting to the agent with the browser 60
- Connecting to the agent with an RMI client 60
- 3.6 Summary 62
- Part 2 Instrumenting manageable resources 63
- 4 MBeans for stable resources 65
- 4.1 Laying the MBean groundwork 66
- Common coding rules for all MBeans 66
- Using Standard MBeans 67
- 4.2 Composing the standard management interface 68
- Components of the management interface 68
- Example: a printer MBean interface 70
- 4.3 Standard MBean inheritance patterns 71
- Direct implementation of an MBean interface 72
- Inheriting the management interface 72
- Overriding the management interface 73
- Extending the management interface 74
- Combination of extending and overriding 74
- Extending a non-MBean interface 75
- 4.4 Standard MBeans in action 76
- Making applications easily configurable 77
- Breaking applications into components 82
- MBeans using other MBeans 86
- 4.5 Handling MBean errors 90
- Throwing exceptions 91
- Runtime exceptions 93
- 4.6 Summary 94
- 5 MBeans for changing resources 95
- 5.1 Working with the DynamicMBean interface 96
- 5.2 Examining the DynamicMBean interface 96
- Acquiring the dynamic management interface 98
- Working with dynamic MBean attributes 98
- Invoking operations 100
- 5.3 Understanding the MBeanInfo class 100
- Metadata of the MBeanInfo class 101
- The MBeanFeatureInfo and MBeanParameterInfo classes 102
- The MBeanConstructorInfo class 102
- The MBeanAttributeInfo class 102
- The MBeanOperationInfo class 103
- The MBeanNotificationInfo class 104
- 5.4 Inheritance patterns 104
- 5.5 Dynamic MBeans in action 105
- Managing a Jini service 105
- Rebuilding a management interface at runtime 110
- 5.6 Creating utility classes 111
- Creating a dynamic MBean super class 111
- 5.7 Summary 116
- 5.2 Examining the DynamicMBean interface 96
- 6 Communication with MBeans using notifications 117
- 6.1 Using MBean notifications 118
- 6.2 Components of the JMX notification model 119
- Being a notification broadcaster 119
- Describing notifications as part of a management interface 121
- The Notification class 122
- Being a notification listener 123
- Filtering notifications 124
- 6.3 A notification polling example 125
- 6.4 Capturing MBean attribute changes 127
- Filtering attribute change notifications 128
- Revising the Polling MBean 129
- Testing the Polling MBean 131
- 6.5 Registering as a notification listener 133
- Registering with an MBean 133
- Registering with the MBean server 134
- 6.6 Persisting MBean notifications 134
- 6.7 Notifications from the MBean server 136
- Notification types sent from the MBean server 137
- 6.8 Summary 138
- 6.2 Components of the JMX notification model 119
- 7 MBeans on-the-fly 139
- 7.1 Working with the Model MBean 140
- 7.2 Features of the Model MBean 141
- MBean persistence 141
- Notification logging 142
- Attribute value caching 142
- Operation delegation 142
- Generic notifications 142
- 7.3 Examining the ModelMBean interface 143
- Configuring a Model MBean 144
- Acquiring and using the management interface 144
- Registering for notifications 145
- MBean persistence 145
- 7.4 Understanding the Model MBean metadata 145
- Using descriptors 146
- Constructing a ModelMBeanInfoSupport object 147
- The ModelMBeanAttributeInfo class 149
- The ModelMBeanOperationInfo class 151
- The ModelMBeanConstructorInfo class 153
- The ModelMBeanNotificationInfo class 153
- 7.5 Model MBeans in action 154
- Building ModelMBeanInfo objects 154
- Modeling with Model MBeans 161
- 7.6 Summary 162
- 7.2 Features of the Model MBean 141
- Part 3 The JMX agent and distributed layers 163
- 8 Working with an MBean server 165
- 8.1 JMX agent architecture in review 166
- Using protocol adapters and connectors 166
- 8.2 The MBeanServer interface 167
- Registration methods 168
- Creation and registration methods 170
- Notification methods 171
- MBean manipulation 173
- MBean server information 175
- Other methods 175
- 8.3 Querying for MBeans 176
- The MBeanServer query methods 177
- Creating query expressions 179
- Constructing examples 182
- 8.4 Summary 186
- 9 Communicating with JMX agents 187
- 9.1 Comparing connectors and protocol adapters 189
- 9.2 Connecting by using RMI 189
- Using the RMI connector 189
- Creating the RMI server MBean 190
- Connecting to the RMI server 191
- Additional uses for the RMI connector 193
- 9.3 Connecting to agents using Jini 195
- Components of the Jini connector 196
- Writing the Jini connector 197
- Outstanding issues 211
- Testing the Jini connector 211
- 9.4 JMX and SNMP 213
- What is SNMP? 213
- Using an SNMP protocol adapter 214
- 9.5 Connecting by using a TCP adapter 215
- Writing the code 215
- Testing the TCP adapter 226
- 9.6 Summary 228
- 9.2 Connecting by using RMI 189
- 10 Advanced MBean loading 229
- 10.1 Understanding the M-let service 230
- 10.2 Using the M-let service 231
- Writing M-let files 231
- Examining the MLet MBean 235
- 10.3 Using the M-let service to load MBeans 237
- Adding to the JMXBookAgent class 237
- Example: using an M-let file 238
- Example: expanding the agent’s codebase 239
- 10.4 Wrapping the M-let service to provide notifications 240
- Writing the MLetNotification class 241
- Writing the MLetWrapper MBean 243
- Using the MLetWrapper MBean 249
- 10.5 Summary 251
- 10.2 Using the M-let service 231
- 11 Working with the relation service 253
- 11.1 Using the JMX relation service 254
- Components of the relation service 255
- 11.2 Using the relation service to manage a phone system 257
- Defining the scenario 257
- The phone system management example 258
- Defining an external relationship with an MBean 259
- 11.3 Constructing the MBean relationship 261
- Creating the MBeans 261
- Defining the relation 266
- Creating the role objects 269
- Creating the Relation MBean 270
- Adding the relation service to the JMXBookAgent class 273
- Adding a new relation to the relation service 274
- The RelationMain main() method 276
- 11.4 Running the example 277
- Viewing the MBeans 277
- Viewing exposed methods 277
- Disabling a phone card 279
- 11.5 Summary 280
- 12 More agent services: monitors and timers 283
- 12.1 Monitoring MBean attributes with JMX 284
- The monitoring foundation 285
- Monitoring String values 288
- Monitoring a value range 290
- Monitoring a counted value 292
- 12.2 Monitor examples 293
- Creating the example agent and MBean 294
- Testing the String monitor 297
- Testing the Gauge monitor 298
- Testing the Counter monitor 299
- 12.3 Taking corrective measures 300
- 12.4 Sending dated notifications: the timer service 302
- Examining the timer 302
- 12.5 Using the timer service 305
- Testing the timer service 307
- 12.6 Summary 308
- Part 4 Using JMX with the J2EE platform 309
- 13 Using JMX with the Java Message Service 311
- 13.1 The Java Message Service 312
- 13.2 Combining JMX with JMS 312
- 13.3 Driving a home theater system 313
- Writing the example 315
- 13.4 Running the example 326
- Starting and configuring the JBoss server 327
- Starting the agent and registering the MBean 329
- Running the debugger subscriber 331
- Publishing the control messages 332
- 13.5 Summary 332
- 13.2 Combining JMX with JMS 312
- 14 Using JMX with Enterprise JavaBeans 335
- 14.1 An EJB review 336
- The EJB model 336
- Why combine JMX with EJBs? 337
- Accessing enterprise data with JMX 338
- 14.2 Example: managing user logins 340
- The problem 340
- The JMX solution 340
- 14.3 Developing the login monitor 341
- Constructing the user information entity bean 342
- Constructing the user information management MBean 346
- Writing the user login client test class 349
- 14.4 Running the Login Monitor 350
- Deploying your entity bean in the JBoss server 350
- Registering with the agent 354
- Counting user login attempts 355
- Removing login privileges 356
- 14.5 Example: managing EJBs 356
- Constructing the workflow entity bean 357
- Constructing the WorkflowManager MBean 365
- Running the workflow manager 370
- Generating EJB managers 371
- 14.6 Summary 375
- A Open MBeans 377
- A.1 What is an Open MBean? 378
- A.2 Basic data types 378
- A.3 Creating more complex data structures 379
- A.4 Describing Open MBean data types 380
- A.5 Open MBean metadata 381
- A.6 Summary 383
- A.2 Basic data types 378
- B Using Ant 385
- B.1 Downloading and installing Ant 386
- B.2 Setting up the build file 386
index 389 - B.2 Setting up the build file 386
DESCRIPTION
With Java Management Extensions (JMX), you can configure, manage and monitor your Java applications at run-time, as well as break your applications into components that can be swapped out. JMX provides a window into an application's state and its behavior, and a protocol-independent way of altering both state and behavior. It lets you expose portions of your application in just a few lines of code.
Written for both new and experienced developers, this book explains the JMX specification and discusses its use through clean, well-discussed examples. It covers the JMX architecture and how to create all types of MBeans. It includes important advanced topics such as extending the JMX classes, combining with other Java technologies, the MBean relation service, dynamic MBean loading, and creating your own protocol adapters.
What's Inside:
- Manage and monitor your Java applications
- Combine JMX with J2EE technologies (EJB and JMS)
- Make use of Sun's RMI adapter
- Create protocol adapters for TCP and Jini
- Extend JMX to make it more powerful
- Best practices for the use of MBeans
ABOUT THE AUTHORS...
Ben Sullins is a senior Java developer with both server- and client-side experience. He has extensive JMX experience. Ben lives in the Denver area.
A fifteen-year veteran, Mark Whipple has focused on networked applications, including monitoring applications with SNMP and JMX. He holds multiple software patents and has been a member of several standards bodies, including the IETF. He lives in Dallas, TX.

