[infinispan-commits] Infinispan SVN: r2079 - in trunk: jopr-plugin/src/main/resources/META-INF and 1 other directory.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Tue Jul 20 09:35:37 EDT 2010


Author: DiabloD3
Date: 2010-07-20 09:35:36 -0400 (Tue, 20 Jul 2010)
New Revision: 2079

Modified:
   trunk/core/src/main/java/org/infinispan/notifications/Listener.java
   trunk/jopr-plugin/src/main/resources/META-INF/rhq-plugin.xml
Log:
Fixed code for Listener's transaction example to use Infinispan's API instead of JBoss Cache's



Modified: trunk/core/src/main/java/org/infinispan/notifications/Listener.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/notifications/Listener.java	2010-07-20 10:38:46 UTC (rev 2078)
+++ trunk/core/src/main/java/org/infinispan/notifications/Listener.java	2010-07-20 13:35:36 UTC (rev 2079)
@@ -154,53 +154,39 @@
  * <p/>
  * <pre>
  *    &#064;Listener
- *    public class TxGuaranteedListener
+ *    public class EventHandler
  *    {
- *       private class TxEventQueue
+ *       private ConcurrentMap&lt;GlobalTransaction, Queue&lt;Event&gt;&gt; map = new ConcurrentHashMap&lt;GlobalTransaction, Queue&lt;Event&gt;&gt;();
+ *
+ *       &#064;TransactionRegistered
+ *       public void startTransaction(TransactionRegisteredEvent event)
  *       {
- *          private ConcurrentMap&lt;Transaction, Queue&lt;Event&gt;&gt; map = new ConcurrentHashMap&lt;Transaction,
- * Queue&lt;Event&gt;&gt;();
- * <p/>
- *          public void offer(Event event)
- *          {
- *             Queue&lt;Event&gt; queue = getQueue(event.getContext().getTransaction());
- *             queue.offer(event);
- *          }
- * <p/>
- *          private Queue&lt;Event&gt; getQueue(Transaction transaction)
- *          {
- *             Queue&lt;Event&gt; queue = map.get(transaction);
- *             if (queue == null)
- *             {
- *                queue = new ConcurrentLinkedQueue&lt;Event&gt;();
- *                map.putIfAbsent(transaction, queue);
- *             }
- * <p/>
- *             return queue;
- *          }
- * <p/>
- *          public Queue&lt;Event&gt; takeAll(Transaction transaction)
- *          {
- *             return map.remove(transaction);
- *          }
+ *          map.put(event.getGlobalTransaction(), new ConcurrentLinkedQueue&lt;Event&gt;());
  *       }
- * <p/>
- *       private TxEventQueue events = new TxEventQueue();
- * <p/>
- *       &#064;CacheEntryModified
+ * 
  *       &#064;CacheEntryCreated
+ *       &#064;CacheEntryModified
  *       &#064;CacheEntryRemoved
- *       public void handle(Event event)
+ *       public void addEvent(TransactionalEvent event)
  *       {
- *          events.offer(event);
+ *          map.get(event.getGlobalTransaction()).add(event);
  *       }
- * <p/>
+ *  
  *       &#064;TransactionCompleted
- *       public void handleTx(TransactionCompletedEvent event)
+ *       public void endTransaction(TransactionCompletedEvent event)
  *       {
- *          Queue&lt;Event&gt; completed = events.takeAll(event.getTransaction());
- *          if (completed != null &amp;&amp; event.isSuccessful())
- *             System.out.println("Comitted events = " + completed);
+ *          Queue&lt;Event&gt; events = map.get(event.getGlobalTransaction());
+ *          map.remove(event.getGlobalTransaction());
+ *    
+ *          System.out.println("Ended transaction " + event.getGlobalTransaction().getId());
+ *    
+ *          if(event.isTransactionSuccessful())
+ *          {
+ *             for(Event e : events)
+ *             {
+ *                System.out.println("Event " + e);
+ *             }
+ *          }
  *       }
  *    }
  * </pre>

Modified: trunk/jopr-plugin/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- trunk/jopr-plugin/src/main/resources/META-INF/rhq-plugin.xml	2010-07-20 10:38:46 UTC (rev 2078)
+++ trunk/jopr-plugin/src/main/resources/META-INF/rhq-plugin.xml	2010-07-20 13:35:36 UTC (rev 2079)
@@ -61,18 +61,6 @@
           >
 
 
