[jbossws-commits] JBossWS SVN: r3650 - in branches/jbossws-2.0: integration/native/src/main/resources/jbossws-native42.sar/jbossws.beans/META-INF and 4 other directories.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Wed Jun 20 06:27:58 EDT 2007
Author: thomas.diesler at jboss.com
Date: 2007-06-20 06:27:57 -0400 (Wed, 20 Jun 2007)
New Revision: 3650
Added:
branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/ManagedEndpoint.java
branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/ManagedEndpointMBean.java
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/EndpointMetricsDeployer.java
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/management/BasicEndpointMetrics.java
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/management/EndpointMetrics.java
Modified:
branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/ManagedEndpointRegistry.java
branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native42.sar/jbossws.beans/META-INF/jboss-beans.xml
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicLifecycleHandler.java
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/server/ContextServlet.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java
Log:
[JBWS-1640] Resurect endpoint metrics
Added: branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/ManagedEndpoint.java
===================================================================
--- branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/ManagedEndpoint.java (rev 0)
+++ branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/ManagedEndpoint.java 2007-06-20 10:27:57 UTC (rev 3650)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.wsf.stack.jbws;
+
+// $Id: ManagedEndpointRegistry.java 3146 2007-05-18 22:55:26Z thomas.diesler at jboss.com $
+
+import java.util.Date;
+
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.management.EndpointMetrics;
+
+/**
+ * The endpoint MBean representation
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 20-Jun-2007
+ */
+public class ManagedEndpoint implements ManagedEndpointMBean
+{
+ private Endpoint endpoint;
+
+ public ManagedEndpoint(Endpoint endpoint)
+ {
+ this.endpoint = endpoint;
+ }
+
+ public long getAverageProcessingTime()
+ {
+ EndpointMetrics metrics = endpoint.getEndpointMetrics();
+ return metrics != null ? metrics.getAverageProcessingTime() : 0;
+ }
+
+ public long getFaultCount()
+ {
+ EndpointMetrics metrics = endpoint.getEndpointMetrics();
+ return metrics != null ? metrics.getFaultCount() : 0;
+ }
+
+ public long getMaxProcessingTime()
+ {
+ EndpointMetrics metrics = endpoint.getEndpointMetrics();
+ return metrics != null ? metrics.getMaxProcessingTime() : 0;
+ }
+
+ public long getMinProcessingTime()
+ {
+ EndpointMetrics metrics = endpoint.getEndpointMetrics();
+ return metrics != null ? metrics.getMinProcessingTime() : 0;
+ }
+
+ public long getRequestCount()
+ {
+ EndpointMetrics metrics = endpoint.getEndpointMetrics();
+ return metrics != null ? metrics.getRequestCount() : 0;
+ }
+
+ public long getResponseCount()
+ {
+ EndpointMetrics metrics = endpoint.getEndpointMetrics();
+ return metrics != null ? metrics.getResponseCount() : 0;
+ }
+
+ public Date getStartTime()
+ {
+ EndpointMetrics metrics = endpoint.getEndpointMetrics();
+ return metrics != null ? metrics.getStartTime() : null;
+ }
+
+ public Date getStopTime()
+ {
+ EndpointMetrics metrics = endpoint.getEndpointMetrics();
+ return metrics != null ? metrics.getStopTime() : null;
+ }
+
+ public long getTotalProcessingTime()
+ {
+ EndpointMetrics metrics = endpoint.getEndpointMetrics();
+ return metrics != null ? metrics.getTotalProcessingTime() : 0;
+ }
+
+ public void start()
+ {
+ endpoint.getLifecycleHandler().start(endpoint);
+ }
+
+ public void stop()
+ {
+ endpoint.getLifecycleHandler().stop(endpoint);
+ }
+}
Added: branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/ManagedEndpointMBean.java
===================================================================
--- branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/ManagedEndpointMBean.java (rev 0)
+++ branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/ManagedEndpointMBean.java 2007-06-20 10:27:57 UTC (rev 3650)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.wsf.stack.jbws;
+
+import java.util.Date;
+
+/**
+ * MBean interface.
+ * @since 15-April-2004
+ */
+public interface ManagedEndpointMBean
+{
+ void start();
+
+ void stop();
+
+ Date getStartTime();
+
+ Date getStopTime();
+
+ long getMinProcessingTime();
+
+ long getMaxProcessingTime();
+
+ long getAverageProcessingTime();
+
+ long getTotalProcessingTime();
+
+ long getRequestCount();
+
+ long getFaultCount();
+
+ long getResponseCount();
+}
Modified: branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/ManagedEndpointRegistry.java
===================================================================
--- branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/ManagedEndpointRegistry.java 2007-06-20 10:26:35 UTC (rev 3649)
+++ branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/ManagedEndpointRegistry.java 2007-06-20 10:27:57 UTC (rev 3650)
@@ -25,8 +25,12 @@
import java.util.ArrayList;
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.JMException;
+import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
+import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;
import org.jboss.logging.Logger;
@@ -94,6 +98,44 @@
return endpoint;
}
+ @Override
+ public void register(Endpoint endpoint)
+ {
+ super.register(endpoint);
+
+ MBeanServer server = getMBeanServer();
+ if (server != null)
+ {
+ try
+ {
+ ManagedEndpoint jmxEndpoint = new ManagedEndpoint(endpoint);
+ server.registerMBean(jmxEndpoint, endpoint.getName());
+ }
+ catch (JMException ex)
+ {
+ log.error("Cannot register endpoint with JMX server", ex);
+ }
+ }
+ }
+
+ @Override
+ public void unregister(Endpoint endpoint)
+ {
+ super.unregister(endpoint);
+ MBeanServer server = getMBeanServer();
+ if (server != null)
+ {
+ try
+ {
+ server.unregisterMBean(endpoint.getName());
+ }
+ catch (JMException ex)
+ {
+ log.error("Cannot unregister endpoint with JMX server", ex);
+ }
+ }
+ }
+
public void create() throws Exception
{
log.info(getImplementationTitle());
Modified: branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
===================================================================
--- branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2007-06-20 10:26:35 UTC (rev 3649)
+++ branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2007-06-20 10:27:57 UTC (rev 3650)
@@ -85,6 +85,7 @@
import org.jboss.wsf.spi.deployment.Endpoint.EndpointState;
import org.jboss.wsf.spi.invocation.InvocationContext;
import org.jboss.wsf.spi.invocation.RequestHandler;
+import org.jboss.wsf.spi.management.EndpointMetrics;
import org.jboss.wsf.spi.management.ServerConfig;
import org.jboss.wsf.spi.management.ServerConfigFactory;
import org.jboss.wsf.spi.utils.DOMWriter;
@@ -439,15 +440,27 @@
private long initRequestMetrics(Endpoint endpoint)
{
- return 0;
+ long beginTime = 0;
+
+ EndpointMetrics metrics = endpoint.getEndpointMetrics();
+ if (metrics != null)
+ beginTime = metrics.processRequestMessage();
+
+ return beginTime;
}
- private void processResponseMetrics(Endpoint endpoint, long beginProcessing)
+ private void processResponseMetrics(Endpoint endpoint, long beginTime)
{
+ EndpointMetrics metrics = endpoint.getEndpointMetrics();
+ if (metrics != null)
+ metrics.processResponseMessage(beginTime);
}
- private void processFaultMetrics(Endpoint endpoint, long beginProcessing)
+ private void processFaultMetrics(Endpoint endpoint, long beginTime)
{
+ EndpointMetrics metrics = endpoint.getEndpointMetrics();
+ if (metrics != null)
+ metrics.processFaultMessage(beginTime);
}
/** Set response mime headers
Modified: branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native42.sar/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
--- branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native42.sar/jbossws.beans/META-INF/jboss-beans.xml 2007-06-20 10:26:35 UTC (rev 3649)
+++ branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native42.sar/jbossws.beans/META-INF/jboss-beans.xml 2007-06-20 10:27:57 UTC (rev 3650)
@@ -113,6 +113,7 @@
<inject bean="WSServiceEndpointInvokerDeployer"/>
<inject bean="WSEagerInitializeDeployer"/>
<inject bean="WSEventingDeployer"/>
+ <inject bean="WSEndpointMetricsDeployer"/>
<inject bean="WSEndpointRegistryDeployer"/>
<inject bean="WSEndpointLifecycleDeployer"/>
</list>
@@ -139,6 +140,9 @@
</property>
</bean>
<bean name="WSEndpointLifecycleDeployer" class="org.jboss.wsf.spi.deployment.EndpointLifecycleDeployer"/>
+ <bean name="WSEndpointMetricsDeployer" class="org.jboss.wsf.spi.deployment.EndpointMetricsDeployer">
+ <property name="endpointMetrics"><inject bean="WSEndpointMetrics"/></property>
+ </bean>
<bean name="WSEndpointNameDeployer" class="org.jboss.wsf.spi.deployment.EndpointNameDeployer"/>
<bean name="WSEndpointRegistryDeployer" class="org.jboss.wsf.spi.deployment.EndpointRegistryDeployer"/>
<bean name="WSEventingDeployer" class="org.jboss.wsf.stack.jbws.EventingDeployer"/>
@@ -169,6 +173,7 @@
<property name="applicationMetaDataAdapterEJB3"><inject bean="WSApplicationMetaDataAdapterEJB3"/></property>
<property name="webMetaDataAdapter"><inject bean="WSWebMetaDataAdapter"/></property>
</bean>
+ <bean name="WSEndpointMetrics" class="org.jboss.wsf.spi.management.BasicEndpointMetrics"/>
<bean name="WSSecurityHandlerEJB21" class="org.jboss.wsf.container.jboss42.SecurityHandlerEJB21"/>
<bean name="WSSecurityHandlerEJB3" class="org.jboss.wsf.container.jboss42.SecurityHandlerEJB3"/>
<bean name="WSWebAppDesciptorModifier" class="org.jboss.wsf.stack.jbws.WebAppDesciptorModifierImpl">
Modified: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java 2007-06-20 10:26:35 UTC (rev 3649)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java 2007-06-20 10:27:57 UTC (rev 3650)
@@ -29,6 +29,7 @@
import org.jboss.wsf.spi.invocation.InvocationHandler;
import org.jboss.wsf.spi.invocation.RequestHandler;
+import org.jboss.wsf.spi.management.EndpointMetrics;
/**
* A general JAXWS endpoint.
@@ -49,6 +50,7 @@
private LifecycleHandler lifecycleHandler;
private Map<Class, Object> attachments = new HashMap<Class, Object>();
private Map<String, Object> properties = new HashMap<String, Object>();
+ private EndpointMetrics metrics;
public BasicEndpoint()
{
@@ -199,4 +201,16 @@
{
properties.put(key, value);
}
+
+ public EndpointMetrics getEndpointMetrics()
+ {
+ return metrics;
+ }
+
+ public void setEndpointMetrics(EndpointMetrics metrics)
+ {
+ metrics.setEndpoint(this);
+ this.metrics = metrics;
+
+ }
}
Modified: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicLifecycleHandler.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicLifecycleHandler.java 2007-06-20 10:26:35 UTC (rev 3649)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicLifecycleHandler.java 2007-06-20 10:27:57 UTC (rev 3650)
@@ -55,6 +55,9 @@
throw new IllegalStateException("Cannot start endpoint in state: " + state);
ep.getInvocationHandler().start(ep);
+
+ if (ep.getEndpointMetrics() != null)
+ ep.getEndpointMetrics().start();
ep.setState(EndpointState.STARTED);
}
@@ -68,6 +71,9 @@
throw new IllegalStateException("Cannot stop endpoint in state: " + state);
ep.getInvocationHandler().stop(ep);
+
+ if (ep.getEndpointMetrics() != null)
+ ep.getEndpointMetrics().stop();
ep.setState(EndpointState.STOPED);
}
Modified: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java 2007-06-20 10:26:35 UTC (rev 3649)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java 2007-06-20 10:27:57 UTC (rev 3650)
@@ -29,6 +29,7 @@
import org.jboss.wsf.spi.invocation.InvocationHandler;
import org.jboss.wsf.spi.invocation.RequestHandler;
+import org.jboss.wsf.spi.management.EndpointMetrics;
/**
* A general JAXWS endpoint.
@@ -105,7 +106,13 @@
/** Set the endpoint bean invoker */
void setInvocationHandler(InvocationHandler invoker);
+
+ /** Get the endpoint metrics for this endpoint */
+ EndpointMetrics getEndpointMetrics();
+ /** Set the endpoint metrics for this endpoint */
+ void setEndpointMetrics(EndpointMetrics metrics);
+
/** Add arbitrary attachments */
<T> T addAttachment(Class<T> key, Object value);
Added: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/EndpointMetricsDeployer.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/EndpointMetricsDeployer.java (rev 0)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/EndpointMetricsDeployer.java 2007-06-20 10:27:57 UTC (rev 3650)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.wsf.spi.deployment;
+
+//$Id: EndpointNameDeployer.java 3146 2007-05-18 22:55:26Z thomas.diesler at jboss.com $
+
+import org.jboss.wsf.spi.management.EndpointMetrics;
+
+/**
+ * A deployer that assigns the metrics to the Endpoint
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 20-Jun-2007
+ */
+public class EndpointMetricsDeployer extends AbstractDeployer
+{
+ private EndpointMetrics metrics;
+
+ public void setEndpointMetrics(EndpointMetrics metrics)
+ {
+ this.metrics = metrics;
+ }
+
+ @Override
+ public void create(Deployment dep)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ep.setEndpointMetrics(metrics);
+ }
+ }
+}
\ No newline at end of file
Added: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/management/BasicEndpointMetrics.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/management/BasicEndpointMetrics.java (rev 0)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/management/BasicEndpointMetrics.java 2007-06-20 10:27:57 UTC (rev 3650)
@@ -0,0 +1,171 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.wsf.spi.management;
+
+// $Id: ServiceEndpointMetrics.java 2253 2007-02-02 14:21:44Z heiko.braun at jboss.com $
+
+import java.util.Date;
+
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+/**
+ * Service Endpoint Metrics
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 14-Dec-2005
+ */
+public class BasicEndpointMetrics implements EndpointMetrics
+{
+ private Endpoint endpoint;
+
+ private Date startTime;
+ private Date stopTime;
+ private long requestCount;
+ private long responseCount;
+ private long faultCount;
+ private long maxProcessingTime;
+ private long minProcessingTime;
+ private long avgProcessingTime;
+ private long totalProcessingTime;
+
+ public Endpoint getEndpoint()
+ {
+ return endpoint;
+ }
+
+ public void setEndpoint(Endpoint endpoint)
+ {
+ this.endpoint = endpoint;
+ }
+
+ public void start()
+ {
+ startTime = new Date();
+ stopTime = null;
+ requestCount = 0;
+ responseCount = 0;
+ faultCount = 0;
+ maxProcessingTime = 0;
+ minProcessingTime = 0;
+ avgProcessingTime = 0;
+ totalProcessingTime = 0;
+ }
+
+ public void stop()
+ {
+ stopTime = new Date();
+ }
+
+ public long processRequestMessage()
+ {
+ requestCount++;
+ return System.currentTimeMillis();
+ }
+
+ public void processResponseMessage(long beginTime)
+ {
+ responseCount++;
+ processAnyMessage(beginTime);
+ }
+
+ public void processFaultMessage(long beginTime)
+ {
+ faultCount++;
+ processAnyMessage(beginTime);
+ }
+
+ private void processAnyMessage(long beginTime)
+ {
+ if (beginTime > 0)
+ {
+ long procTime = System.currentTimeMillis() - beginTime;
+
+ if (minProcessingTime == 0)
+ minProcessingTime = procTime;
+
+ maxProcessingTime = Math.max(maxProcessingTime, procTime);
+ minProcessingTime = Math.min(minProcessingTime, procTime);
+ totalProcessingTime = totalProcessingTime + procTime;
+ avgProcessingTime = totalProcessingTime / (responseCount + faultCount);
+ }
+ }
+
+ public Date getStartTime()
+ {
+ return startTime;
+ }
+
+ public Date getStopTime()
+ {
+ return stopTime;
+ }
+
+ public long getMinProcessingTime()
+ {
+ return minProcessingTime;
+ }
+
+ public long getMaxProcessingTime()
+ {
+ return maxProcessingTime;
+ }
+
+ public long getAverageProcessingTime()
+ {
+ return avgProcessingTime;
+ }
+
+ public long getTotalProcessingTime()
+ {
+ return totalProcessingTime;
+ }
+
+ public long getRequestCount()
+ {
+ return requestCount;
+ }
+
+ public long getFaultCount()
+ {
+ return faultCount;
+ }
+
+ public long getResponseCount()
+ {
+ return responseCount;
+ }
+
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder("\nEndpoint Metrics: " + endpoint.getName());
+ buffer.append("\n startTime=" + startTime);
+ buffer.append("\n stopTime=" + stopTime);
+ buffer.append("\n requestCount=" + requestCount);
+ buffer.append("\n responseCount=" + responseCount);
+ buffer.append("\n faultCount=" + faultCount);
+ buffer.append("\n maxProcessingTime=" + maxProcessingTime);
+ buffer.append("\n minProcessingTime=" + minProcessingTime);
+ buffer.append("\n avgProcessingTime=" + avgProcessingTime);
+ buffer.append("\n totalProcessingTime=" + totalProcessingTime);
+ return buffer.toString();
+ }
+}
Added: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/management/EndpointMetrics.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/management/EndpointMetrics.java (rev 0)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/management/EndpointMetrics.java 2007-06-20 10:27:57 UTC (rev 3650)
@@ -0,0 +1,42 @@
+package org.jboss.wsf.spi.management;
+
+import java.util.Date;
+
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+public interface EndpointMetrics
+{
+
+ Endpoint getEndpoint();
+
+ void setEndpoint(Endpoint endpoint);
+
+ void start();
+
+ void stop();
+
+ long processRequestMessage();
+
+ void processResponseMessage(long beginTime);
+
+ void processFaultMessage(long beginTime);
+
+ Date getStartTime();
+
+ Date getStopTime();
+
+ long getMinProcessingTime();
+
+ long getMaxProcessingTime();
+
+ long getAverageProcessingTime();
+
+ long getTotalProcessingTime();
+
+ long getRequestCount();
+
+ long getFaultCount();
+
+ long getResponseCount();
+
+}
\ No newline at end of file
Modified: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/server/ContextServlet.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/server/ContextServlet.java 2007-06-20 10:26:35 UTC (rev 3649)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/server/ContextServlet.java 2007-06-20 10:27:57 UTC (rev 3650)
@@ -38,6 +38,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.management.EndpointMetrics;
import org.jboss.wsf.spi.management.EndpointRegistry;
import org.jboss.wsf.spi.management.EndpointRegistryFactory;
import org.jboss.wsf.spi.management.ServerConfig;
@@ -84,75 +85,78 @@
writer.print("<table>");
// begin iteration
- Set<ObjectName> endpoints = epRegistry.getEndpoints();
+ Set<ObjectName> epNames = epRegistry.getEndpoints();
- if (endpoints.isEmpty())
+ if (epNames.isEmpty())
{
writer.print("<tr>");
writer.print(" <td><h3>There are currently no endpoints deployed</h3></td>");
writer.print("</tr>");
}
- for (ObjectName oname : endpoints)
+ for (ObjectName oname : epNames)
{
Endpoint ep = epRegistry.getEndpoint(oname);
ServerEndpointMetaData sepMetaData = ep.getAttachment(ServerEndpointMetaData.class);
- ServerConfigFactory factory = ServerConfigFactory.getInstance();
- ServerConfig config = factory.getServerConfig();
- String displayAddress = config.getDisplayAddress(sepMetaData.getEndpointAddress(),requestURL);
+ ServerConfig config = ServerConfigFactory.getInstance().getServerConfig();
+ String displayAddress = config.getDisplayAddress(sepMetaData.getEndpointAddress(), requestURL);
writer.print("<tr>");
- writer.print(" <td>ServiceEndpointID</td>");
+ writer.print(" <td>Endpoint Name</td>");
writer.print(" <td>" + ep.getName() + "</td>");
writer.print("</tr>");
writer.print("<tr>");
- writer.print(" <td>ServiceEndpointAddress</td>");
+ writer.print(" <td>Endpoint Address</td>");
writer.print(" <td><a href='" + displayAddress + "?wsdl'>" + displayAddress + "?wsdl</a></td>");
writer.print("</tr>");
writer.print("<tr>");
writer.print(" <td colspan=2>");
writer.print(" ");
writer.print("");
- /*
- writer.print("<table class='metrics'>");
- writer.print("<tr>");
- writer.print(" <td>StartTime</td>");
- writer.print(" <td>StopTime</td>");
- writer.print(" <td></td>");
- writer.print("</tr>");
- writer.print("<tr>");
- writer.print(" <td>" + ep.getSeMetrics().getStartTime() + "</td>");
- String stopTime = ep.getSeMetrics().getStopTime() != null ? ep.getSeMetrics().getStopTime().toString() : "";
- writer.print(" <td>" + stopTime + "</td>");
- writer.print(" <td></td>");
- writer.print("</tr>");
- writer.print("<tr>");
+ EndpointMetrics metrics = ep.getEndpointMetrics();
+ if (metrics != null)
+ {
+ writer.print("<table class='metrics'>");
+ writer.print("<tr>");
+ writer.print(" <td>StartTime</td>");
+ writer.print(" <td>StopTime</td>");
+ writer.print(" <td></td>");
+ writer.print("</tr>");
+ writer.print("<tr>");
+ writer.print(" <td>" + metrics.getStartTime() + "</td>");
- writer.print(" <td>RequestCount</td>");
- writer.print(" <td>ResponseCount</td>");
- writer.print(" <td>FaultCount</td>");
- writer.print("</tr>");
- writer.print("<tr>");
- writer.print(" <td>" + ep.getSeMetrics().getRequestCount() + "</td>");
- writer.print(" <td>" + ep.getSeMetrics().getResponseCount() + "</td>");
- writer.print(" <td>" + ep.getSeMetrics().getFaultCount() + "</td>");
- writer.print("</tr>");
- writer.print("<tr>");
- writer.print(" <td>MinProcessingTime</td>");
- writer.print(" <td>MaxProcessingTime</td>");
- writer.print(" <td>AvgProcessingTime</td>");
- writer.print("</tr>");
- writer.print("<tr>");
- writer.print(" <td>" + ep.getSeMetrics().getMinProcessingTime() + "</td>");
- writer.print(" <td>" + ep.getSeMetrics().getMaxProcessingTime() + "</td>");
- writer.print(" <td>" + ep.getSeMetrics().getAverageProcessingTime() + "</td>");
- writer.print("</tr>");
- writer.print("");
- writer.print("");
- writer.print("</table>");
- */
- writer.print("");
+ String stopTime = metrics.getStopTime() != null ? metrics.getStopTime().toString() : "";
+ writer.print(" <td>" + stopTime + "</td>");
+ writer.print(" <td></td>");
+ writer.print("</tr>");
+ writer.print("<tr>");
+
+ writer.print(" <td>RequestCount</td>");
+ writer.print(" <td>ResponseCount</td>");
+ writer.print(" <td>FaultCount</td>");
+ writer.print("</tr>");
+ writer.print("<tr>");
+ writer.print(" <td>" + metrics.getRequestCount() + "</td>");
+ writer.print(" <td>" + metrics.getResponseCount() + "</td>");
+ writer.print(" <td>" + metrics.getFaultCount() + "</td>");
+ writer.print("</tr>");
+ writer.print("<tr>");
+ writer.print(" <td>MinProcessingTime</td>");
+ writer.print(" <td>MaxProcessingTime</td>");
+ writer.print(" <td>AvgProcessingTime</td>");
+ writer.print("</tr>");
+ writer.print("<tr>");
+ writer.print(" <td>" + metrics.getMinProcessingTime() + "</td>");
+ writer.print(" <td>" + metrics.getMaxProcessingTime() + "</td>");
+ writer.print(" <td>" + metrics.getAverageProcessingTime() + "</td>");
+ writer.print("</tr>");
+ writer.print("");
+ writer.print("");
+ writer.print("</table>");
+ writer.print("");
+ }
+
writer.print(" </td>");
writer.print("</tr>");
Modified: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java 2007-06-20 10:26:35 UTC (rev 3649)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java 2007-06-20 10:27:57 UTC (rev 3650)
@@ -143,10 +143,6 @@
log.warn("Ignore envelope child: " + elName);
}
}
- else
- {
- log.warn("Ignore child type: " + childType);
- }
}
return soapEnv;
More information about the jbossws-commits
mailing list