1 8 9 package com.sleepycat.je; 10 11 import java.io.Serializable ; 12 13 import com.sleepycat.je.latch.LatchStats; 14 15 19 public class LockStats implements Serializable { 20 21 24 private int nTotalLocks; 25 26 29 private int nReadLocks; 30 31 34 private int nWriteLocks; 35 36 39 private int nWaiters; 40 41 44 private int nOwners; 45 46 49 private long nRequests; 50 51 54 private long nWaits; 55 56 59 private LatchStats lockTableLatchStats; 60 61 65 public int getNOwners() { 66 return nOwners; 67 } 68 69 73 public int getNReadLocks() { 74 return nReadLocks; 75 } 76 77 81 public int getNTotalLocks() { 82 return nTotalLocks; 83 } 84 85 89 public int getNWaiters() { 90 return nWaiters; 91 } 92 93 97 public int getNWriteLocks() { 98 return nWriteLocks; 99 } 100 101 105 public long getNRequests() { 106 return nRequests; 107 } 108 109 113 public long getNWaits() { 114 return nWaits; 115 } 116 117 120 public void setNOwners(int val) { 121 nOwners = val; 122 } 123 124 127 public void setNReadLocks(int val) { 128 nReadLocks = val; 129 } 130 131 134 public void accumulateNTotalLocks(int val) { 135 nTotalLocks += val; 136 } 137 138 141 public void setNWaiters(int val) { 142 nWaiters = val; 143 } 144 145 148 public void setNWriteLocks(int val) { 149 nWriteLocks = val; 150 } 151 152 155 public void setNRequests(long requests) { 156 this.nRequests = requests; 157 } 158 159 162 public void setNWaits(long waits) { 163 this.nWaits = waits; 164 } 165 166 169 public void accumulateLockTableLatchStats(LatchStats latchStats) { 170 if (lockTableLatchStats == null) { 171 lockTableLatchStats = latchStats; 172 return; 173 } 174 175 lockTableLatchStats.nAcquiresNoWaiters += 176 latchStats.nAcquiresNoWaiters; 177 lockTableLatchStats.nAcquiresSelfOwned += 178 latchStats.nAcquiresSelfOwned; 179 lockTableLatchStats.nAcquiresUpgrade += 180 latchStats.nAcquiresUpgrade; 181 lockTableLatchStats.nAcquiresWithContention += 182 latchStats.nAcquiresWithContention; 183 lockTableLatchStats.nAcquireNoWaitSuccessful += 184 latchStats.nAcquireNoWaitSuccessful; 185 lockTableLatchStats.nAcquireNoWaitUnsuccessful += 186 latchStats.nAcquireNoWaitUnsuccessful; 187 lockTableLatchStats.nAcquireSharedSuccessful += 188 latchStats.nAcquireSharedSuccessful; 189 } 190 191 195 public String toString() { 196 StringBuffer sb = new StringBuffer (); 197 sb.append("nTotalLocks=").append(nTotalLocks).append('\n'); 198 sb.append("nReadLocks=").append(nReadLocks).append('\n'); 199 sb.append("nWriteLocks=").append(nWriteLocks).append('\n'); 200 sb.append("nWaiters=").append(nWaiters).append('\n'); 201 sb.append("nOwners=").append(nOwners).append('\n'); 202 sb.append("nRequests=").append(nRequests).append('\n'); 203 sb.append("nWaits=").append(nWaits).append('\n'); 204 sb.append("lockTableLatch:\n").append(lockTableLatchStats); 205 return sb.toString(); 206 } 207 } 208 | Popular Tags |