-           <operation name="Activation.resetStatistics" displayName="[Activation] Reset statistics" description="Resets statistics gathered by this component">
-           </operation>
-           <operation name="Passivation.resetStatistics" displayName="[Passivation] Reset statistics" description="Resets statistics gathered by this component">
-           </operation>
-           <operation name="Cache.start" displayName="[Cache] Starts cache." description="Starts the cache.">
-           </operation>
-           <operation name="Cache.stop" displayName="[Cache] Stops cache." description="Stops the cache.">
-           </operation>
-           <operation name="CacheStore.resetStatistics" displayName="[CacheStore] Reset statistics" description="Resets statistics gathered by this component">
-           </operation>
-           <operation name="DeadlockDetectingLockManager.resetStatistics" displayName="[DeadlockDetectingLockManager] Reset statistics" description="Resets statistics gathered by this component">
-           </operation>
            <operation name="Transactions.resetStatistics" displayName="[Transactions] Reset Statistics" description="Resets statistics gathered by this component">
            </operation>
            <operation name="Transactions.setStatisticsEnabled" displayName="[Transactions] Enable/disable statistics" description="Enable/disable statistics">
@@ -80,6 +68,12 @@
                  <c:simple-property name="enabled" description="Whether statistics should be enabled or disabled (true/false)"/>
               </parameters>
            </operation>
+           <operation name="Statistics.resetStatistics" displayName="[Statistics] Reset Statistics (Statistics)" description="Resets statistics gathered by this component">
+           </operation>
+           <operation name="Passivation.resetStatistics" displayName="[Passivation] Reset statistics" description="Resets statistics gathered by this component">
+           </operation>
+           <operation name="DeadlockDetectingLockManager.resetStatistics" displayName="[DeadlockDetectingLockManager] Reset statistics" description="Resets statistics gathered by this component">
+           </operation>
            <operation name="DistributionManager.isAffectedByRehash" displayName="[DistributionManager] Could key be affected by reshah?" description="Determines whether a given key is affected by an ongoing rehash, if any.">
               <parameters>
                  <c:simple-property name="key" description="Key to check"/>
@@ -104,6 +98,10 @@
                  <c:simple-property name="operationResult" />
               </results>
            </operation>
+           <operation name="CacheLoader.resetStatistics" displayName="[CacheLoader] Reset Statistics" description="Resets statistics gathered by this component">
+           </operation>
+           <operation name="Activation.resetStatistics" displayName="[Activation] Reset statistics" description="Resets statistics gathered by this component">
+           </operation>
            <operation name="RpcManager.resetStatistics" displayName="[RpcManager] Reset statistics" description="Resets statistics gathered by this component">
            </operation>
            <operation name="RpcManager.setStatisticsEnabled" displayName="[RpcManager] Enable/disable statistics" description="Enable/disable statistics">
@@ -111,10 +109,12 @@
                  <c:simple-property name="enabled" description="Whether statistics should be enabled or disabled (true/false)"/>
               </parameters>
            </operation>
-           <operation name="CacheLoader.resetStatistics" displayName="[CacheLoader] Reset Statistics" description="Resets statistics gathered by this component">
+           <operation name="Cache.start" displayName="[Cache] Starts cache." description="Starts the cache.">
            </operation>
-           <operation name="Statistics.resetStatistics" displayName="[Statistics] Reset Statistics (Statistics)" description="Resets statistics gathered by this component">
+           <operation name="Cache.stop" displayName="[Cache] Stops cache." description="Stops the cache.">
            </operation>
+           <operation name="CacheStore.resetStatistics" displayName="[CacheStore] Reset statistics" description="Resets statistics gathered by this component">
+           </operation>
            <operation name="Invalidation.resetStatistics" displayName="[Invalidation] Reset statistics" description="Resets statistics gathered by this component">
            </operation>
            <operation name="Invalidation.setStatisticsEnabled" displayName="[Invalidation] Enable/disable statistics" description="Enable/disable statistics">
@@ -123,26 +123,42 @@
               </parameters>
            </operation>
 
