1 23 24 package com.sun.ejb.base.stats; 25 26 import javax.management.j2ee.statistics.CountStatistic ; 27 import javax.management.j2ee.statistics.TimeStatistic ; 28 29 import com.sun.ejb.spi.stats.MonitorableSFSBStoreManager; 30 31 import com.sun.enterprise.admin.monitor.stats.CountStatisticImpl; 32 import com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl; 33 import com.sun.enterprise.admin.monitor.stats.MutableTimeStatisticImpl; 34 import com.sun.enterprise.admin.monitor.stats.TimeStatisticImpl; 35 36 42 43 public class StatefulSessionStoreMonitor { 44 45 private StatefulSessionStoreStatsImpl statsImpl; 46 47 void setDelegate(StatefulSessionStoreStatsImpl delegate) { 48 this.statsImpl = delegate; 49 } 50 51 final void appendStats(StringBuffer sbuf) { 52 if (statsImpl != null) { 53 statsImpl.appendStats(sbuf); 54 } 55 } 56 57 public final boolean isMonitoringOn() { 60 return (statsImpl != null); 61 } 62 63 public final void incrementActivationCount(boolean success) { 64 StatefulSessionStoreStatsImpl delegate = statsImpl; 65 if (delegate != null) { 66 delegate.incrementActivationCount(success); 67 } 68 } 69 70 public final void incrementPassivationCount(boolean success) { 71 StatefulSessionStoreStatsImpl delegate = statsImpl; 72 if (delegate != null) { 73 delegate.incrementPassivationCount(success); 74 } 75 } 76 77 public final void setActivationSize(long val) { 78 StatefulSessionStoreStatsImpl delegate = statsImpl; 79 if (delegate != null) { 80 delegate.setActivationSize(val); 81 } 82 } 83 84 public final void setActivationTime(long val) { 85 StatefulSessionStoreStatsImpl delegate = statsImpl; 86 if (delegate != null) { 87 delegate.setActivationTime(val); 88 } 89 } 90 91 public final void setPassivationSize(long val) { 92 StatefulSessionStoreStatsImpl delegate = statsImpl; 93 if (delegate != null) { 94 delegate.setPassivationSize(val); 95 } 96 } 97 98 public final void setPassivationTime(long val) { 99 StatefulSessionStoreStatsImpl delegate = statsImpl; 100 if (delegate != null) { 101 delegate.setPassivationTime(val); 102 } 103 } 104 105 public final void incrementExpiredSessionsRemoved(long val) { 106 StatefulSessionStoreStatsImpl delegate = statsImpl; 107 if (delegate != null) { 108 delegate.incrementExpiredSessionCountVal(val); 109 } 110 } 111 112 public void incrementCheckpointCount(boolean success) { 113 throw new RuntimeException ("Checkpoint operation not allowed on non-HA store"); 114 } 115 116 public void setCheckpointSize(long val) { 117 throw new RuntimeException ("Checkpoint operation not allowed on non-HA store"); 118 } 119 120 public void setCheckpointTime(long val) { 121 throw new RuntimeException ("Checkpoint operation not allowed on non-HA store"); 122 } 123 124 public int getNumExpiredSessionsRemoved() { 127 StatefulSessionStoreStatsImpl delegate = statsImpl; 128 return (delegate != null) 129 ? delegate.getNumExpiredSessionCount() 130 : 0; 131 } 132 133 public int getNumPassivationErrors() { 134 StatefulSessionStoreStatsImpl delegate = statsImpl; 135 return (delegate != null) 136 ? delegate.getNumPassivationErrorCount() 137 : 0; 138 } 139 140 public int getNumPassivations() { 141 StatefulSessionStoreStatsImpl delegate = statsImpl; 142 return (delegate != null) 143 ? delegate.getNumPassivationCount() 144 : 0; 145 } 146 147 public int getNumPassivationSuccess() { 148 StatefulSessionStoreStatsImpl delegate = statsImpl; 149 return (delegate != null) 150 ? delegate.getNumPassivationSuccessCount() 151 : 0; 152 } 153 154 } 155 | Popular Tags |