當前位置: 首頁>>代碼示例>>Java>>正文


Java CompositeData類代碼示例

本文整理匯總了Java中javax.management.openmbean.CompositeData的典型用法代碼示例。如果您正苦於以下問題:Java CompositeData類的具體用法?Java CompositeData怎麽用?Java CompositeData使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CompositeData類屬於javax.management.openmbean包,在下文中一共展示了CompositeData類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getSlowQueriesCD

import javax.management.openmbean.CompositeData; //導入依賴的package包/類
/**
 * JMX operation - returns all the queries we have collected.
 * @return - the slow query report as composite data.
 */
@Override
public CompositeData[] getSlowQueriesCD() throws OpenDataException {
    CompositeDataSupport[] result = null;
    ConcurrentHashMap<String,QueryStats> queries = perPoolStats.get(poolName);
    if (queries!=null) {
        Set<Map.Entry<String,QueryStats>> stats = queries.entrySet();
        if (stats!=null) {
            result = new CompositeDataSupport[stats.size()];
            Iterator<Map.Entry<String,QueryStats>> it = stats.iterator();
            int pos = 0;
            while (it.hasNext()) {
                Map.Entry<String,QueryStats> entry = it.next();
                QueryStats qs = entry.getValue();
                result[pos++] = qs.getCompositeData(getCompositeType());
            }
        }
    }
    return result;
}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:24,代碼來源:SlowQueryReportJmx.java

示例2: main

import javax.management.openmbean.CompositeData; //導入依賴的package包/類
public static void main(String[] args) {
		try {
			String host = "localhost"; host = "csseredapp-dev-03";
			String port = "8356"; //port = "8356";
			String mbeanName = "java.lang:type=Memory";
			String attributeName = "HeapMemoryUsage";
			
			
			
			JMXServiceURL jmxUrl = new JMXServiceURL(
					"service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/jmxrmi" );
//			jmxUrl = new JMXServiceURL(
//					"service:jmx:rmi://localhost/jndi/rmi://" + host + ":" + port + "/jmxrmi" );
			
			logger.info("Target: " + jmxUrl ) ;
			
			JMXConnector jmxConnection = JMXConnectorFactory.connect( jmxUrl );
			
			logger.info("Got connections") ;
			
			CompositeData resultData = (CompositeData) jmxConnection.getMBeanServerConnection()
					.getAttribute( new ObjectName(mbeanName), attributeName) ;
			
			logger.log(Level.INFO, "Got mbean: heapUsed: {0}", resultData.get( "used")) ;
			
			Thread.sleep( 5000 );
		} catch ( Exception ex ) {
			logger.log( Level.SEVERE, "Failed connection", ex );
		} 
	}
 
開發者ID:csap-platform,項目名稱:csap-core,代碼行數:31,代碼來源:TestRawJmx.java

示例3: installGCMonitoring

import javax.management.openmbean.CompositeData; //導入依賴的package包/類
private static void installGCMonitoring() {
    List<GarbageCollectorMXBean> gcbeans = java.lang.management.ManagementFactory.getGarbageCollectorMXBeans();
    for (GarbageCollectorMXBean gcbean : gcbeans) {
        NotificationEmitter emitter = (NotificationEmitter) gcbean;
        System.out.println(gcbean.getName());

        NotificationListener listener = (notification, handback) -> {
            if (notification.getType().equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
                GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from((CompositeData) notification.getUserData());

                long duration = info.getGcInfo().getDuration();
                String gctype = info.getGcAction();

                System.out.println(gctype + ": - "
                        + info.getGcInfo().getId() + ", "
                        + info.getGcName()
                        + " (from " + info.getGcCause() + ") " + duration + " milliseconds");

            }
        };

        emitter.addNotificationListener(listener, null, null);
    }
}
 
開發者ID:vitaly-chibrikov,項目名稱:otus_java_2017_06,代碼行數:25,代碼來源:Main.java

示例4: fromCompositeData