-           <metric property="Activation.Activations" displayName="[Activation] Number of cache entries activated" displayType="detail" units="none" dataType="measurement"
-                   description="Number of activation events" />
-           <metric property="Activation.CacheLoaderLoads" displayName="[Activation] Number of cache store loads" displayType="detail" units="none" dataType="measurement"
-                   description="Number of entries loaded from cache store" />
-           <metric property="Activation.CacheLoaderMisses" displayName="[Activation] Number of cache store load misses" displayType="detail" units="none" dataType="measurement"
-                   description="Number of entries that did not exist in cache store" />
+           <metric property="Transactions.StatisticsEnabled" displayName="[Transactions] Statistics enabled" displayType="detail" units="none" dataType="trait"
+                   description="Statistics enabled" />
+           <metric property="Transactions.Prepares" displayName="[Transactions] Prepares" displayType="summary" units="none" dataType="measurement"
+                   description="Number of transaction prepares performed since last reset" />
+           <metric property="Transactions.Commits" displayName="[Transactions] Commits" displayType="summary" units="none" dataType="measurement"
+                   description="Number of transaction commits performed since last reset" />
+           <metric property="Transactions.Rollbacks" displayName="[Transactions] Rollbacks" displayType="summary" units="none" dataType="measurement"
+                   description="Number of transaction rollbacks performed since last reset" />
+           <metric property="Statistics.Stores" displayName="[Statistics] Number of cache puts" displayType="summary" units="none" dataType="measurement"
+                   description="number of cache attribute put operations" />
+           <metric property="Statistics.Hits" displayName="[Statistics] Number of cache hits" displayType="summary" units="none" dataType="measurement"
+                   description="Number of cache attribute hits" />
+           <metric property="Statistics.Misses" displayName="[Statistics] Number of cache misses" displayType="summary" units="none" dataType="measurement"
+                   description="Number of cache attribute misses" />
+           <metric property="Statistics.RemoveHits" displayName="[Statistics] Number of cache removal hits" displayType="summary" units="none" dataType="measurement"
+                   description="Number of cache removal hits" />
+           <metric property="Statistics.RemoveMisses" displayName="[Statistics] Number of cache removal misses" displayType="summary" units="none" dataType="measurement"
+                   description="Number of cache removals where keys were not found" />
+           <metric property="Statistics.Evictions" displayName="[Statistics] Number of cache evictions" displayType="summary" units="none" dataType="measurement"
+                   description="Number of cache eviction operations" />
+           <metric property="Statistics.ElapsedTime" displayName="[Statistics] Seconds since cache started" displayType="summary" units="seconds" dataType="measurement"
+                   description="Number of seconds since cache started" />
+           <metric property="Statistics.NumberOfEntries" displayName="[Statistics] Number of current cache entries" displayType="summary" units="none" dataType="measurement"
+                   description="Number of entries currently in the cache" />
+           <metric property="Statistics.HitRatio" displayName="[Statistics] Hit ratio" displayType="summary" units="percentage" dataType="measurement"
+                   description="Percentage hit/(hit+miss) ratio for the cache" />
+           <metric property="Statistics.ReadWriteRatio" displayName="[Statistics] Read/write ratio" displayType="summary" units="percentage" dataType="measurement"
+                   description="read/writes ratio for the cache" />
+           <metric property="Statistics.AverageReadTime" displayName="[Statistics] Average read time" displayType="summary" units="milliseconds" dataType="measurement"
+                   description="Average number of milliseconds for a read operation on the cache" />
+           <metric property="Statistics.AverageWriteTime" displayName="[Statistics] Average write time" displayType="summary" units="milliseconds" dataType="measurement"
+                   description="Average number of milliseconds for a write operation in the cache" />
+           <metric property="Statistics.TimeSinceReset" displayName="[Statistics] Seconds since cache statistics were reset" displayType="summary" units="seconds" dataType="measurement"
+                   description="Number of seconds since the cache statistics were last reset" />
            <metric property="Passivation.Passivations" displayName="[Passivation] Number of cache passivations" displayType="detail" units="none" dataType="measurement"
                    description="Number of passivation events" />
-           <metric property="LockManager.ConcurrencyLevel" displayName="[LockManager] Concurrency level" displayType="detail" units="none" dataType="trait"
-                   description="The concurrency level that the MVCC Lock Manager has been configured with." />
-           <metric property="LockManager.NumberOfLocksHeld" displayName="[LockManager] Number of locks held" displayType="detail" units="none" dataType="measurement"
-                   description="The number of exclusive locks that are held." />
-           <metric property="LockManager.NumberOfLocksAvailable" displayName="[LockManager] Number of locks available" displayType="detail" units="none" dataType="measurement"
-                   description="The number of exclusive locks that are available." />
-           <metric property="Cache.CacheStatus" displayName="[Cache] Cache status" displayType="summary" units="none" dataType="trait"
-                   description="Returns the cache status" />
-           <metric property="Cache.CacheName" displayName="[Cache] Cache name" displayType="summary" units="none" dataType="trait"
-                   description="Returns the cache name" />
-           <metric property="CacheStore.CacheLoaderStores" displayName="[CacheStore] Number of cache stores" displayType="detail" units="none" dataType="measurement"
-                   description="number of cache loader stores" />
            <metric property="DeadlockDetectingLockManager.OverlapWithNotDeadlockAwareLockOwners" displayName="[DeadlockDetectingLockManager] Number of unsolvable deadlock situations" displayType="detail" units="none" dataType="measurement"
                    description="Number of situtations when we try to determine a deadlock and the other lock owner is e.g. a local tx. In this scenario we cannot run the deadlock detection mechanism" />
            <metric property="DeadlockDetectingLockManager.LocallyInterruptedTransactions" displayName="[DeadlockDetectingLockManager] Number of interrupted local transactions" displayType="detail" units="none" dataType="measurement"
