[jbosscache-commits] JBoss Cache SVN: r5067 - benchmarks/CacheTests/trunk/src/perf.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Tue Jan 8 10:46:04 EST 2008


Author: bela at jboss.com
Date: 2008-01-08 10:46:04 -0500 (Tue, 08 Jan 2008)
New Revision: 5067

Modified:
   benchmarks/CacheTests/trunk/src/perf/SessionTest.java
Log:
ns

Modified: benchmarks/CacheTests/trunk/src/perf/SessionTest.java
===================================================================
--- benchmarks/CacheTests/trunk/src/perf/SessionTest.java	2008-01-08 15:38:10 UTC (rev 5066)
+++ benchmarks/CacheTests/trunk/src/perf/SessionTest.java	2008-01-08 15:46:04 UTC (rev 5067)
@@ -69,12 +69,19 @@
     }
 
     /** Create NUM_SESSIONS sessions with NUM_ATTRS attributes of SIZE size. Total size is multiplication of the 3 */
-    private static void init(Session session, int num_attrs, int size) throws NamingException {
-        for(int j=0; j < num_attrs; j++) {
-            byte[] buf=session.getAttribute(j);
-            if(buf == null)
-                session.setAttribute(j, new byte[size]);
+    private void init(Session session, int num_attrs, int size) throws NamingException {
+        try {
+            tx.begin();
+            for(int j=0; j < num_attrs; j++) {
+                byte[] buf=session.getAttribute(j);
+                if(buf == null)
+                    session.setAttribute(j, new byte[size]);
+            }
+            tx.commit();
         }
+        catch(Exception ex) {
+            try {tx.rollback();} catch(SystemException e) {}
+        }
     }
 
     private void loop(Session session, int session_id, int num_requests, int num_attrs, int size) {
@@ -141,7 +148,7 @@
 
     public static void main(String[] args) throws Exception {
         int session_id=-1;
-        int num_requests=1000;
+        int num_requests=100000;
         int num_attrs=100;
         int size=1000;
         int write_percentage=10; // percent




More information about the jbosscache-commits mailing list