@Override public ModelNode execute(OperationContext context, Metric<JChannel> metric) throws OperationFailedException { String channelName = context.getCurrentAddressValue(); ServiceName serviceName = JGroupsRequirement.CHANNEL.getServiceName(context, channelName); JChannel channel = new PassiveServiceSupplier<JChannel>(context.getServiceRegistry(true), serviceName).get(); return (channel != null) ? metric.execute(channel) : null; } }
@Override public void register(ManagementResourceRegistration registration) { for (Metric<C> metric : this.metrics) { registration.registerReadOnlyAttribute(metric.getDefinition(), this); } }
public MetricHandler(MetricExecutor<C> executor, Collection<? extends Metric<C>> metrics) { this.executor = executor; for (Metric<C> executable : metrics) { this.executables.put(executable.getName(), executable); } this.metrics = metrics; }
@Override public ModelNode execute(OperationContext context, Metric<EmbeddedCacheManager> metric) throws OperationFailedException { String containerName = context.getCurrentAddressValue(); CacheContainer container = new PassiveServiceSupplier<CacheContainer>(context.getServiceRegistry(true), InfinispanRequirement.CONTAINER.getServiceName(context, containerName)).get(); return (container != null) ? metric.execute(container) : null; } }
default String getName() { return this.getDefinition().getName(); } }
public MetricHandler(MetricExecutor<C> executor, Collection<? extends Metric<C>> metrics) { this.executor = executor; for (Metric<C> executable : metrics) { this.executables.put(executable.getName(), executable); } this.metrics = metrics; }
@Override public ModelNode execute(OperationContext context, Metric<Cache<?, ?>> metric) throws OperationFailedException { PathAddress address = context.getCurrentAddress(); String containerName = address.getParent().getLastElement().getValue(); String cacheName = address.getLastElement().getValue(); Cache<?, ?> cache = new PassiveServiceSupplier<Cache<?, ?>>(context.getServiceRegistry(true), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName)).get(); return (cache != null) ? metric.execute(cache) : null; } }
@Override public void register(ManagementResourceRegistration registration) { for (Metric<C> metric : this.metrics) { registration.registerReadOnlyAttribute(metric.getDefinition(), this); } }
@Override public ModelNode execute(OperationContext context, Metric<Cache<?, ?>> metric) throws OperationFailedException { PathAddress cacheAddress = context.getCurrentAddress().getParent(); String containerName = cacheAddress.getParent().getLastElement().getValue(); String cacheName = cacheAddress.getLastElement().getValue(); Cache<?, ?> cache = new PassiveServiceSupplier<Cache<?, ?>>(context.getServiceRegistry(true), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName)).get(); return (cache != null) ? metric.execute(cache) : null; } }
default String getName() { return this.getDefinition().getName(); } }
@Override public ModelNode execute(OperationContext context, Metric<AdvancedCache<?, ?>> metric) throws OperationFailedException { PathAddress cacheAddress = context.getCurrentAddress().getParent(); String containerName = cacheAddress.getParent().getLastElement().getValue(); String cacheName = cacheAddress.getLastElement().getValue(); Cache<?, ?> cache = new PassiveServiceSupplier<Cache<?, ?>>(context.getServiceRegistry(true), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName)).get(); return (cache != null) ? metric.execute(cache.getAdvancedCache()) : null; } }
@Override public ModelNode execute(OperationContext context, Metric<RpcManagerImpl> metric) throws OperationFailedException { PathAddress address = context.getCurrentAddress(); String containerName = address.getParent().getLastElement().getValue(); String cacheName = address.getLastElement().getValue(); Cache<?, ?> cache = new PassiveServiceSupplier<Cache<?, ?>>(context.getServiceRegistry(true), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName)).get(); return (cache != null) ? metric.execute((RpcManagerImpl) cache.getAdvancedCache().getRpcManager()) : null; } }
@Override public ModelNode execute(OperationContext context, Metric<DefaultLockManager> metric) throws OperationFailedException { PathAddress cacheAddress = context.getCurrentAddress().getParent(); String containerName = cacheAddress.getParent().getLastElement().getValue(); String cacheName = cacheAddress.getLastElement().getValue(); Cache<?, ?> cache = new PassiveServiceSupplier<Cache<?, ?>>(context.getServiceRegistry(true), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName)).get(); return (cache != null) ? metric.execute((DefaultLockManager) cache.getAdvancedCache().getLockManager()) : null; } }
@Override public ModelNode execute(OperationContext context, Metric<CacheLoaderInterceptor<?, ?>> metric) throws OperationFailedException { PathAddress cacheAddress = context.getCurrentAddress().getParent(); String containerName = cacheAddress.getParent().getLastElement().getValue(); String cacheName = cacheAddress.getLastElement().getValue(); Cache<?, ?> cache = new PassiveServiceSupplier<Cache<?, ?>>(context.getServiceRegistry(true), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName)).get(); if (cache != null) { CacheLoaderInterceptor<?, ?> interceptor = CacheMetric.findInterceptor(cache, CacheLoaderInterceptor.class); if (interceptor != null) { return metric.execute(interceptor); } } return null; } }
@Override public ModelNode execute(OperationContext context, Metric<TxInterceptor<?, ?>> metric) throws OperationFailedException { PathAddress cacheAddress = context.getCurrentAddress().getParent(); String containerName = cacheAddress.getParent().getLastElement().getValue(); String cacheName = cacheAddress.getLastElement().getValue(); Cache<?, ?> cache = new PassiveServiceSupplier<Cache<?, ?>>(context.getServiceRegistry(true), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName)).get(); if (cache != null) { TxInterceptor<?, ?> interceptor = CacheMetric.findInterceptor(cache, TxInterceptor.class); if (interceptor != null) { return metric.execute(interceptor); } } return null; } }
@Override public ModelNode execute(OperationContext context, Metric<JChannel> metric) throws OperationFailedException { String channelName = context.getCurrentAddressValue(); ServiceName serviceName = JGroupsRequirement.CHANNEL.getServiceName(context, channelName); JChannel channel = new PassiveServiceSupplier<JChannel>(context.getServiceRegistry(true), serviceName).get(); return (channel != null) ? metric.execute(channel) : null; } }
@Override public ModelNode execute(OperationContext context, Metric<EmbeddedCacheManager> metric) throws OperationFailedException { String containerName = context.getCurrentAddressValue(); CacheContainer container = new PassiveServiceSupplier<CacheContainer>(context.getServiceRegistry(true), InfinispanRequirement.CONTAINER.getServiceName(context, containerName)).get(); return (container != null) ? metric.execute(container) : null; } }
@Override public ModelNode execute(OperationContext context, Metric<Cache<?, ?>> metric) throws OperationFailedException { PathAddress address = context.getCurrentAddress(); String containerName = address.getParent().getLastElement().getValue(); String cacheName = address.getLastElement().getValue(); Cache<?, ?> cache = new PassiveServiceSupplier<Cache<?, ?>>(context.getServiceRegistry(true), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName)).get(); return (cache != null) ? metric.execute(cache) : null; } }
@Override public ModelNode execute(OperationContext context, Metric<Cache<?, ?>> metric) throws OperationFailedException { PathAddress cacheAddress = context.getCurrentAddress().getParent(); String containerName = cacheAddress.getParent().getLastElement().getValue(); String cacheName = cacheAddress.getLastElement().getValue(); Cache<?, ?> cache = new PassiveServiceSupplier<Cache<?, ?>>(context.getServiceRegistry(true), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName)).get(); return (cache != null) ? metric.execute(cache) : null; } }
@Override public ModelNode execute(OperationContext context, Metric<RpcManagerImpl> metric) throws OperationFailedException { PathAddress address = context.getCurrentAddress(); String containerName = address.getParent().getLastElement().getValue(); String cacheName = address.getLastElement().getValue(); Cache<?, ?> cache = new PassiveServiceSupplier<Cache<?, ?>>(context.getServiceRegistry(true), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName)).get(); return (cache != null) ? metric.execute((RpcManagerImpl) cache.getAdvancedCache().getRpcManager()) : null; } }