[jboss-cvs] JBossAS SVN: r77465 - trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Aug 25 19:10:26 EDT 2008
Author: pferraro
Date: 2008-08-25 19:10:26 -0400 (Mon, 25 Aug 2008)
New Revision: 77465
Removed:
trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/ObjectNamePatternLoadMetricSource.java
Log:
Replaced by MBeanQueryLoadMetricSource.
Deleted: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/ObjectNamePatternLoadMetricSource.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/ObjectNamePatternLoadMetricSource.java 2008-08-25 23:10:08 UTC (rev 77464)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/ObjectNamePatternLoadMetricSource.java 2008-08-25 23:10:26 UTC (rev 77465)
@@ -1,96 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, 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.web.tomcat.service.modcluster.load.metric.impl;
-
-import java.lang.management.ManagementFactory;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import javax.management.JMException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.jboss.web.tomcat.service.modcluster.load.metric.LoadMetric;
-import org.jboss.web.tomcat.service.modcluster.load.metric.LoadMetricSource;
-import org.jboss.web.tomcat.service.modcluster.load.metric.LoadMetricSourceRegistration;
-
-/**
- * Abstract {@link LoadMetricSource} that queries the mbean server for beans to be made available to its registered {@link LoadMetric}s.
- *
- * @author Paul Ferraro
- */
-public abstract class ObjectNamePatternLoadMetricSource extends AbstractLoadMetricSource
-{
- private final MBeanServer server;
- private final ObjectName pattern;
-
- private transient Set<ObjectName> objectNames;
-
- protected ObjectNamePatternLoadMetricSource(LoadMetricSourceRegistration registration, String pattern) throws MalformedObjectNameException
- {
- this(registration, pattern, ManagementFactory.getPlatformMBeanServer());
- }
-
- protected ObjectNamePatternLoadMetricSource(LoadMetricSourceRegistration registration, String pattern, MBeanServer server) throws MalformedObjectNameException
- {
- super(registration);
-
- this.pattern = ObjectName.getInstance(pattern);
- this.server = server;
- }
-
- /**
- * @{inheritDoc}
- * @see org.jboss.web.tomcat.service.modcluster.load.metric.impl.AbstractLoadMetricSource#prepare()
- */
- @SuppressWarnings("unchecked")
- @Override
- public void prepare()
- {
- this.objectNames = this.pattern.isPattern() ? this.server.queryNames(this.pattern, null) : Collections.singleton(this.pattern);
- }
-
- /**
- * @{inheritDoc}
- * @see org.jboss.web.tomcat.service.modcluster.load.metric.impl.AbstractLoadMetricSource#cleanup()
- */
- @Override
- public void cleanup()
- {
- this.objectNames = null;
- }
-
- public <T> List<T> getAttributes(String attribute, Class<T> targetClass) throws JMException
- {
- List<T> list = new ArrayList<T>(this.objectNames.size());
-
- for (ObjectName name: this.objectNames)
- {
- list.add(targetClass.cast(this.server.getAttribute(name, attribute)));
- }
-
- return list;
- }
-}
More information about the jboss-cvs-commits
mailing list