Permalink
Browse files
WFLY-5685 Deployment-specific caches do not expose management metrics…
…/operations
- Loading branch information
Showing
with
483 additions
and 4 deletions.
- +52 −0 ...in/java/org/jboss/as/clustering/infinispan/subsystem/CacheComponentRuntimeResourceDefinition.java
- +60 −0 .../extension/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheContainerResource.java
- +4 −0 .../src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheContainerResourceDefinition.java
- +15 −2 ...src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheContainerServiceConfigurator.java
- +64 −0 ...on/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheRuntimeResourceDefinition.java
- +51 −0 ...sion/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheRuntimeResourceProvider.java
- +2 −1 ...sion/src/main/java/org/jboss/as/clustering/infinispan/subsystem/ClusteredCacheMetricExecutor.java
- +2 −1 ...inispan/extension/src/main/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanModel.java
- +46 −0 .../src/main/java/org/jboss/as/clustering/infinispan/subsystem/LockingRuntimeResourceDefinition.java
- +46 −0 ...n/src/main/java/org/jboss/as/clustering/infinispan/subsystem/MemoryRuntimeResourceDefinition.java
- +48 −0 ...java/org/jboss/as/clustering/infinispan/subsystem/PartitionHandlingRuntimeResourceDefinition.java
- +46 −0 .../main/java/org/jboss/as/clustering/infinispan/subsystem/PersistenceRuntimeResourceDefinition.java
- +46 −0 .../main/java/org/jboss/as/clustering/infinispan/subsystem/TransactionRuntimeResourceDefinition.java
- +1 −0 .../src/main/resources/modules/system/layers/base/org/jboss/as/clustering/infinispan/main/module.xml
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * JBoss, Home of Professional Open Source. | ||
| * Copyright 2019, Red Hat, Inc., and individual contributors | ||
| * as indicated by the @author tags. See the copyright.txt file in the | ||
| * distribution for a full listing of individual contributors. | ||
| * | ||
| * This is free software; you can redistribute it and/or modify it | ||
| * under the terms of the GNU Lesser General Public License as | ||
| * published by the Free Software Foundation; either version 2.1 of | ||
| * the License, or (at your option) any later version. | ||
| * | ||
| * This software is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with this software; if not, write to the Free | ||
| * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
| * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
| */ | ||
|
|
||
| package org.jboss.as.clustering.infinispan.subsystem; | ||
|
|
||
| import org.jboss.as.clustering.controller.ChildResourceDefinition; | ||
| import org.jboss.as.controller.PathElement; | ||
| import org.jboss.as.controller.registry.ManagementResourceRegistration; | ||
|
|
||
| /** | ||
| * @author Paul Ferraro | ||
| */ | ||
| public class CacheComponentRuntimeResourceDefinition extends ChildResourceDefinition<ManagementResourceRegistration> { | ||
|
|
||
| static final PathElement WILDCARD_PATH = pathElement(PathElement.WILDCARD_VALUE); | ||
|
|
||
| static final PathElement pathElement(String name) { | ||
| return PathElement.pathElement("component", name); | ||
| } | ||
|
|
||
| CacheComponentRuntimeResourceDefinition(PathElement path) { | ||
| this(path, path); | ||
| } | ||
|
|
||
| CacheComponentRuntimeResourceDefinition(PathElement path, PathElement resolverPath) { | ||
| super(new Parameters(path, InfinispanExtension.SUBSYSTEM_RESOLVER.createChildResolver(resolverPath)).setRuntime()); | ||
| } | ||
|
|
||
| @Override | ||
| public ManagementResourceRegistration register(ManagementResourceRegistration parent) { | ||
| return parent.registerSubModel(this); | ||
| } | ||
| } |
| @@ -0,0 +1,60 @@ | ||
| /* | ||
| * JBoss, Home of Professional Open Source. | ||
| * Copyright 2019, Red Hat, Inc., and individual contributors | ||
| * as indicated by the @author tags. See the copyright.txt file in the | ||
| * distribution for a full listing of individual contributors. | ||
| * | ||
| * This is free software; you can redistribute it and/or modify it | ||
| * under the terms of the GNU Lesser General Public License as | ||
| * published by the Free Software Foundation; either version 2.1 of | ||
| * the License, or (at your option) any later version. | ||
| * | ||
| * This software is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with this software; if not, write to the Free | ||
| * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
| * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
| */ | ||
|
|
||
| package org.jboss.as.clustering.infinispan.subsystem; | ||
|
|
||
| import java.util.Collections; | ||
| import java.util.Map; | ||
|
|
||
| import org.jboss.as.clustering.controller.ChildResourceProvider; | ||
| import org.jboss.as.clustering.controller.ComplexResource; | ||
| import org.jboss.as.controller.registry.Resource; | ||
| import org.wildfly.clustering.Registrar; | ||
| import org.wildfly.clustering.Registration; | ||
|
|
||
| /** | ||
| * @author Paul Ferraro | ||
| */ | ||
| public class CacheContainerResource extends ComplexResource implements Registrar<String> { | ||
|
|
||
| private static final String CHILD_TYPE = CacheRuntimeResourceDefinition.WILDCARD_PATH.getKey(); | ||
|
|
||
| public CacheContainerResource(Resource resource) { | ||
| this(resource, Collections.singletonMap(CHILD_TYPE, new CacheRuntimeResourceProvider())); | ||
| } | ||
|
|
||
| private CacheContainerResource(Resource resource, Map<String, ChildResourceProvider> providers) { | ||
| super(resource, providers, CacheContainerResource::new); | ||
| } | ||
|
|
||
| @Override | ||
| public Registration register(String cache) { | ||
| ChildResourceProvider handler = this.apply(CHILD_TYPE); | ||
| handler.getChildren().add(cache); | ||
| return new Registration() { | ||
| @Override | ||
| public void close() { | ||
| handler.getChildren().remove(cache); | ||
| } | ||
| }; | ||
| } | ||
| } |
| @@ -0,0 +1,64 @@ | ||
| /* | ||
| * JBoss, Home of Professional Open Source. | ||
| * Copyright 2019, Red Hat, Inc., and individual contributors | ||
| * as indicated by the @author tags. See the copyright.txt file in the | ||
| * distribution for a full listing of individual contributors. | ||
| * | ||
| * This is free software; you can redistribute it and/or modify it | ||
| * under the terms of the GNU Lesser General Public License as | ||
| * published by the Free Software Foundation; either version 2.1 of | ||
| * the License, or (at your option) any later version. | ||
| * | ||
| * This software is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with this software; if not, write to the Free | ||
| * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
| * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
| */ | ||
|
|
||
| package org.jboss.as.clustering.infinispan.subsystem; | ||
|
|
||
| import org.jboss.as.clustering.controller.ChildResourceDefinition; | ||
| import org.jboss.as.clustering.controller.MetricHandler; | ||
| import org.jboss.as.controller.ModelVersion; | ||
| import org.jboss.as.controller.PathElement; | ||
| import org.jboss.as.controller.registry.ManagementResourceRegistration; | ||
| import org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder; | ||
|
|
||
| /** | ||
| * @author Paul Ferraro | ||
| */ | ||
| public class CacheRuntimeResourceDefinition extends ChildResourceDefinition<ManagementResourceRegistration> { | ||
|
|
||
| static final PathElement WILDCARD_PATH = PathElement.pathElement("cache"); | ||
|
|
||
| static void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder parent) { | ||
| if (InfinispanModel.VERSION_10_0_0.requiresTransformation(version)) { | ||
| parent.discardChildResource(WILDCARD_PATH); | ||
| } | ||
| } | ||
|
|
||
| CacheRuntimeResourceDefinition() { | ||
| super(new Parameters(WILDCARD_PATH, InfinispanExtension.SUBSYSTEM_RESOLVER.createChildResolver(WILDCARD_PATH)).setRuntime()); | ||
| } | ||
|
|
||
| @Override | ||
| public ManagementResourceRegistration register(ManagementResourceRegistration parent) { | ||
| ManagementResourceRegistration registration = parent.registerSubModel(this); | ||
|
|
||
| new MetricHandler<>(new CacheMetricExecutor(), CacheMetric.class).register(registration); | ||
| new MetricHandler<>(new ClusteredCacheMetricExecutor(), ClusteredCacheMetric.class).register(registration); | ||
|
|
||
| new LockingRuntimeResourceDefinition().register(registration); | ||
| new MemoryRuntimeResourceDefinition().register(registration); | ||
| new PartitionHandlingRuntimeResourceDefinition().register(registration); | ||
| new PersistenceRuntimeResourceDefinition().register(registration); | ||
| new TransactionRuntimeResourceDefinition().register(registration); | ||
|
|
||
| return registration; | ||
| } | ||
| } |
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * JBoss, Home of Professional Open Source. | ||
| * Copyright 2019, Red Hat, Inc., and individual contributors | ||
| * as indicated by the @author tags. See the copyright.txt file in the | ||
| * distribution for a full listing of individual contributors. | ||
| * | ||
| * This is free software; you can redistribute it and/or modify it | ||
| * under the terms of the GNU Lesser General Public License as | ||
| * published by the Free Software Foundation; either version 2.1 of | ||
| * the License, or (at your option) any later version. | ||
| * | ||
| * This software is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with this software; if not, write to the Free | ||
| * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
| * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
| */ | ||
|
|
||
| package org.jboss.as.clustering.infinispan.subsystem; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.Collections; | ||
| import java.util.HashSet; | ||
| import java.util.concurrent.ConcurrentHashMap; | ||
|
|
||
| import org.jboss.as.clustering.controller.ChildResourceProvider; | ||
| import org.jboss.as.clustering.controller.ComplexResource; | ||
| import org.jboss.as.clustering.controller.SimpleChildResourceProvider; | ||
| import org.jboss.as.controller.registry.PlaceholderResource; | ||
| import org.wildfly.common.function.Functions; | ||
|
|
||
| /** | ||
| * @author Paul Ferraro | ||
| */ | ||
| public class CacheRuntimeResourceProvider extends SimpleChildResourceProvider { | ||
|
|
||
| private static final ChildResourceProvider CHILD_PROVIDER = new SimpleChildResourceProvider(Collections.unmodifiableSet(new HashSet<>(Arrays.asList( | ||
| LockingRuntimeResourceDefinition.PATH.getValue(), | ||
| MemoryRuntimeResourceDefinition.PATH.getValue(), | ||
| PersistenceRuntimeResourceDefinition.PATH.getValue(), | ||
| PartitionHandlingRuntimeResourceDefinition.PATH.getValue(), | ||
| TransactionRuntimeResourceDefinition.PATH.getValue())))); | ||
|
|
||
| public CacheRuntimeResourceProvider() { | ||
| super(ConcurrentHashMap.newKeySet(), Functions.constantSupplier(new ComplexResource(PlaceholderResource.INSTANCE, Collections.singletonMap(CacheComponentRuntimeResourceDefinition.WILDCARD_PATH.getKey(), CHILD_PROVIDER)))); | ||
| } | ||
| } |
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * JBoss, Home of Professional Open Source. | ||
| * Copyright 2019, Red Hat, Inc., and individual contributors | ||
| * as indicated by the @author tags. See the copyright.txt file in the | ||
| * distribution for a full listing of individual contributors. | ||
| * | ||
| * This is free software; you can redistribute it and/or modify it | ||
| * under the terms of the GNU Lesser General Public License as | ||
| * published by the Free Software Foundation; either version 2.1 of | ||
| * the License, or (at your option) any later version. | ||
| * | ||
| * This software is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with this software; if not, write to the Free | ||
| * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
| * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
| */ | ||
|
|
||
| package org.jboss.as.clustering.infinispan.subsystem; | ||
|
|
||
| import org.jboss.as.clustering.controller.MetricHandler; | ||
| import org.jboss.as.controller.PathElement; | ||
| import org.jboss.as.controller.registry.ManagementResourceRegistration; | ||
|
|
||
| /** | ||
| * @author Paul Ferraro | ||
| */ | ||
| public class LockingRuntimeResourceDefinition extends CacheComponentRuntimeResourceDefinition { | ||
|
|
||
| static final PathElement PATH = pathElement("locking"); | ||
|
|
||
| LockingRuntimeResourceDefinition() { | ||
| super(PATH); | ||
| } | ||
|
|
||
| @Override | ||
| public ManagementResourceRegistration register(ManagementResourceRegistration parent) { | ||
| ManagementResourceRegistration registration = super.register(parent); | ||
| new MetricHandler<>(new LockingMetricExecutor(), LockingMetric.class).register(registration); | ||
| return registration; | ||
| } | ||
| } |
Oops, something went wrong.