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 24 public class SyncedLogManager extends LogManager { 25 26 29 public SyncedLogManager(EnvironmentImpl envImpl, 30 boolean readOnly) 31 throws DatabaseException { 32 33 super(envImpl, readOnly); 34 } 35 36 protected LogResult logItem(LoggableObject item, 37 boolean isProvisional, 38 boolean flushRequired, 39 boolean forceNewLogFile, 40 long oldNodeLsn, 41 int oldNodeSize, 42 boolean marshallOutsideLatch, 43 ByteBuffer marshalledBuffer, 44 UtilizationTracker tracker) 45 throws IOException , DatabaseException { 46 47 synchronized (logWriteLatch) { 48 return logInternal 49 (item, isProvisional, flushRequired, forceNewLogFile, 50 oldNodeLsn, oldNodeSize, marshallOutsideLatch, 51 marshalledBuffer, tracker); 52 } 53 } 54 55 protected void flushInternal() 56 throws LogException, DatabaseException { 57 58 try { 59 synchronized (logWriteLatch) { 60 logBufferPool.writeBufferToFile(0); 61 } 62 } catch (IOException e) { 63 throw new LogException(e.getMessage()); 64 } 65 } 66 67 70 public TrackedFileSummary getUnflushableTrackedSummary(long file) 71 throws DatabaseException { 72 73 synchronized (logWriteLatch) { 74 return getUnflushableTrackedSummaryInternal(file); 75 } 76 } 77 78 81 public void countObsoleteNode(long lsn, LogEntryType type, int size) 82 throws DatabaseException { 83 84 UtilizationTracker tracker = envImpl.getUtilizationTracker(); 85 synchronized (logWriteLatch) { 86 countObsoleteNodeInternal(tracker, lsn, type, size); 87 } 88 } 89 90 93 public void countObsoleteNodes(TrackedFileSummary[] summaries) 94 throws DatabaseException { 95 96 UtilizationTracker tracker = envImpl.getUtilizationTracker(); 97 synchronized (logWriteLatch) { 98 countObsoleteNodesInternal(tracker, summaries); 99 } 100 } 101 102 105 public void countObsoleteINs(List lsnList) 106 throws DatabaseException { 107 108 synchronized (logWriteLatch) { 109 countObsoleteINsInternal(lsnList); 110 } 111 } 112 } 113 | Popular Tags |