@@ -159,26 +175,28 @@
                    description="The number of exclusive locks that are held." />
            <metric property="DeadlockDetectingLockManager.NumberOfLocksAvailable" displayName="[DeadlockDetectingLockManager] Number of locks available" displayType="detail" units="none" dataType="measurement"
                    description="The number of exclusive locks that are available." />
-           <metric property="Transactions.StatisticsEnabled" displayName="[Transactions] Statistics enabled" displayType="detail" units="none" dataType="trait"
-                   description="Statistics enabled" />
-           <metric property="Transactions.Prepares" displayName="[Transactions] Prepares" displayType="summary" units="none" dataType="measurement"
-                   description="Number of transaction prepares performed since last reset" />
-           <metric property="Transactions.Commits" displayName="[Transactions] Commits" displayType="summary" units="none" dataType="measurement"
-                   description="Number of transaction commits performed since last reset" />
-           <metric property="Transactions.Rollbacks" displayName="[Transactions] Rollbacks" displayType="summary" units="none" dataType="measurement"
-                   description="Number of transaction rollbacks performed since last reset" />
            <metric property="DistributionManager.RehashInProgress" displayName="[DistributionManager] Is rehash in progress?" displayType="detail" units="none" dataType="trait"
                    description="Checks whether the node is involved in a rehash." />
            <metric property="DistributionManager.JoinComplete" displayName="[DistributionManager] Is join completed?" displayType="detail" units="none" dataType="trait"
                    description="If true, the node has successfully joined the grid and is considered to hold state.  If false, the join process is still in progress." />
+           <metric property="CacheLoader.CacheLoaderLoads" displayName="[CacheLoader] Number of cache store loads" displayType="detail" units="none" dataType="measurement"
+                   description="Number of entries loaded from cache store" />
+           <metric property="CacheLoader.CacheLoaderMisses" displayName="[CacheLoader] Number of cache store load misses" displayType="detail" units="none" dataType="measurement"
+                   description="Number of entries that did not exist in cache store" />
+           <metric property="Activation.Activations" displayName="[Activation] Number of cache entries activated" displayType="detail" units="none" dataType="measurement"
+                   description="Number of activation events" />
+           <metric property="Activation.CacheLoaderLoads" displayName="[Activation] Number of cache store loads" displayType="detail" units="none" dataType="measurement"
+                   description="Number of entries loaded from cache store" />
+           <metric property="Activation.CacheLoaderMisses" displayName="[Activation] Number of cache store load misses" displayType="detail" units="none" dataType="measurement"
+                   description="Number of entries that did not exist in cache store" />
            <metric property="RpcManager.Members" displayName="[RpcManager] Cluster members" displayType="summary" units="none" dataType="trait"
                    description="List of members in the cluster" />
-           <metric property="RpcManager.StatisticsEnabled" displayName="[RpcManager] Statistics enabled" displayType="detail" units="none" dataType="trait"
-                   description="Statistics enabled" />
            <metric property="RpcManager.ReplicationCount" displayName="[RpcManager] Number of successfull replications" displayType="summary" units="none" dataType="measurement"
                    description="Number of successful replications" />
            <metric property="RpcManager.ReplicationFailures" displayName="[RpcManager] Number of failed replications" displayType="summary" units="none" dataType="measurement"
                    description="Number of failed replications" />
+           <metric property="RpcManager.StatisticsEnabled" displayName="[RpcManager] Statistics enabled" displayType="detail" units="none" dataType="trait"
+                   description="Statistics enabled" />
            <metric property="RpcManager.NodeAddress" displayName="[RpcManager] Network address" displayType="summary" units="none" dataType="trait"
                    description="The network address associated with this instance" />
            <metric property="RpcManager.PhysicalAddresses" displayName="[RpcManager] Physical network addresses" displayType="summary" units="none" dataType="trait"
@@ -189,36 +207,18 @@
                    description="Successful replications as a ratio of total replications in numeric double format" />
            <metric property="RpcManager.AverageReplicationTime" displayName="[RpcManager] Average time spent in the transport layer" displayType="summary" units="milliseconds" dataType="measurement"
                    description="The average time spent in the transport layer, in milliseconds" />
