FileDocCategorySizeDatePackage
JVMThreadInfoStatsImpl.javaAPI DocGlassfish v2 API11002Fri May 04 22:24:20 BST 2007com.sun.enterprise.admin.monitor.stats.spi

JVMThreadInfoStatsImpl

public class JVMThreadInfoStatsImpl extends Object implements com.sun.enterprise.admin.monitor.stats.JVMThreadInfoStats

Fields Summary
private com.sun.enterprise.admin.monitor.stats.GenericStatsImpl
baseStatsImpl
private static final String
STATS_INTERFACE_NAME
private static final com.sun.enterprise.util.i18n.StringManager
localStrMgr
private ThreadInfo
info
private long
initTime
com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
blockedCount
com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
blockedTime
com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
lockOwnerId
com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
threadId
com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
waitingCount
com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
waitingTime
static String
NEWLINE
Constructors Summary
public JVMThreadInfoStatsImpl(ThreadInfo tInfo)
Creates a new instance of JVMThreadInfoStatsImpl

    

           
       
        try {
            baseStatsImpl = new GenericStatsImpl(STATS_INTERFACE_NAME, this);
        } catch(Exception e) {
        }
        initTime = System.currentTimeMillis();
        info = tInfo;
        // initialize all the MutableStatistic Classes
        initializeStatistics();
    
Methods Summary
public javax.management.j2ee.statistics.CountStatisticgetBlockedCount()

        long blockCount = info.getBlockedCount();
        blockedCount.setCount(blockCount);
        return (CountStatistic)blockedCount.unmodifiableView ();
    
public javax.management.j2ee.statistics.CountStatisticgetBlockedTime()

        long blockTime = info.getBlockedTime();
        blockedTime.setCount(blockTime);
        return (CountStatistic)blockedTime.unmodifiableView ();
    
public com.sun.enterprise.admin.monitor.stats.StringStatisticgetLockName()

             
        String lockName = info.getLockName();
        if((lockName == null) || ("".equals(lockName)))
            lockName = localStrMgr.getString("monitor.stats.no_lock");

        return new StringStatisticImpl(lockName, 
                   localStrMgr.getString("monitor.stats.lock_name"), 
                   localStrMgr.getString("monitor.stats.string_units"), 
                   localStrMgr.getString("monitor.stats.lock_desc"), 
                   initTime,
                   System.currentTimeMillis());

    
public javax.management.j2ee.statistics.CountStatisticgetLockOwnerId()

        long id = info.getLockOwnerId();
        lockOwnerId.setCount(id);
        return (CountStatistic)lockOwnerId.unmodifiableView ();
    
public com.sun.enterprise.admin.monitor.stats.StringStatisticgetLockOwnerName()

        String lockOwnerName = info.getLockOwnerName();
        if((lockOwnerName == null) || ( "".equals(lockOwnerName)))
            lockOwnerName = localStrMgr.getString("monitor.stats.no_owner");

        return new StringStatisticImpl(lockOwnerName, 
                   localStrMgr.getString("monitor.stats.lock_owner_name"), 
                   localStrMgr.getString("monitor.stats.string_units"), 
                   localStrMgr.getString("monitor.stats.lock_owner_desc"), 
                   initTime,
                   System.currentTimeMillis());
    
public com.sun.enterprise.admin.monitor.stats.StringStatisticgetStackTrace()

        StackTraceElement[] trace = info.getStackTrace();
        String traceString = new String();
        if(trace != null) {
            for(int i = 0; i < trace.length; i++) {
                traceString = traceString.concat(trace[i].toString());
                traceString = traceString.concat(NEWLINE);
            }
        }
        return new StringStatisticImpl(traceString, 
                   localStrMgr.getString("monitor.stats.stack_trace_name"), 
                   localStrMgr.getString("monitor.stats.string_units"), 
                   localStrMgr.getString("monitor.stats.stack_trace_desc"), 
                   initTime,
                   System.currentTimeMillis());
        
        
    