import javax.management.openmbean.CompositeData; //導入依賴的package包/類
Object fromCompositeData(CompositeData cd, String[] itemNames, OpenTypeConverter[] converters)
    throws InvalidObjectException {
  Object o;
  try {
    o = getTargetClass().newInstance();
    for (int i = 0; i < itemNames.length; i++) {
      if (cd.containsKey(itemNames[i])) {
        Object openItem = cd.get(itemNames[i]);
        Object javaItem = converters[i].fromOpenValue(openItem);
        setters[i].invoke(o, javaItem);
      }
    }
  } catch (Exception e) {
    throw invalidObjectException(e);
  }
  return o;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:18,代碼來源:OpenTypeConverter.java

示例5: getCompositeData

import javax.management.openmbean.CompositeData; //導入依賴的package包/類
protected CompositeData getCompositeData() {
    // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
    // memoryUsageItemNames!
    final Object[] memoryUsageItemValues = {
        usage.getInit(),
        usage.getUsed(),
        usage.getCommitted(),
        usage.getMax(),
    };

    try {
        return new CompositeDataSupport(memoryUsageCompositeType,
                                        memoryUsageItemNames,
                                        memoryUsageItemValues);
    } catch (OpenDataException e) {
        // Should never reach here
        throw new AssertionError(e);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:MemoryUsageCompositeData.java

示例6: from

import javax.management.openmbean.CompositeData; //導入依賴的package包/類
public static MonitorInfo from(CompositeData cd) {
    try {
        CompositeData stecd = (CompositeData) cd.get("lockedStackFrame");
        StackTraceElement ste = new StackTraceElement(
                (String) stecd.get("className"),
                (String) stecd.get("methodName"),
                (String) stecd.get("fileName"),
                (Integer) stecd.get("lineNumber"));
        return new MonitorInfo(
                (String) cd.get("className"),
                (Integer) cd.get("identityHashCode"),
                (Integer) cd.get("lockedStackDepth"),
                ste);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:18,代碼來源:GenericArrayTypeTest.java

示例7: getCompositeData

import javax.management.openmbean.CompositeData; //導入依賴的package包/類
protected CompositeData getCompositeData() {
    // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
    // gcNotifInfoItemNames!
    final Object[] gcNotifInfoItemValues;
    gcNotifInfoItemValues = new Object[] {
        gcNotifInfo.getGcName(),
        gcNotifInfo.getGcAction(),
        gcNotifInfo.getGcCause(),
        GcInfoCompositeData.toCompositeData(gcNotifInfo.getGcInfo())
    };

    CompositeType gict = getCompositeTypeByBuilder();

    try {
        return new CompositeDataSupport(gict,
                                        gcNotifInfoItemNames,
                                        gcNotifInfoItemValues);
    } catch (OpenDataException e) {
        // Should never reach here
        throw new AssertionError(e);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:23,代碼來源:GarbageCollectionNotifInfoCompositeData.java

示例8: getCompositeData

import javax.management.openmbean.CompositeData; //導入依賴的package包/類
protected CompositeData getCompositeData() {
    // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
    // lockInfoItemNames!
    final Object[] lockInfoItemValues = {
        new String(lock.getClassName()),
        new Integer(lock.getIdentityHashCode()),
    };

    try {
        return new CompositeDataSupport(lockInfoCompositeType,
                                        lockInfoItemNames,
                                        lockInfoItemValues);
    } catch (OpenDataException e) {
        // Should never reach here
        throw Util.newException(e);
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:18,代碼來源:LockInfoCompositeData.java

示例9: printGcInfo

import javax.management.openmbean.CompositeData; //導入依賴的package包/類
private static void printGcInfo(CompositeData cd) throws Exception {
    GcInfo info = GcInfo.from(cd);
    System.out.print("GC #" + info.getId());
    System.out.print(" start:" + info.getStartTime());
    System.out.print(" end:" + info.getEndTime());
    System.out.println(" (" + info.getDuration() + "ms)");
    Map<String,MemoryUsage> usage = info.getMemoryUsageBeforeGc();

    for (Map.Entry<String,MemoryUsage> entry : usage.entrySet()) {
        String poolname = entry.getKey();
        MemoryUsage busage = entry.getValue();
        MemoryUsage ausage = info.getMemoryUsageAfterGc().get(poolname);
        if (ausage == null) {
            throw new RuntimeException("After Gc Memory does not exist" +
                " for " + poolname);
        }
        System.out.println("Usage for pool " + poolname);
        System.out.println("   Before GC: " + busage);
        System.out.println("   After GC: " + ausage);
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:22,代碼來源:ValidateOpenTypes.java

示例10: toCompositeData

import javax.management.openmbean.CompositeData; //導入依賴的package包/類
/**
 * @param jobDetail
 * @return CompositeData
 */
public static CompositeData toCompositeData(JobDetail jobDetail) {
    try {
        return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
                new Object[] {
                        jobDetail.getKey().getName(),
                        jobDetail.getKey().getGroup(),
                        jobDetail.getDescription(),
                        jobDetail.getJobClass().getName(),
                        JobDataMapSupport.toTabularData(jobDetail
                                .getJobDataMap()), 
                        jobDetail.isDurable(),
                        jobDetail.requestsRecovery(), });
    } catch (OpenDataException e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:21,代碼來源:JobDetailSupport.java

示例11: toCompositeData

import javax.management.openmbean.CompositeData; //導入依賴的package包/類
/**
 * @return composite data
 */
public static CompositeData toCompositeData(JobExecutionContext jec)
        throws SchedulerException {
    try {
        return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
                new Object[] {
                        jec.getScheduler().getSchedulerName(),
                        jec.getTrigger().getKey().getName(),
                        jec.getTrigger().getKey().getGroup(),
                        jec.getJobDetail().getKey().getName(),
                        jec.getJobDetail().getKey().getGroup(),
                        JobDataMapSupport.toTabularData(jec
                                .getMergedJobDataMap()),
                        jec.getTrigger().getCalendarName(),
                        jec.isRecovering(),
                        jec.getRefireCount(),
                        jec.getFireTime(), jec.getScheduledFireTime(),
                        jec.getPreviousFireTime(), jec.getNextFireTime(),
                        jec.getJobRunTime(),
                        jec.getFireInstanceId() });
    } catch (OpenDataException e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:27,代碼來源:JobExecutionContextSupport.java

示例12: fromNonNullOpenValue

import javax.management.openmbean.CompositeData; //導入依賴的package包/類
@Override
final Object fromNonNullOpenValue(Object openValue)
        throws InvalidObjectException {
    final TabularData table = (TabularData) openValue;
    final Collection<CompositeData> rows = cast(table.values());
    final Map<Object, Object> valueMap =
        sortedMap ? newSortedMap() : newInsertionOrderMap();
    for (CompositeData row : rows) {
        final Object key =
            keyMapping.fromOpenValue(row.get("key"));
        final Object value =
            valueMapping.fromOpenValue(row.get("value"));
        if (valueMap.put(key, value) != null) {
            final String msg =
                "Duplicate entry in TabularData: key=" + key;
            throw new InvalidObjectException(msg);
        }
    }
    return valueMap;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:21,代碼來源:DefaultMXBeanMappingFactory.java

示例13: toCompositeData

import javax.management.openmbean.CompositeData; //導入依賴的package包/類
public static CompositeData toCompositeData(Trigger trigger) {
    try {
        return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
                new Object[] {
                        trigger.getKey().getName(),
                        trigger.getKey().getGroup(),
                        trigger.getJobKey().getName(),
                        trigger.getJobKey().getGroup(),
                        trigger.getDescription(),
                        JobDataMapSupport.toTabularData(trigger
                                .getJobDataMap()),
                        trigger.getCalendarName(),
                        ((OperableTrigger)trigger).getFireInstanceId(),
                        trigger.getMisfireInstruction(),
                        trigger.getPriority(), trigger.getStartTime(),
                        trigger.getEndTime(), trigger.getNextFireTime(),
                        trigger.getPreviousFireTime(),
                        trigger.getFinalFireTime() });
    } catch (OpenDataException e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:23,代碼來源:TriggerSupport.java

示例14: handleNotification

import javax.management.openmbean.CompositeData; //導入依賴的package包/類
@Override
public void handleNotification(Notification notif, Object handback) {
    String type = notif.getType();
    if (MEMORY_THRESHOLD_EXCEEDED.equals(type) ||
        MEMORY_COLLECTION_THRESHOLD_EXCEEDED.equals(type)) {
        MemoryNotificationInfo minfo = MemoryNotificationInfo.
            from((CompositeData) notif.getUserData());

        MemoryUtil.printMemoryNotificationInfo(minfo, type);
        PoolRecord pr = (PoolRecord) result.get(minfo.getPoolName());
        if (pr == null) {
            throw new RuntimeException("Pool " + minfo.getPoolName() +
                " is not selected");
        }
        if (!MEMORY_COLLECTION_THRESHOLD_EXCEEDED.equals(type)) {
            throw new RuntimeException("Pool " + minfo.getPoolName() +
                " got unexpected notification type: " +
                type);
        }
        pr.addNotification(minfo);
        System.out.println("notifying the checker thread to check result");
        signals.release();
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:25,代碼來源:CollectionUsageThreshold.java

示例15: newJobDetail

import javax.management.openmbean.CompositeData; //導入依賴的package包/類
/**
 * @param cData
 * @return JobDetail
 */
public static JobDetail newJobDetail(CompositeData cData) {
	JobDetail jobDetail = new JobDetail();

	int i = 0;
	jobDetail.setName((String) cData.get(ITEM_NAMES[i++]));
	jobDetail.setGroup((String) cData.get(ITEM_NAMES[i++]));
	jobDetail.setDescription((String) cData.get(ITEM_NAMES[i++]));
	try {
		Class c = Class.forName((String) cData.get(ITEM_NAMES[i++]));
		jobDetail.setJobClass(c);
	} catch (ClassNotFoundException cnfe) {
		/**/
	}
	jobDetail.setJobDataMap(JobDataMapSupport
			.newJobDataMap((TabularData) cData.get(ITEM_NAMES[i++])));
	jobDetail.setVolatility((Boolean) cData.get(ITEM_NAMES[i++]));
	jobDetail.setDurability((Boolean) cData.get(ITEM_NAMES[i++]));
	jobDetail.setRequestsRecovery((Boolean) cData.get(ITEM_NAMES[i++]));

	return jobDetail;
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:26,代碼來源:JobDetailSupport.java


注:本文中的javax.management.openmbean.CompositeData類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。