[jboss-cvs] JBossAS SVN: r77038 - in trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric: impl and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 13 17:10:35 EDT 2008
Author: pferraro
Date: 2008-08-13 17:10:35 -0400 (Wed, 13 Aug 2008)
New Revision: 77038
Added:
trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/
trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/AbstractLoadMetric.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/AbstractLoadMetricSource.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/SingleLoadMetricSource.java
Log:
[JBAS-5665] LoadMetricSource API
Added: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/AbstractLoadMetric.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/AbstractLoadMetric.java (rev 0)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/AbstractLoadMetric.java 2008-08-13 21:10:35 UTC (rev 77038)
@@ -0,0 +1,49 @@
+/*
+ * 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 org.jboss.web.tomcat.service.modcluster.load.metric.LoadMetric;
+
+
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+public abstract class AbstractLoadMetric implements LoadMetric
+{
+ private volatile int weight = 0;
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.web.tomcat.service.modcluster.load.metric.LoadMetric#getWeight()
+ */
+ public int getWeight()
+ {
+ return this.weight;
+ }
+
+ public void setWeight(int weight)
+ {
+ this.weight = weight;
+ }
+}
\ No newline at end of file
Added: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/AbstractLoadMetricSource.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/AbstractLoadMetricSource.java (rev 0)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/AbstractLoadMetricSource.java 2008-08-13 21:10:35 UTC (rev 77038)
@@ -0,0 +1,76 @@
+/*
+ * 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.util.Collection;
+import java.util.LinkedList;
+
+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;
+
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+public abstract class AbstractLoadMetricSource implements LoadMetricSource
+{
+ private Collection<LoadMetric> metrics = new LinkedList<LoadMetric>();
+
+ protected AbstractLoadMetricSource(LoadMetricSourceRegistration registration)
+ {
+ registration.add(this);
+ }
+
+ public void add(LoadMetric metric)
+ {
+ this.metrics.add(metric);
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.web.tomcat.service.modcluster.load.metric.LoadMetricSource#getMetrics()
+ */
+ public Collection<? extends LoadMetric> getMetrics()
+ {
+ return this.metrics;
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.web.tomcat.service.modcluster.load.metric.LoadMetricSource#open()
+ */
+ public void open()
+ {
+ // Nothing to open
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.web.tomcat.service.modcluster.load.metric.LoadMetricSource#cleanup()
+ */
+ public void close()
+ {
+ // Nothing to close
+ }
+}
Added: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/SingleLoadMetricSource.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/SingleLoadMetricSource.java (rev 0)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/SingleLoadMetricSource.java 2008-08-13 21:10:35 UTC (rev 77038)
@@ -0,0 +1,69 @@
+/*
+ * 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.util.Collection;
+import java.util.Collections;
+
+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;
+
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+public abstract class SingleLoadMetricSource extends AbstractLoadMetric implements LoadMetricSource
+{
+ protected SingleLoadMetricSource(LoadMetricSourceRegistration registration)
+ {
+ registration.add(this);
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.web.tomcat.service.modcluster.load.metric.LoadMetricSource#open()
+ */
+ public void open()
+ {
+ // Nothing to open
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.web.tomcat.service.modcluster.load.metric.LoadMetricSource#cleanup()
+ */
+ public void close()
+ {
+ // Nothing to close
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.web.tomcat.service.modcluster.load.metric.LoadMetricSource#getMetrics()
+ */
+ public Collection<? extends LoadMetric> getMetrics()
+ {
+ return Collections.singleton(this);
+ }
+}
More information about the jboss-cvs-commits
mailing list