Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2006, Red Hat Middleware LLC, and individual contributors 
   * as indicated by the @author tags. 
   * See the copyright.txt in the distribution for a
   * full listing of individual contributors. 
   * This copyrighted material is made available to anyone wishing to use,
   * modify, copy, or redistribute it subject to the terms and conditions
   * of the GNU Lesser General Public License, v. 2.1.
  * This program is distributed in the hope that it will be useful, but WITHOUT A 
  * 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,
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
  * MA  02110-1301, USA.
  * 
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
 /*
  * Copyright (C) 2000, 2001,
  *
  * Arjuna Solutions Limited,
  * Newcastle upon Tyne,
  * Tyne and Wear,
  * UK.  
  *
  * $Id: TxStats.java 2342 2006-03-30 13:06:17Z  $
  */
 
 package com.arjuna.ats.arjuna.coordinator;
 
 
This class is used to maintain statistics on transactions that have been created. This includes the number of transactions, their termination status (committed or rolled back), ...

Author(s):
Mark Little (mark@arjuna.com)
Version:
$Id: TxStats.java 2342 2006-03-30 13:06:17Z $
Since:
JTS 2.1.
 
 
 public class TxStats implements TxStatsMBean
 {
     private static TxStats _instance = new TxStats();
 
     private static CoordinatorEnvironmentBean _environmentBean;
 
     private TxStats() {
     }
 
     public static boolean enabled() {
       //not thread safe but not sure we require thread safety as long as eventually all threads stop setting the bean
       if(==null){
         =arjPropertyManager.getCoordinatorEnvironmentBean();
       }
         return .isEnableStatistics();
     }
 
     public static TxStats getInstance() {
         return ;
     }

    

Returns:
the number of transactions (top-level and nested) created so far.
 
 	public long getNumberOfTransactions()
 	{
         return .longValue();
 	}
    
    

Returns:
the number of nested (sub) transactions created so far.
 
 	{
         return .longValue();
 	}

Returns:
the number of transactions which have terminated with heuristic outcomes.
 
 	public long getNumberOfHeuristics()
 	{
         return .get();
 	}

Returns:
the number of committed transactions.
 
 	{
        return .get();
	}

Returns:
the total number of transactions which have rolled back.
	{
        return .get();
	}

Returns:
total number of inflight (active) transactions.
	{
		return ActionManager.manager().getNumberOfInflightTransactions();
	}

Returns:
the number of transactions that have rolled back due to timeout.
	{
        return .get();
	}

Returns:
the number of transactions that been rolled back by the application.
	{
        return .get();
	}

Returns:
the number of transactions that have been rolled back by participants.
	{
        return .get();
	}

Print all of the current statistics information.

Parameters:
pw the writer to use.
	public void printStatus(java.io.PrintWriter pw)
	{
		pw.println("JBoss Transaction Service statistics.");
		pw.println(java.util.Calendar.getInstance().getTime() + "\n");
		pw.println("Number of created transactions: " + getNumberOfTransactions());
		pw.println("Number of nested transactions: "
		pw.println("Number of heuristics: " + getNumberOfHeuristics());
		pw.println("Number of committed transactions: "
		pw.println("Number of rolled back transactions: "
		pw.println("Number of inflight transactions: "
		pw.println("Number of timed-out transactions: "
		pw.println("Number of application rolled back transactions: "
		pw.println("Number of resource rolled back transactions: "
	}
	{
	}
	{
	}
	{
	}
	{
	}
	{
	}
	{
	}
	{
	}
	{
	}
	private AtomicLong numberOfTimeouts = new AtomicLong(0);
New to GrepCode? Check out our FAQ X