⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 notificationinfomap.java

📁 jmx在spring中的实现
💻 JAVA
字号:
/*
======================================================================

  NotificationInfoMap.java

  Created by Claude Duguay
  Copyright (c) 2005

======================================================================
*/

package com.claudeduguay.mbeans.spring;

import java.util.*;

import javax.management.*;
import javax.management.modelmbean.*;

public class NotificationInfoMap extends HashMap<String,MBeanNotificationInfo>
{
	public NotificationInfoMap(ModelMBeanInfo modelMBeanInfo)
	{
		initializeMap(modelMBeanInfo);
	}
	
	protected void initializeMap(ModelMBeanInfo modelMBeanInfo)
	{
		MBeanNotificationInfo[] notifications = modelMBeanInfo.getNotifications();
		String[] matchTypes = {".set.", ".before.", ".after."};
		for (MBeanNotificationInfo info : notifications)
		{
			String[] notificationTypes = info.getNotifTypes();
			for (String notificationType : notificationTypes)
			{
				for (String matchType : matchTypes)
				{
					int index = notificationType.indexOf(matchType);
					if (index > -1)
					{
						String key = notificationType.substring(index + 1);
						put(key, info);
					}
				}
			}
		}
	}
	
	public MBeanNotificationInfo findNotificationInfo(String prefix, String name)
	{
		return get(prefix + "." + name);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -