axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r358219 - in /webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling: ./ Client.java ContextMemoryHandlingUtil.java Server.java
Date Wed, 21 Dec 2005 05:55:37 GMT
Author: chinthaka
Date: Tue Dec 20 21:55:26 2005
New Revision: 358219

URL: http://svn.apache.org/viewcvs?rev=358219&view=rev
Log:
Adding classes used for memory profiling for later use.

Added:
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/Client.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/ContextMemoryHandlingUtil.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/Server.java

Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/Client.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/Client.java?rev=358219&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/Client.java
(added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/Client.java
Tue Dec 20 21:55:26 2005
@@ -0,0 +1,45 @@
+package org.apache.axis2.engine.util.profiling;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+public class Client {
+
+    public static void main(String[] args) {
+        ContextMemoryHandlingUtil contextMemoryHandlingTest = new ContextMemoryHandlingUtil();
+
+        try {
+            long initialMemory = Runtime.getRuntime().freeMemory();
+            System.out.println("initialMemory = " + initialMemory);
+            int numberOfTimes = 0;
+
+            while (true) {
+//            while (numberOfTimes < 50) {
+
+                System.out.println("Iterations # = " + ++numberOfTimes);
+                contextMemoryHandlingTest.runOnce();
+                Runtime.getRuntime().gc();
+                System.out.println("Memory Usage = " + (initialMemory - Runtime.getRuntime().freeMemory()));
+
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.exit(-1);
+        }
+
+    }
+}

Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/ContextMemoryHandlingUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/ContextMemoryHandlingUtil.java?rev=358219&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/ContextMemoryHandlingUtil.java
(added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/ContextMemoryHandlingUtil.java
Tue Dec 20 21:55:26 2005
@@ -0,0 +1,63 @@
+package org.apache.axis2.engine.util.profiling;
+
+import org.apache.axis2.engine.EchoRawXMLTest;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @author : Eran Chinthaka (chinthaka@apache.org)
+ */
+
+public class ContextMemoryHandlingUtil extends EchoRawXMLTest {
+
+    public ContextMemoryHandlingUtil() {
+    }
+
+    public void startup() throws Exception {
+        super.setUp();
+    }
+
+    public void runOnce() throws Exception {
+        super.testEchoXMLSync();
+    }
+
+    public void shutdown() throws Exception {
+        super.tearDown();
+
+
+    }
+
+    public static void main(String[] args) throws Exception {
+        ContextMemoryHandlingUtil contextMemoryHandlingTest = new ContextMemoryHandlingUtil();
+
+        try {
+            long initialMemory = Runtime.getRuntime().freeMemory();
+            System.out.println("initialMemory = " + initialMemory);
+            int numberOfTimes = 0;
+
+            while (true) {
+
+                System.out.println("Iterations # = " + ++numberOfTimes);
+                contextMemoryHandlingTest.runOnce();
+                System.out.println("Memory Usage = " + (initialMemory - Runtime.getRuntime().freeMemory()));
+
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            contextMemoryHandlingTest.shutdown();
+            System.exit(-1);
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/Server.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/Server.java?rev=358219&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/Server.java
(added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/Server.java
Tue Dec 20 21:55:26 2005
@@ -0,0 +1,55 @@
+package org.apache.axis2.engine.util.profiling;
+
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.Echo;
+import org.apache.axis2.engine.util.TestConstants;
+import org.apache.axis2.integration.UtilServer;
+import org.apache.axis2.util.Utils;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+public class Server implements TestConstants {
+    protected AxisService service;
+
+    public void start() throws Exception {
+        UtilServer.start();
+        service =
+                Utils.createSimpleService(serviceName,
+                        Echo.class.getName(),
+                        operationName);
+        UtilServer.deployService(service);
+    }
+
+    public void shutdown() throws Exception {
+        UtilServer.unDeployService(serviceName);
+        UtilServer.stop();
+        UtilServer.unDeployClientService();
+    }
+
+
+    public static void main(String[] args) throws Exception {
+        Server server = new Server();
+        try {
+            server.start();
+        } catch (Exception e) {
+            e.printStackTrace();
+            server.shutdown();
+        }
+    }
+
+}



Mime
View raw message