-           <metric property="CacheLoader.CacheLoaderLoads" displayName="[CacheLoader] Number of cache store loads" displayType="detail" units="none" dataType="measurement"
-                   description="Number of entries loaded from cache store" />
-           <metric property="CacheLoader.CacheLoaderMisses" displayName="[CacheLoader] Number of cache store load misses" displayType="detail" units="none" dataType="measurement"
-                   description="Number of entries that did not exist in cache store" />
-           <metric property="Statistics.Hits" displayName="[Statistics] Number of cache hits" displayType="summary" units="none" dataType="measurement"
-                   description="Number of cache attribute hits" />
-           <metric property="Statistics.Misses" displayName="[Statistics] Number of cache misses" displayType="summary" units="none" dataType="measurement"
-                   description="Number of cache attribute misses" />
-           <metric property="Statistics.RemoveHits" displayName="[Statistics] Number of cache removal hits" displayType="summary" units="none" dataType="measurement"
-                   description="Number of cache removal hits" />
-           <metric property="Statistics.RemoveMisses" displayName="[Statistics] Number of cache removal misses" displayType="summary" units="none" dataType="measurement"
-                   description="Number of cache removals where keys were not found" />
-           <metric property="Statistics.Stores" displayName="[Statistics] Number of cache puts" displayType="summary" units="none" dataType="measurement"
-                   description="number of cache attribute put operations" />
-           <metric property="Statistics.Evictions" displayName="[Statistics] Number of cache evictions" displayType="summary" units="none" dataType="measurement"
-                   description="Number of cache eviction operations" />
-           <metric property="Statistics.HitRatio" displayName="[Statistics] Hit ratio" displayType="summary" units="percentage" dataType="measurement"
-                   description="Percentage hit/(hit+miss) ratio for the cache" />
-           <metric property="Statistics.ReadWriteRatio" displayName="[Statistics] Read/write ratio" displayType="summary" units="percentage" dataType="measurement"
-                   description="read/writes ratio for the cache" />
-           <metric property="Statistics.AverageReadTime" displayName="[Statistics] Average read time" displayType="summary" units="milliseconds" dataType="measurement"
-                   description="Average number of milliseconds for a read operation on the cache" />
-           <metric property="Statistics.AverageWriteTime" displayName="[Statistics] Average write time" displayType="summary" units="milliseconds" dataType="measurement"
-                   description="Average number of milliseconds for a write operation in the cache" />
-           <metric property="Statistics.NumberOfEntries" displayName="[Statistics] Number of current cache entries" displayType="summary" units="none" dataType="measurement"
-                   description="Number of entries currently in the cache" />
-           <metric property="Statistics.ElapsedTime" displayName="[Statistics] Seconds since cache started" displayType="summary" units="seconds" dataType="measurement"
-                   description="Number of seconds since cache started" />
-           <metric property="Statistics.TimeSinceReset" displayName="[Statistics] Seconds since cache statistics were reset" displayType="summary" units="seconds" dataType="measurement"
-                   description="Number of seconds since the cache statistics were last reset" />
+           <metric property="Cache.CacheName" displayName="[Cache] Cache name" displayType="summary" units="none" dataType="trait"
+                   description="Returns the cache name" />
+           <metric property="Cache.CacheStatus" displayName="[Cache] Cache status" displayType="summary" units="none" dataType="trait"
+                   description="Returns the cache status" />
+           <metric property="CacheStore.CacheLoaderStores" displayName="[CacheStore] Number of cache stores" displayType="detail" units="none" dataType="measurement"
+                   description="number of cache loader stores" />
+           <metric property="LockManager.ConcurrencyLevel" displayName="[LockManager] Concurrency level" displayType="detail" units="none" dataType="trait"
+                   description="The concurrency level that the MVCC Lock Manager has been configured with." />
+           <metric property="LockManager.NumberOfLocksHeld" displayName="[LockManager] Number of locks held" displayType="detail" units="none" dataType="measurement"
+                   description="The number of exclusive locks that are held." />
+           <metric property="LockManager.NumberOfLocksAvailable" displayName="[LockManager] Number of locks available" displayType="detail" units="none" dataType="measurement"
+                   description="The number of exclusive locks that are available." />
            <metric property="Invalidation.StatisticsEnabled" displayName="[Invalidation] Statistics enabled" displayType="detail" units="none" dataType="trait"
                    description="Statistics enabled" />
            <metric property="Invalidation.Invalidations" displayName="[Invalidation] Number of invalidations" displayType="detail" units="none" dataType="measurement"



More information about the infinispan-commits mailing list