1 8 9 package com.sleepycat.je.log; 10 11 import java.io.IOException ; 12 import java.nio.ByteBuffer ; 13 import java.util.List ; 14 15 import com.sleepycat.je.DatabaseException; 16 import com.sleepycat.je.cleaner.TrackedFileSummary; 17 import com.sleepycat.je.cleaner.UtilizationTracker; 18 import com.sleepycat.je.dbi.EnvironmentImpl; 19 20 23 public class LatchedLogManager extends LogManager { 24 25 28 public LatchedLogManager(EnvironmentImpl envImpl, 29 boolean readOnly) 30 throws DatabaseException { 31 32 super(envImpl, readOnly); 33 } 34 35 protected LogResult logItem(LoggableObject item, 36 boolean isProvisional, 37 boolean flushRequired, 38 boolean forceNewLogFile, 39 long oldNodeLsn, 40 int oldNodeSize, 41 boolean marshallOutsideLatch, 42 ByteBuffer marshalledBuffer, 43 UtilizationTracker tracker) 44 throws IOException , DatabaseException { 45 46 logWriteLatch.acquire(); 47 try { 48 return logInternal 49 (item, isProvisional, flushRequired, forceNewLogFile, 50 oldNodeLsn, oldNodeSize, marshallOutsideLatch, 51 marshalledBuffer, tracker); 52 } finally { 53 logWriteLatch.release(); 54 } 55 } 56 57 protected void flushInternal() 58 throws LogException, DatabaseException { 59 60 logWriteLatch.acquire(); 61 try { 62 logBufferPool.writeBufferToFile(0); 63 } catch (IOException e) { 64 throw new LogException(e.getMessage()); 65 } finally { 66 logWriteLatch.release(); 67 } 68 } 69 70 73 public TrackedFileSummary getUnflushableTrackedSummary(long file) 74 throws DatabaseException { 75 76 logWriteLatch.acquire(); 77 try { 78 return getUnflushableTrackedSummaryInternal(file); 79 } finally { 80 logWriteLatch.release(); 81 } 82 } 83 84 87 public void countObsoleteNode(long lsn, LogEntryType type, int size) 88 throws DatabaseException { 89 90 UtilizationTracker tracker = envImpl.getUtilizationTracker(); 91 logWriteLatch.acquire(); 92 try { 93 countObsoleteNodeInternal(tracker, lsn, type, size); 94 } finally { 95 logWriteLatch.release(); 96 } 97 } 98 99 102 public void countObsoleteNodes(TrackedFileSummary[] summaries) 103 throws DatabaseException { 104 105 UtilizationTracker tracker = envImpl.getUtilizationTracker(); 106 logWriteLatch.acquire(); 107 try { 108 countObsoleteNodesInternal(tracker, summaries); 109 } finally { 110 logWriteLatch.release(); 111 } 112 } 113 114 117 public void countObsoleteINs(List lsnList) 118 throws DatabaseException { 119 120 logWriteLatch.acquire(); 121 try { 122 countObsoleteINsInternal(lsnList); 123 } finally { 124 logWriteLatch.release(); 125 } 126 } 127 } 128 | Popular Tags |