@Override protected void executeReadAttribute(OperationContext context, ModelNode operation) throws OperationFailedException { final String name = operation.require(ModelDescriptionConstants.NAME).asString(); if (PlatformMBeanUtil.JVM_MAJOR_VERSION > 6 && PlatformMBeanConstants.OBJECT_NAME.equals(name)) { context.getResult().set(ManagementFactory.MEMORY_MXBEAN_NAME); } else if (PlatformMBeanConstants.OBJECT_PENDING_FINALIZATION_COUNT.equals(name)) { context.getResult().set(ManagementFactory.getMemoryMXBean().getObjectPendingFinalizationCount()); } else if (PlatformMBeanConstants.HEAP_MEMORY_USAGE.equals(name)) { final ModelNode mu = PlatformMBeanUtil.getDetypedMemoryUsage(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage()); context.getResult().set(mu); } else if (PlatformMBeanConstants.NON_HEAP_MEMORY_USAGE.equals(name)) { final ModelNode mu = PlatformMBeanUtil.getDetypedMemoryUsage(ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage()); context.getResult().set(mu); } else if (PlatformMBeanConstants.VERBOSE.equals(name)) { context.getResult().set(ManagementFactory.getMemoryMXBean().isVerbose()); } else if (PlatformMBeanConstants.MEMORY_METRICS.contains(name) || PlatformMBeanConstants.MEMORY_READ_WRITE_ATTRIBUTES.contains(name)) { // Bug throw PlatformMBeanMessages.MESSAGES.badReadAttributeImpl6(name); } else { // Shouldn't happen; the global handler should reject throw unknownAttribute(operation); } }
@Override protected void executeReadAttribute(OperationContext context, ModelNode operation) throws OperationFailedException { final String name = operation.require(ModelDescriptionConstants.NAME).asString(); if (PlatformMBeanConstants.OBJECT_NAME.getName().equals(name)) { context.getResult().set(ManagementFactory.MEMORY_MXBEAN_NAME); } else if (PlatformMBeanConstants.OBJECT_PENDING_FINALIZATION_COUNT.equals(name)) { context.getResult().set(ManagementFactory.getMemoryMXBean().getObjectPendingFinalizationCount()); } else if (PlatformMBeanConstants.HEAP_MEMORY_USAGE.equals(name)) { final ModelNode mu = PlatformMBeanUtil.getDetypedMemoryUsage(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage()); context.getResult().set(mu); } else if (PlatformMBeanConstants.NON_HEAP_MEMORY_USAGE.equals(name)) { final ModelNode mu = PlatformMBeanUtil.getDetypedMemoryUsage(ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage()); context.getResult().set(mu); } else if (PlatformMBeanConstants.VERBOSE.equals(name)) { context.getResult().set(ManagementFactory.getMemoryMXBean().isVerbose()); } else if (MemoryResourceDefinition.MEMORY_METRICS.contains(name) || MemoryResourceDefinition.MEMORY_READ_WRITE_ATTRIBUTES.contains(name)) { // Bug throw PlatformMBeanLogger.ROOT_LOGGER.badReadAttributeImpl(name); } else { // Shouldn't happen; the global handler should reject throw unknownAttribute(operation); } }
@Override protected void executeReadAttribute(OperationContext context, ModelNode operation) throws OperationFailedException { final String name = operation.require(ModelDescriptionConstants.NAME).asString(); if (PlatformMBeanConstants.OBJECT_NAME.getName().equals(name)) { context.getResult().set(ManagementFactory.MEMORY_MXBEAN_NAME); } else if (PlatformMBeanConstants.OBJECT_PENDING_FINALIZATION_COUNT.equals(name)) { context.getResult().set(ManagementFactory.getMemoryMXBean().getObjectPendingFinalizationCount()); } else if (PlatformMBeanConstants.HEAP_MEMORY_USAGE.equals(name)) { final ModelNode mu = PlatformMBeanUtil.getDetypedMemoryUsage(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage()); context.getResult().set(mu); } else if (PlatformMBeanConstants.NON_HEAP_MEMORY_USAGE.equals(name)) { final ModelNode mu = PlatformMBeanUtil.getDetypedMemoryUsage(ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage()); context.getResult().set(mu); } else if (PlatformMBeanConstants.VERBOSE.equals(name)) { context.getResult().set(ManagementFactory.getMemoryMXBean().isVerbose()); } else if (MemoryResourceDefinition.MEMORY_METRICS.contains(name) || MemoryResourceDefinition.MEMORY_READ_WRITE_ATTRIBUTES.contains(name)) { // Bug throw PlatformMBeanLogger.ROOT_LOGGER.badReadAttributeImpl(name); } else { // Shouldn't happen; the global handler should reject throw unknownAttribute(operation); } }
store.set(memoryPoolMXBean.getType().name()); } else if (PlatformMBeanConstants.USAGE.equals(name)) { final ModelNode usage = PlatformMBeanUtil.getDetypedMemoryUsage(memoryPoolMXBean.getUsage()); store.set(usage); } else if (PlatformMBeanConstants.PEAK_USAGE.equals(name)) { final ModelNode usage = PlatformMBeanUtil.getDetypedMemoryUsage(memoryPoolMXBean.getPeakUsage()); store.set(usage); } else if (PlatformMBeanConstants.VALID.getName().equals(name)) { store.set(memoryPoolMXBean.isCollectionUsageThresholdSupported()); } else if (PlatformMBeanConstants.COLLECTION_USAGE.equals(name)) { final ModelNode usage = PlatformMBeanUtil.getDetypedMemoryUsage(memoryPoolMXBean.getCollectionUsage()); store.set(usage); } else if (MemoryPoolResourceDefinition.MEMORY_POOL_READ_ATTRIBUTES.contains(name)
store.set(memoryPoolMXBean.getType().name()); } else if (PlatformMBeanConstants.USAGE.equals(name)) { final ModelNode usage = PlatformMBeanUtil.getDetypedMemoryUsage(memoryPoolMXBean.getUsage()); store.set(usage); } else if (PlatformMBeanConstants.PEAK_USAGE.equals(name)) { final ModelNode usage = PlatformMBeanUtil.getDetypedMemoryUsage(memoryPoolMXBean.getPeakUsage()); store.set(usage); } else if (PlatformMBeanConstants.VALID.equals(name)) { store.set(memoryPoolMXBean.isCollectionUsageThresholdSupported()); } else if (PlatformMBeanConstants.COLLECTION_USAGE.equals(name)) { final ModelNode usage = PlatformMBeanUtil.getDetypedMemoryUsage(memoryPoolMXBean.getCollectionUsage()); store.set(usage); } else if (PlatformMBeanConstants.MEMORY_POOL_READ_ATTRIBUTES.contains(name)
store.set(memoryPoolMXBean.getType().name()); } else if (PlatformMBeanConstants.USAGE.equals(name)) { final ModelNode usage = PlatformMBeanUtil.getDetypedMemoryUsage(memoryPoolMXBean.getUsage()); store.set(usage); } else if (PlatformMBeanConstants.PEAK_USAGE.equals(name)) { final ModelNode usage = PlatformMBeanUtil.getDetypedMemoryUsage(memoryPoolMXBean.getPeakUsage()); store.set(usage); } else if (PlatformMBeanConstants.VALID.getName().equals(name)) { store.set(memoryPoolMXBean.isCollectionUsageThresholdSupported()); } else if (PlatformMBeanConstants.COLLECTION_USAGE.equals(name)) { final ModelNode usage = PlatformMBeanUtil.getDetypedMemoryUsage(memoryPoolMXBean.getCollectionUsage()); store.set(usage); } else if (MemoryPoolResourceDefinition.MEMORY_POOL_READ_ATTRIBUTES.contains(name)