Java Code Examples for javax.management.openmbean.CompositeData

The following are top voted examples for showing how to use javax.management.openmbean.CompositeData. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: apache-tomcat-7.0.73-with-comment   File: SlowQueryReportJmx.java   View source code 7 votes vote down vote up
/**
 * 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;
}
 
Example 2
Project: csap-core   File: TestRawJmx.java   View source code 6 votes vote down vote up
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 );
		} 
	}
 
Example 3
Project: otus_java_2017_06   File: Main.java   View source code 6 votes vote down vote up
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);
    }
}
 
Example 4
Project: monarch   File: OpenTypeConverter.java   View source code 6 votes vote down vote up
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;
}
 
Example 5
Project: openjdk-jdk10   File: MemoryUsageCompositeData.java   View source code 6 votes vote down vote up
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);
    }
}
 
Example 6
Project: openjdk-jdk10   File: GenericArrayTypeTest.java   View source code 6 votes vote down vote up
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);
    }
}
 
Example 7
Project: openjdk-jdk10   File: GarbageCollectionNotifInfoCompositeData.java   View source code 6 votes vote down vote up
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);
    }
}
 
Example 8
Project: jdk8u-jdk   File: LockInfoCompositeData.java   View source code 6 votes vote down vote up
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);
    }
}
 
Example 9
Project: jdk8u-jdk   File: ValidateOpenTypes.java   View source code 6 votes vote down vote up
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);
    }
}
 
Example 10
Project: lams   File: JobDetailSupport.java   View source code 6 votes vote down vote up
/**
 * @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);
    }
}
 
Example 11
Project: lams   File: JobExecutionContextSupport.java   View source code 6 votes vote down vote up
/**
 * @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);
    }
}
 
Example 12
Project: OpenJSharp   File: DefaultMXBeanMappingFactory.java   View source code 6 votes vote down vote up
@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;
}
 
Example 13
Project: lams   File: TriggerSupport.java   View source code 6 votes vote down vote up
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);
    }
}
 
Example 14
Project: jdk8u-jdk   File: CollectionUsageThreshold.java   View source code 6 votes vote down vote up
@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();
    }
}
 
Example 15
Project: asura   File: JobDetailSupport.java   View source code 6 votes vote down vote up
/**
 * @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;
}
 
Example 16
Project: asura   File: JobDetailSupport.java   View source code 6 votes vote down vote up
/**
 * @param jobDetail
 * @return CompositeData
 */
public static CompositeData toCompositeData(JobDetail jobDetail) {
	try {
		return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
				new Object[] {
						jobDetail.getName(),
						jobDetail.getGroup(),
						jobDetail.getDescription(),
						jobDetail.getJobClass().getName(),
						JobDataMapSupport.toTabularData(jobDetail
								.getJobDataMap()), jobDetail.isVolatile(),
						jobDetail.isDurable(),
						jobDetail.requestsRecovery(), });
	} catch (OpenDataException e) {
		throw new RuntimeException(e);
	}
}
 
Example 17
Project: OpenJSharp   File: DefaultMXBeanMappingFactory.java   View source code 6 votes vote down vote up
Object fromCompositeData(CompositeData cd,
                         String[] itemNames,
                         MXBeanMapping[] converters)
        throws InvalidObjectException {
    Object o;
    try {
        final Class<?> targetClass = getTargetClass();
        ReflectUtil.checkPackageAccess(targetClass);
        o = targetClass.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);
                MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
            }
        }
    } catch (Exception e) {
        throw invalidObjectException(e);
    }
    return o;
}
 
Example 18
Project: ChronoBike   File: BaseOpenMBean.java   View source code 6 votes vote down vote up
protected void addOpenAttribute(String csDescription, Class cls, String csMethodName, CompositeType compositeType)
{
	Method methodGet = MethodFinder.getMethod(cls, "get"+csMethodName);
	boolean bCanGet = true;
	if(methodGet == null)
		bCanGet = false;
	Method methodSet = MethodFinder.getMethod(cls, "set"+csMethodName, CompositeData.class);
	boolean bCanSet = true;
	if(methodSet == null)
		bCanSet = false;

	OpenMBeanAttributeInfoSupport attrOpen = new OpenMBeanAttributeInfoSupport(csMethodName, csDescription, compositeType, bCanGet, bCanSet, false); 
	OpenMBeanAttributeInfoWrapper attr = new OpenMBeanAttributeInfoWrapper(csMethodName, csDescription, attrOpen, methodGet, methodSet);
	
	if(m_arrOpenMBeanAttributeInfosWrapper == null)
		m_arrOpenMBeanAttributeInfosWrapper = new ArrayList<OpenMBeanAttributeInfoWrapper>();
	m_arrOpenMBeanAttributeInfosWrapper.add(attr);
}
 
Example 19
Project: jdk8u-jdk   File: StackTraceElementCompositeData.java   View source code 5 votes vote down vote up
/** Validate if the input CompositeData has the expected
 * CompositeType (i.e. contain all attributes with expected
 * names and types).
 */
public static void validateCompositeData(CompositeData cd) {
    if (cd == null) {
        throw new NullPointerException("Null CompositeData");
    }

    if (!isTypeMatched(stackTraceElementCompositeType, cd.getCompositeType())) {
        throw new IllegalArgumentException(
            "Unexpected composite type for StackTraceElement");
    }
}
 
Example 20
Project: jdk8u-jdk   File: GcInfoCompositeData.java   View source code 5 votes vote down vote up
public static Map<String, MemoryUsage>
        getMemoryUsageBeforeGc(CompositeData cd) {
    try {
        TabularData td = (TabularData) cd.get(MEMORY_USAGE_BEFORE_GC);
        return cast(memoryUsageMapType.toJavaTypeData(td));
    } catch (InvalidObjectException | OpenDataException e) {
        // Should never reach here
        throw new AssertionError(e);
    }
}
 
Example 21
Project: OpenJSharp   File: MonitorInfoCompositeData.java   View source code 5 votes vote down vote up
public static StackTraceElement getLockedStackFrame(CompositeData cd) {
    CompositeData ste = (CompositeData) cd.get(LOCKED_STACK_FRAME);
    if (ste != null) {
        return StackTraceElementCompositeData.from(ste);
    } else {
        return null;
    }
}
 
Example 22
Project: openjdk-jdk10   File: MemoryNotifInfoCompositeData.java   View source code 5 votes vote down vote up
public static String getPoolName(CompositeData cd) {
    String poolname = getString(cd, POOL_NAME);
    if (poolname == null) {
        throw new IllegalArgumentException("Invalid composite data: " +
            "Attribute " + POOL_NAME + " has null value");
    }
    return poolname;
}
 
Example 23
Project: openjdk-jdk10   File: MonitorInfoCompositeData.java   View source code 5 votes vote down vote up
public static StackTraceElement getLockedStackFrame(CompositeData cd) {
    CompositeData ste = (CompositeData) cd.get(LOCKED_STACK_FRAME);
    if (ste != null) {
        return StackTraceElementCompositeData.from(ste);
    } else {
        return null;
    }
}
 
Example 24
Project: jdk8u-jdk   File: ValidateOpenTypes.java   View source code 5 votes vote down vote up
private static void printThreadInfo(CompositeData cd) {
    ThreadInfo info = ThreadInfo.from(cd);
    if (info == null) {
        throw new RuntimeException("TEST FAILED: " +
            " Null ThreadInfo");
    }

    System.out.print(info.getThreadName());
    System.out.print(" id=" + info.getThreadId());
    System.out.println(" " + info.getThreadState());

    for (StackTraceElement s : info.getStackTrace()) {
        System.out.println(s);
    }
}
 
Example 25
Project: jdk8u-jdk   File: GarbageCollectionNotifInfoCompositeData.java   View source code 5 votes vote down vote up
public static String getGcAction(CompositeData cd) {
    String gcaction = getString(cd, GC_ACTION);
    if (gcaction == null) {
        throw new IllegalArgumentException("Invalid composite data: " +
            "Attribute " + GC_ACTION + " has null value");
    }
    return gcaction;
}
 
Example 26
Project: openjdk-jdk10   File: GcInfoCompositeData.java   View source code 5 votes vote down vote up
public static Map<String, MemoryUsage>
        getMemoryUsageBeforeGc(CompositeData cd) {
    try {
        TabularData td = (TabularData) cd.get(MEMORY_USAGE_BEFORE_GC);
        return cast(memoryUsageMapType.toJavaTypeData(td));
    } catch (InvalidObjectException | OpenDataException e) {
        // Should never reach here
        throw new AssertionError(e);
    }
}
 
Example 27
Project: jdk8u-jdk   File: MerlinMXBean.java   View source code 5 votes vote down vote up
public CompositeData toCompositeData(CompositeType ct) {
    try {
        return new CompositeDataSupport(ct, new String[] {"whatsit"},
                                        new String[] {"!" + whatsit});
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example 28
Project: ats-framework   File: AtsJvmMonitor.java   View source code 5 votes vote down vote up
private JvmReadingInstance getHeapCodeCache(
                                             MBeanServerConnection connection,
                                             ReadingBean reading ) {

    String jvmPort = reading.getParameter("JMX_PORT");
    final MBeanWrapper mbeanWrapper = mbeanWrappers.get(jvmPort);

    return new JvmReadingInstance(connection,
                                  String.valueOf(reading.getDbId()),
                                  reading.getMonitorName(),
                                  getName(reading, jvmPort),
                                  reading.getUnit(),
                                  0) {
        private static final long serialVersionUID = 1L;

        @Override
        public void init() {

            applyMemoryNormalizationFactor();

            mBeanName = mbeanWrapper.getObjectName("java.lang:name=Code Cache,type=MemoryPool");
        }

        @Override
        public float poll() {

            CompositeData attribute = (CompositeData) mbeanWrapper.getMBeanAttribute(mBeanName,
                                                                                     "Usage");

            return fixLongValue(Long.valueOf( (attribute).get("used").toString()))
                   * normalizationFactor;
        }
    };
}
 
Example 29
Project: OpenJSharp   File: MonitorInfoCompositeData.java   View source code 5 votes vote down vote up
/** Validate if the input CompositeData has the expected
 * CompositeType (i.e. contain all attributes with expected
 * names and types).
 */
public static void validateCompositeData(CompositeData cd) {
    if (cd == null) {
        throw new NullPointerException("Null CompositeData");
    }

    if (!isTypeMatched(monitorInfoCompositeType, cd.getCompositeType())) {
        throw new IllegalArgumentException(
            "Unexpected composite type for MonitorInfo");
    }
}
 
Example 30
Project: lams   File: RemoteMBeanScheduler.java   View source code 5 votes vote down vote up
/**
 * <p>
 * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
 * passing the <code>SchedulingContext</code> associated with this
 * instance.
 * </p>
 */
public JobDetail getJobDetail(JobKey jobKey) throws SchedulerException {
    try {
        return JobDetailSupport.newJobDetail((CompositeData)invoke(
                "getJobDetail",
                new Object[] { jobKey.getName(), jobKey.getGroup() },
                new String[] { String.class.getName(), String.class.getName() }));
    } catch (ClassNotFoundException e) {
        throw new SchedulerException("Unable to resolve job class", e);
    }
}
 
Example 31
Project: jdk8u-jdk   File: GcInfoCompositeData.java   View source code 5 votes vote down vote up
/**
 * Returns true if the input CompositeData has the expected
 * CompositeType (i.e. contain all attributes with expected
 * names and types).  Otherwise, return false.
 */
public static void validateCompositeData(CompositeData cd) {
    if (cd == null) {
        throw new NullPointerException("Null CompositeData");
    }

    if (!isTypeMatched(getBaseGcInfoCompositeType(),
                       cd.getCompositeType())) {
       throw new IllegalArgumentException(
            "Unexpected composite type for GcInfo");
    }
}
 
Example 32
Project: jdk8u-jdk   File: DefaultMXBeanMappingFactory.java   View source code 5 votes vote down vote up
@Override
final Object fromNonNullOpenValue(Object value)
        throws InvalidObjectException {
    makeCompositeBuilder();
    return compositeBuilder.fromCompositeData((CompositeData) value,
                                              itemNames,
                                              getterMappings);
}
 
Example 33
Project: openjdk-jdk10   File: LockInfoCompositeData.java   View source code 5 votes vote down vote up
public static CompositeData toCompositeData(LockInfo li) {
    if (li == null) {
        return null;
    }

    LockInfoCompositeData licd = new LockInfoCompositeData(li);
    return licd.getCompositeData();
}
 
Example 34
Project: lams   File: JobDetailSupport.java   View source code 5 votes vote down vote up
public static TabularData toTabularData(JobDetail[] jobDetails) {
    TabularData tData = new TabularDataSupport(TABULAR_TYPE);
    if (jobDetails != null) {
        ArrayList<CompositeData> list = new ArrayList<CompositeData>();
        for (JobDetail jobDetail : jobDetails) {
            list.add(toCompositeData(jobDetail));
        }
        tData.putAll(list.toArray(new CompositeData[list.size()]));
    }
    return tData;
}
 
Example 35
Project: jdk8u-jdk   File: LockInfoCompositeData.java   View source code 5 votes vote down vote up
public static CompositeData toCompositeData(LockInfo li) {
    if (li == null) {
        return null;
    }

    LockInfoCompositeData licd = new LockInfoCompositeData(li);
    return licd.getCompositeData();
}
 
Example 36
Project: lams   File: CronTriggerSupport.java   View source code 5 votes vote down vote up
public static TabularData toTabularData(List<? extends CronTrigger> triggers) {
    TabularData tData = new TabularDataSupport(TABULAR_TYPE);
    if (triggers != null) {
        ArrayList<CompositeData> list = new ArrayList<CompositeData>();
        for (CronTrigger trigger : triggers) {
            list.add(toCompositeData(trigger));
        }
        tData.putAll(list.toArray(new CompositeData[list.size()]));
    }
    return tData;
}
 
Example 37
Project: OpenJSharp   File: MemoryUsageCompositeData.java   View source code 5 votes vote down vote up
/** Validate if the input CompositeData has the expected
 * CompositeType (i.e. contain all attributes with expected
 * names and types).
 */
public static void validateCompositeData(CompositeData cd) {
    if (cd == null) {
        throw new NullPointerException("Null CompositeData");
    }

    if (!isTypeMatched(memoryUsageCompositeType, cd.getCompositeType())) {
        throw new IllegalArgumentException(
            "Unexpected composite type for MemoryUsage");
    }
}
 
Example 38
Project: openjdk-jdk10   File: ThreadInfoCompositeData.java   View source code 5 votes vote down vote up
public static boolean isCurrentVersion(CompositeData cd) {
    if (cd == null) {
        throw new NullPointerException("Null CompositeData");
    }

    return isTypeMatched(threadInfoCompositeType, cd.getCompositeType());
}
 
Example 39
Project: lams   File: SimpleTriggerSupport.java   View source code 5 votes vote down vote up
public static TabularData toTabularData(List<? extends SimpleTrigger> triggers) {
    TabularData tData = new TabularDataSupport(TABULAR_TYPE);
    if (triggers != null) {
        ArrayList<CompositeData> list = new ArrayList<CompositeData>();
        for (SimpleTrigger trigger : triggers) {
            list.add(toCompositeData(trigger));
        }
        tData.putAll(list.toArray(new CompositeData[list.size()]));
    }
    return tData;
}
 
Example 40
Project: lams   File: SimpleTriggerSupport.java   View source code 5 votes vote down vote up
public static OperableTrigger newTrigger(CompositeData cData) throws ParseException {
    SimpleTriggerImpl result = new SimpleTriggerImpl();
    result.setRepeatCount(((Integer) cData.get("repeatCount")).intValue());
    result.setRepeatInterval(((Long) cData.get("repeatInterval")).longValue());
    result.setTimesTriggered(((Integer) cData.get("timesTriggered")).intValue());
    TriggerSupport.initializeTrigger(result, cData);
    return result;
}