private CompilationResourceDefinition() {
   super(
       new Parameters(
               PlatformMBeanConstants.COMPILATION_PATH,
               PlatformMBeanUtil.getResolver(PlatformMBeanConstants.COMPILATION))
           .setRuntime());
 }
  @Override
  public void execute(OperationContext context, ModelNode operation)
      throws OperationFailedException {

    validator.validate(operation);
    ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
    try {
      long id = operation.require(PlatformMBeanConstants.ID).asLong();
      ThreadInfo info = null;
      if (operation.hasDefined(PlatformMBeanConstants.MAX_DEPTH)) {
        info = mbean.getThreadInfo(id, operation.require(PlatformMBeanConstants.MAX_DEPTH).asInt());
      } else {
        info = mbean.getThreadInfo(id);
      }

      final ModelNode result = context.getResult();
      if (info != null) {
        result.set(PlatformMBeanUtil.getDetypedThreadInfo(info, mbean.isThreadCpuTimeSupported()));
      }
    } catch (SecurityException e) {
      throw new OperationFailedException(new ModelNode().set(e.toString()));
    }

    context.completeStep();
  }
/**
 * Executes the {@link java.lang.management.ThreadMXBean#findDeadlockedThreads()} method.
 *
 * @author Brian Stansberry (c) 2011 Red Hat Inc.
 */
public class ThreadMXBeanFindDeadlockedThreadsHandler implements OperationStepHandler {

  static final OperationDefinition DEFINITION =
      new SimpleOperationDefinitionBuilder(
              PlatformMBeanConstants.FIND_DEADLOCKED_THREADS,
              PlatformMBeanUtil.getResolver(PlatformMBeanConstants.THREADING))
          .setReplyType(ModelType.LIST)
          .setReplyValueType(ModelType.LONG)
          .setRuntimeOnly()
          .setReadOnly()
          .allowReturnNull()
          .build();

  public static final ThreadMXBeanFindDeadlockedThreadsHandler INSTANCE =
      new ThreadMXBeanFindDeadlockedThreadsHandler();

  private ThreadMXBeanFindDeadlockedThreadsHandler() {}

  @Override
  public void execute(OperationContext context, ModelNode operation)
      throws OperationFailedException {

    try {
      long[] ids = ManagementFactory.getThreadMXBean().findDeadlockedThreads();
      final ModelNode result = context.getResult();
      if (ids != null) {
        result.setEmptyList();
        for (long id : ids) {
          result.add(id);
        }
      }
    } catch (SecurityException e) {
      throw new OperationFailedException(new ModelNode().set(e.toString()));
    }

    context.stepCompleted();
  }
}
 private ClassLoadingResourceDefinition() {
   super(
       PlatformMBeanConstants.CLASS_LOADING_PATH,
       PlatformMBeanUtil.getResolver(PlatformMBeanConstants.CLASS_LOADING));
 }