[jboss-cvs] JBossAS SVN: r68623 - projects/cluster/varia/sessionstress.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 4 04:59:56 EST 2008


Author: bela at jboss.com
Date: 2008-01-04 04:59:56 -0500 (Fri, 04 Jan 2008)
New Revision: 68623

Modified:
   projects/cluster/varia/sessionstress/PerfTest.java
Log:
destroying session at the end of the test

Modified: projects/cluster/varia/sessionstress/PerfTest.java
===================================================================
--- projects/cluster/varia/sessionstress/PerfTest.java	2008-01-04 09:48:04 UTC (rev 68622)
+++ projects/cluster/varia/sessionstress/PerfTest.java	2008-01-04 09:59:56 UTC (rev 68623)
@@ -157,7 +157,7 @@
         private final int           read_percentage;
         private final int           num_requests, num_attrs, size;
         private final HttpClient    session=new HttpClient();
-        private final GetMethod     setup_method;
+        private final GetMethod     setup_method, destroy_method;
         private final String        read_url;
         private final String        write_url;
         private final CyclicBarrier barrier;
@@ -180,6 +180,7 @@
             this.read_url=tmp + read_url + "?id=";
             this.write_url=tmp + write_url + "?size=" + size + "&id=";
             this.setup_method=new GetMethod(tmp + setup_url + "?num_attrs=" + num_attrs + "&size=" + size);
+            this.destroy_method=new GetMethod(tmp + "web/destroy.jsp");
         }
 
         public void run() {
@@ -194,12 +195,15 @@
             }
             finally {
                 stop=System.currentTimeMillis();
+                try {terminate();} catch(IOException e) {}
                 log("barrier.await()");
                 try {barrier.await(60000, TimeUnit.MILLISECONDS);} catch(Exception e) {}
                 setup_method.releaseConnection();
             }
         }
 
+
+
         public long getBytesRead() {
             return bytes_read;
         }
@@ -243,6 +247,16 @@
             }
         }
 
+        private void terminate() throws IOException {
+            int rc=session.executeMethod(destroy_method);
+            if(rc != HttpStatus.SC_OK) {
+                throw new RuntimeException("failed destroying session", null);
+            }
+            else {
+                log("destroyed session");
+            }
+        }
+
         private void loop(int num_requests) throws IOException {
             int random, id;
             int print=num_requests / 10;




More information about the jboss-cvs-commits mailing list