Created
January 23, 2009 12:41
-
-
Save shimarin/51005 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package net.stbbs; | |
| import java.util.Hashtable; | |
| import javax.management.MalformedObjectNameException; | |
| import javax.management.Notification; | |
| import javax.management.NotificationListener; | |
| import javax.management.ObjectName; | |
| import com.sonicsw.ma.mgmtapi.config.MgmtException; | |
| import com.sonicsw.mf.jmx.client.JMSConnectorAddress; | |
| import com.sonicsw.mf.jmx.client.JMSConnectorClient; | |
| import com.sonicsw.mq.mgmtapi.runtime.IBrokerProxy; | |
| import com.sonicsw.mq.mgmtapi.runtime.MQProxyFactory; | |
| public class Management implements NotificationListener { | |
| public static void main(String[] args) | |
| throws MgmtException, MalformedObjectNameException, | |
| NullPointerException | |
| { | |
| JMSConnectorClient connector = new JMSConnectorClient(); | |
| Hashtable conn = new Hashtable(); | |
| conn.put("ConnectionURLs", "tcp://localhost:2506"); | |
| conn.put("DefaultUser", ""); | |
| conn.put("DefaultPassword", ""); | |
| connector.connect(new JMSConnectorAddress(conn)); | |
| IBrokerProxy bp = MQProxyFactory.createBrokerProxy( | |
| connector, new ObjectName("brokerName")); | |
| NotificationListener nl = new Management(); | |
| bp.addNotificationListener(nl, null, null); | |
| } | |
| public void handleNotification(Notification arg0, Object arg1) { | |
| // ここでNotificationに対する処理を行う | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment