コード例 #1
0
 private CompilationResourceDefinition() {
   super(
       new Parameters(
               PlatformMBeanConstants.COMPILATION_PATH,
               PlatformMBeanUtil.getResolver(PlatformMBeanConstants.COMPILATION))
           .setRuntime());
 }
コード例 #2
0
/**
 * 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();
  }
}
コード例 #3
0
 private ClassLoadingResourceDefinition() {
   super(
       PlatformMBeanConstants.CLASS_LOADING_PATH,
       PlatformMBeanUtil.getResolver(PlatformMBeanConstants.CLASS_LOADING));
 }