- 浏览: 240787 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
akka_li:
学习了!但是为什么后续的没有了?!
EJB4:RMI和RMI-IIOP -
springaop_springmvc:
apache lucene开源框架demo使用实例教程源代码下 ...
Lucene学习笔记(一)Lucene入门实例 -
qepipnu:
求solr 客户端 jar包
Solr学习笔记(三)Solr客户端开发实例 -
zhangbc:
是这问题,赞!
Oracle Start Up 2 Oracle 框架构件、启动、解决一个问题 -
feilian09:
查询 select hibernate jdbc 那个效率快
Hibernate,JDBC性能探讨
JMX Architecture Overview:
JMX technology provides a standard API for management and monitoring of resources. As http://kylinsoong.iteye.com/admin/blogs/794995 Part 3 depicted, the JMX architecture can be broken down into three levels: Instrumentation, Agent, Remote Management, As the following figure described:
Instrumentation Layer contains MBeans representing their manageable resources, such as applications, devices, or services, are instrumented using Java objects called Managed Beans (MBeans). MBeans expose their management interfaces, composed of attributes and operations, through a JMX agent for remote management and monitoring;
Agent Layer is the main component of a JMX agent is the MBean server. This is a core managed object server in which MBeans are registered. A JMX agent also includes a set of services for handling MBeans. JMX agents directly control resources and make them available to remote management agents;
Distributed Layer also named Remote Management layer, contain adapters and connectors make a JMX agent accessible from remote management applications outside the agent’s Java Virtual Machine (Java VM).
HelloWorld JMX way
1. Complete Instrumentation layer dev
The first step in developing the HelloWorld MBean is to write its Java interface. The interface declares three methods: one getter, one setter, and an additional method for printing the HelloWorld MBean’s greeting. Code view:
public interface HelloWorldMBean { public void setGreeting( String greeting ); public String getGreeting(); public void printGreeting(); }
Before we start HelloWroldMBean implemetation, we introduce JMX notification first, notification is the most imprtant feature of JMX, any managment system need notification mechanism, to add notification to our Helloworld mbean we need to extends the avax.management.NotificationBroadcasterSupport. Our MBean class:
public class HelloWorld extends NotificationBroadcasterSupport implements HelloWorldMBean { private String greeting = null; public HelloWorld() { this.greeting = "Hello World! I am a Standard MBean"; } public HelloWorld(String greeting) { this.greeting = greeting; } public void setGreeting(String greeting) { this.greeting = greeting; Notification notification = new Notification("jmx.demo.helloWorld.test" , this , -1 , System.currentTimeMillis() , greeting ); sendNotification(notification); } public String getGreeting() { return greeting; } public void printGreeting() { System.out.println(greeting); } }
2 Complete Agent Code
As step 1, we have our HelloWorldMbean, we need to make it available to use, to do so we must register it in a JMX Agent. Therefore we create HelloAgent class JMX agents are JMX components in the agent layer of JMX and are the containers for MBeans. The HelloAgent class performs 4 important tasks:
1> It creates an MBeanServer instance to contain MBeans.
2> It creates an HTML adapter to handle connections from HTML clients.
3> It registers a new instance of the HelloWorld MBean.
4> It handles the notification that HelloWorldMBean sent.
public class HelloAgent implements NotificationListener { private MBeanServer mbs = null; public HelloAgent() { // mbs = MBeanServerFactory.createMBeanServer("jmx.demo.HelloAgent"); mbs = ManagementFactory.getPlatformMBeanServer(); HtmlAdaptorServer adapter = new HtmlAdaptorServer(); HelloWorld hw = new HelloWorld(); ObjectName adapterName = null; ObjectName helloWorldName = null; try { helloWorldName = new ObjectName( "jmx.demo.HelloAgent:type=helloWorld,name=helloWorld" ); mbs.registerMBean( hw, helloWorldName ); hw.addNotificationListener(this, null, null); adapterName = new ObjectName("jmx.demo.HelloAgent:type=htmlAdapter,name=htmlAdapter,port=8000"); adapter.setPort(8000); mbs.registerMBean( adapter, adapterName ); adapter.start(); } catch (Exception e) { e.printStackTrace(); } } public static void main(String args[]) throws InterruptedException { System.out.println("HelloAgent is running"); HelloAgent agent = new HelloAgent(); Thread.sleep(Long.MAX_VALUE); } public void handleNotification(Notification notification, Object handback) { System.out.println( "Receiving notification..." ); System.out.println( notification.getType() ); System.out.println( notification.getMessage() ); } }
3. Compete Distibuted layer Code
In this simple HelloWorld example we only Use HTML adapter to implement remote management, however, RMI connector implement remote management is more popular, I will explore into it in the later blogs. In this blog we will show Html adapter implement remote management in Test section.
HelloWorld Test
After starting the main method, we can through 2 methods test and manage HelloWrold
Method one:
Start a new command line, input 'jconsole' the following widget came out:
Clicking HelloAgent then you will get into Jconsole control interface and find both HelloWorld and htmlAdapter selection folder bar in the left menu tree:
Clicking reference method or change the attributes, the corresponding action will take place.
Method two:
Through http://127.0.0.1:8000/ we could find jmx.demo.HelloAgent from All Agent View List
Cliking helloWord we also can find the operation and attributes, through HTML interface we also can triger the response notification event.
评论
This cannot be accessed by other users.
try use this:http://kylinsoong.iteye.com/blog/794995
This cannot be accessed by other users.
发表评论
-
Java Nio Usage Demo & A example of use selectableChannel
2011-12-06 21:42 3703Primary purpose of this blog is ... -
JDK Source Code & java.nio
2011-11-10 23:26 2415java.nio is very useful and a p ... -
Oracle - Add Exist Validation Before Create Table
2011-11-07 13:49 1464Usually we need to check the ta ... -
JDK Source Code & java.rmi.server.RMISocketFactory
2011-10-31 23:14 2200Today's Source code analysing s ... -
Thinking in JDBC
2011-09-22 20:56 1883This blog will beas on a series ... -
Jboss-eap-5.1 Messaging
2011-08-02 21:50 2481This section I will concertate ... -
Jboss-eap-5.1 starting up note
2011-07-26 22:46 2594Jboss enterprise platform 5 hav ... -
EJB Security & JAAS Demo
2011-05-21 19:39 1616PROLOGUE: When deploying ... -
JBoss LoginInitialContext Factory Implementation
2011-05-15 16:05 1537Jboss has a series of imp ... -
Jboss Reference Exception Gallery
2011-04-27 14:08 29011. Unable to locate a login con ... -
Hibernate Annotation 的一个问题,给点意见
2011-03-10 12:43 22问题:org.hibernate.annotations. ... -
大家说说BBC的网站用的是什么技术做的
2011-02-22 05:01 1443最近在英国出差,发现这里的一些网站做的相当有特色,有些网站不是 ... -
Hibernate OneToMany 单向和双向配置对数据存取性能的比较
2011-02-08 17:06 23371. 开篇说明:今天是春 ... -
对Hibernate属性(CascadeType、JoinColumn、JoinTable、ForeignKey等)的研究
2010-12-26 15:45 16689本文列出几个“EJB 学习阶段总结:JBoss下发布一个Toy ... -
EJB 学习阶段总结:JBoss下发布一个Toy企业应用
2010-12-25 12:11 2651解释题目:为什 ... -
EJB7: Message Driven Bean
2010-12-21 22:42 2153在企业系统中需要使用 ... -
EJB6: EntityBean例子
2010-11-26 14:48 1522本例子描述向EJB容器(JBoss)部署http: ... -
JPA dev: 几个问题总结(续)
2010-11-25 18:02 24932. 如何由PoJo类生成数据库中的表 首先可以根据实体间关 ... -
JPA dev: 几个问题总结
2010-11-25 16:56 3412最近工作中遇到几个与JPA相关的问题,本文通过一个例子总结一下 ... -
JAXB学习
2010-11-24 22:35 01 什么是JAXB? JAXB全称Java Ar ...
相关推荐
**标题解析:** "JMX HelloWorld Download" 指的是一个关于Java Management Extensions(JMX)的简单示例,可能是用于教学或演示如何在Java应用中使用JMX技术。"Download"表明这是一个可以下载的资源,可能包含了...
在使用JMC时,`jmx_access&password;` 文件起着至关重要的作用,特别是与JMX(Java Management Extensions)安全相关的配置有关。 JMX 是Java平台的一个标准接口,允许开发者管理应用程序、设备和服务。它提供了一...
MBeanServer可以将Hello对象注册进去,然后通过JMX客户端接口(如HtmlAdaptorServer)暴露给外部进行管理。 总结起来,JMX是一个强大的工具,它简化了Java应用程序的管理和监控,通过MBeans的抽象,使得开发者可以...
为了更好地理解JMX的实际应用,我们来看一个简单的HelloWorld示例: 1. **Hello类**:这是一个普通的Java类,实现了`HelloMBean`接口。该类中定义了两个方法`getName()`和`setName()`,用于获取和设置名称;另外还...
Java Management Extensions(JMX)是Java平台中用于管理和监控应用程序、操作系统、网络设备等资源的一种标准框架。通过JMX,开发者可以创建管理代理(MBeans),这些代理暴露了各种管理特性,使得系统管理员可以...
JMX实战 书中不仅有对于基础知识的介绍,还有对于JMX开发中重大的体系架构问题的深入探讨,总结了大量JMX开发中的设计模式,并讨论了框架、安全性与性能等等。书中提供了几个典型的例子,兼顾各种开发平台,这些...
jmx监控ActiveMQ监控 jmx(Java Management Extensions)是一种Java技术,为Java应用程序提供了管理和监控的功能。ActiveMQ是Apache软件基金会下的一个开源消息队列系统,提供了高效、可靠的消息传递服务。在生产...
一个简单的JMX示例是创建一个名为`Hello`的类,该类实现了`HelloMBean`接口。`HelloMBean`定义了`getName()`和`setName()`方法,以及`printHello()`方法。`Hello`类中的这些方法允许外部管理工具获取和设置名称,...
当我们谈论"jboss远程调用JMX"时,我们关注的是如何通过网络从一个JMX客户端连接到运行在JBoss服务器上的JMX服务,以便进行远程管理和监控。 首先,我们需要了解JMX的基本概念。MBean是JMX的核心,它是一个Java对象...
Java管理扩展(JMX)是Java平台提供的一种标准机制,用于管理和监视应用程序、服务和设备。在本项目中,"jmx监控weblogic,tomcat,websphere源码"涉及了使用JMX来监控三个主流的Java应用服务器:WebLogic、Tomcat和...
这个"jmx-1.2.1(jmxri+jmxtools) jar"包含了JMX的两个核心组件:JMX Remote Interface (jmxri) 和 JMX Tools。 1. **JMX Remote Interface (jmxri)**: JMX Remote Interface 是JMX框架的一部分,它允许远程访问和...
JMX(Java Management Extensions)是一种Java平台标准,用于管理和监控应用程序。在本实战中,我们将深入探讨如何利用JMX对HBase和Hadoop进行监控,以确保系统的稳定性和性能。 首先,我们需要理解HBase。HBase是...
Java Management Extensions (JMX) 是Java平台上的一个标准技术,用于管理和监控应用程序、操作系统和网络设备。`jmxri-1.2.1.jar` 和 `jmxtools-1.2.1.jar` 是与JMX相关的两个核心库文件,它们在Java应用程序中扮演...
在运维过程中,JMX(Java Management Extensions)监控是一个非常重要的工具,可以帮助我们实时查看和管理应用程序的状态,以及诊断和解决问题。本文将详细介绍如何使用 JMX 监控 TongWeb7。 首先,要开启 JMX 监控...
接下来,我们将通过一个简单的“Hello World”示例来演示如何使用JMX。 1. **定义MBean接口**:首先,需要定义一个MBean接口,即`HelloMBean`。该接口规定了被管理对象(MBean)应该具有的行为,例如获取和设置名称...
Java Management Extensions(JMX)是Java平台提供的一种标准框架,用于管理和监控应用程序、操作系统和网络设备等资源。它允许开发者创建可管理的组件,并通过管理代理暴露这些组件,以便远程或本地工具进行监控和...
Java Management Extensions(JMX)是Java平台上的一个标准技术,用于管理和监控应用程序、操作系统和网络设备。它提供了一种统一的方式来创建、配置、查询和控制管理资源,使得开发者能够轻松地在他们的应用中添加...
Java Management Extensions(JMX)是Java平台上的一个标准技术,用于管理和监控应用程序、服务和设备。JMX提供了创建、配置、查询和管理管理对象(MBeans)的能力,这些对象可以代表任何可管理的资源,从操作系统到...
Description Resource Path Location Type Missing artifact com.sun.jmx:jmxri:jar:1.2.1 pom.xml /eshop-storm line 2 Maven Dependency Problem