public javax.management.j2ee.statistics.StatisticgetStatistic(java.lang.String str)
queries for a Statistic by name.

return
Statistic

        return baseStatsImpl.getStatistic(str);
    
public java.lang.String[]getStatisticNames()
returns an array of names of all the Statistics, that can be retrieved from this implementation of Stats

return
String[]

        return baseStatsImpl.getStatisticNames();
    
public javax.management.j2ee.statistics.Statistic[]getStatistics()
This method can be used to retrieve all the Statistics, exposed by this implementation of Stats

return
Statistic[]

        return baseStatsImpl.getStatistics();
    
public javax.management.j2ee.statistics.CountStatisticgetThreadId()

        long id = info.getThreadId();
        threadId.setCount(id);
        return (CountStatistic)threadId.unmodifiableView ();
    
public com.sun.enterprise.admin.monitor.stats.StringStatisticgetThreadName()

     
        String name = info.getThreadName();

        return new StringStatisticImpl(name, 
                   localStrMgr.getString("monitor.stats.thread_name"), 
                   localStrMgr.getString("monitor.stats.string_units"), 
                   localStrMgr.getString("monitor.stats.thread_name_desc"), 
                   initTime,
                   System.currentTimeMillis());
    
public com.sun.enterprise.admin.monitor.stats.StringStatisticgetThreadState()

        
        return new StringStatisticImpl(info.getThreadState().toString(),
                   localStrMgr.getString("monitor.stats.thread_state"), 
                   localStrMgr.getString("monitor.stats.string_units"), 
                   localStrMgr.getString("monitor.stats.thread_state_desc"), 
                   initTime,
                   System.currentTimeMillis());
    
public javax.management.j2ee.statistics.CountStatisticgetWaitedCount()

        long waitCount = info.getWaitedCount();
        waitingCount.setCount(waitCount);
        return (CountStatistic)waitingCount.unmodifiableView ();
    
public javax.management.j2ee.statistics.CountStatisticgetWaitedTime()

        long waitTime = info.getWaitedTime();
        waitingTime.setCount(waitTime);
        return (CountStatistic)waitingTime.unmodifiableView ();
    
private voidinitializeStatistics()

        
        // Initialize the MutableCountStatistic for BlockedTime
        CountStatistic c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.blocked_time"), 
            localStrMgr.getString("monitor.stats.milli_sec_units"),
            localStrMgr.getString("monitor.stats.blocked_time_desc"));
        blockedTime = new MutableCountStatisticImpl(c);
        
        // Initialize the MutableCountStatistic for BlockedCount
        c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.blocked_count"), 
            StatisticImpl.DEFAULT_UNIT,
            localStrMgr.getString("monitor.stats.blocked_count_desc"));
        blockedCount = new MutableCountStatisticImpl(c);
        
        // Initialize the MutableCountStatistic for LockOwnerId
        c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.lock_owner_id"),
            StatisticImpl.DEFAULT_UNIT,
            localStrMgr.getString("monitor.stats.lock_owner_id_desc"));
        blockedCount = new MutableCountStatisticImpl(c);
        lockOwnerId = new MutableCountStatisticImpl(c);
        
        // Initialize the MutableCountStatistic for ThreadId
        c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.thread_id"),
            StatisticImpl.DEFAULT_UNIT,
            localStrMgr.getString("monitor.stats.thread_id_desc"));
        threadId = new MutableCountStatisticImpl(c);
        
        // Initialize the MutableCountStatistic for WaitingCount
        c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.waiting_count"),
            StatisticImpl.DEFAULT_UNIT,
            localStrMgr.getString("monitor.stats.waiting_count_desc"));
        waitingCount = new MutableCountStatisticImpl(c);
        
        // Initialize the MutableCountStatistic for WaitingTime
        c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.waiting_time"), 
            localStrMgr.getString("monitor.stats.milli_sec_units"),
            localStrMgr.getString("monitor.stats.waiting_time_desc")); 
        waitingTime = new MutableCountStatisticImpl(c);