Examples of ThreadMXBean


Examples of java.lang.management.ThreadMXBean

    @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()));
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.