This is an automated email from the ASF dual-hosted git repository.

klund pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 3482a10c1334918e4ed9faea83bc95d84842ef93
Author: Kirk Lund <[email protected]>
AuthorDate: Fri Jun 22 12:33:33 2018 -0700

    GEODE-5390: Move inner classes to end of Oplog
---
 .../org/apache/geode/internal/cache/Oplog.java     | 346 ++++++++++-----------
 .../sanctioned-geode-core-serializables.txt        |   1 -
 2 files changed, 167 insertions(+), 180 deletions(-)

diff --git 
a/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java 
b/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java
index b1fdcd1..6157bc8 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java
@@ -508,28 +508,6 @@ public class Oplog implements CompactableOplog, Flushable {
    */
   static final byte OPLOG_MAGIC_SEQ_ID = 92;
 
-  public enum OPLOG_TYPE {
-    CRF(new byte[] {0x47, 0x46, 0x43, 0x52, 0x46, 0x31}), // GFCRF1
-    DRF(new byte[] {0x47, 0x46, 0x44, 0x52, 0x46, 0x31}), // GFDRF1
-    IRF(new byte[] {0x47, 0x46, 0x49, 0x52, 0x46, 0x31}), // GFIRF1
-    KRF(new byte[] {0x47, 0x46, 0x4b, 0x52, 0x46, 0x31}), // GFKRF1
-    IF(new byte[] {0x47, 0x46, 0x49, 0x46, 0x30, 0x31}); // GFIF01
-
-    private final byte[] bytes;
-
-    OPLOG_TYPE(byte[] byteSeq) {
-      this.bytes = byteSeq;
-    }
-
-    public byte[] getBytes() {
-      return bytes;
-    }
-
-    public static int getLen() {
-      return 6;
-    }
-  }
-
   public static final int OPLOG_MAGIC_SEQ_REC_SIZE = 1 + OPLOG_TYPE.getLen() + 
1;
 
   /** Compact this oplogs or no. A client configurable property * */
@@ -3805,40 +3783,6 @@ public class Oplog implements CompactableOplog, 
Flushable {
     });
   }
 
-  /**
-   * Used when creating a KRF to keep track of what DiskRegionView a DiskEntry 
belongs to.
-   */
-  private static class KRFEntry {
-    private final DiskEntry de;
-    private final DiskRegionView drv;
-    /**
-     * Fix for 42733 - a stable snapshot of the offset so we can sort It 
doesn't matter that this is
-     * stale, we'll filter out these entries later.
-     */
-    private final long offsetInOplog;
-    private VersionHolder versionTag;
-
-    public KRFEntry(DiskRegionView drv, DiskEntry de, VersionHolder tag) {
-      this.de = de;
-      this.drv = drv;
-      DiskId diskId = de.getDiskId();
-      this.offsetInOplog = diskId != null ? diskId.getOffsetInOplog() : 0;
-      this.versionTag = tag;
-    }
-
-    public DiskEntry getDiskEntry() {
-      return this.de;
-    }
-
-    public DiskRegionView getDiskRegionView() {
-      return this.drv;
-    }
-
-    public long getOffsetInOplogForSorting() {
-      return offsetInOplog;
-    }
-  }
-
   private void writeOneKeyEntryForKRF(KRFEntry ke) throws IOException {
     DiskEntry de = ke.getDiskEntry();
     long diskRegionId = ke.getDiskRegionView().getId();
@@ -6311,26 +6255,6 @@ public class Oplog implements CompactableOplog, 
Flushable {
     return chPrev;
   }
 
-  private static class OplogFile {
-    public File f;
-    public UninterruptibleRandomAccessFile raf;
-    public volatile boolean RAFClosed = true;
-    public UninterruptibleFileChannel channel;
-    public ByteBuffer writeBuf;
-    public long currSize;
-    public long bytesFlushed;
-    public boolean unpreblown;
-  }
-
-  private static class KRFile {
-    public File f;
-    FileOutputStream fos;
-    BufferedOutputStream bos;
-    DataOutputStream dos;
-    long lastOffset = 0;
-    int keyNum = 0;
-  }
-
   private static String baToString(byte[] ba) {
     return baToString(ba, ba != null ? ba.length : 0);
   }
@@ -6390,6 +6314,168 @@ public class Oplog implements CompactableOplog, 
Flushable {
     InternalDataSerializer.writeSignedVL(dsId, out);
   }
 
+  public void finishKrf() {
+    createKrf(false);
+  }
+
+  void prepareForClose() {
+    try {
+      finishKrf();
+    } catch (CancelException e) {
+      // workaround for 50465
+      if (logger.isDebugEnabled()) {
+        logger.debug("Got a cancel exception while creating a krf during 
shutown", e);
+      }
+    }
+  }
+
+  private Object deserializeKey(byte[] keyBytes, final Version version,
+      final ByteArrayDataInput in) {
+    if (!getParent().isOffline() || !PdxWriterImpl.isPdx(keyBytes)) {
+      return EntryEventImpl.deserialize(keyBytes, version, in);
+    } else {
+      return new RawByteKey(keyBytes);
+    }
+  }
+
+  /**
+   * If this OpLog is from an older version of the product, then return that 
{@link Version} else
+   * return null.
+   */
+  public Version getProductVersionIfOld() {
+    final Version version = this.gfversion;
+    if (version == null) {
+      // check for the case of diskstore upgrade from 6.6 to >= 7.0
+      if (getParent().isUpgradeVersionOnly()) {
+        // assume previous release version
+        return Version.GFE_66;
+      } else {
+        return null;
+      }
+    } else if (version == Version.CURRENT) {
+      return null;
+    } else {
+      // version changed so return that for VersionedDataStream
+      return version;
+    }
+  }
+
+  /**
+   * If this OpLog has data that was written by an older version of the 
product, then return that
+   * {@link Version} else return null.
+   */
+  public Version getDataVersionIfOld() {
+    final Version version = this.dataVersion;
+    if (version == null) {
+      // check for the case of diskstore upgrade from 6.6 to >= 7.0
+      if (getParent().isUpgradeVersionOnly()) {
+        // assume previous release version
+        return Version.GFE_66;
+      } else {
+        return null;
+      }
+    } else if (version == Version.CURRENT) {
+      return null;
+    } else {
+      // version changed so return that for VersionedDataStream
+      return version;
+    }
+  }
+
+  public enum OPLOG_TYPE {
+    CRF(new byte[] {0x47, 0x46, 0x43, 0x52, 0x46, 0x31}), // GFCRF1
+    DRF(new byte[] {0x47, 0x46, 0x44, 0x52, 0x46, 0x31}), // GFDRF1
+    IRF(new byte[] {0x47, 0x46, 0x49, 0x52, 0x46, 0x31}), // GFIRF1
+    KRF(new byte[] {0x47, 0x46, 0x4b, 0x52, 0x46, 0x31}), // GFKRF1
+    IF(new byte[] {0x47, 0x46, 0x49, 0x46, 0x30, 0x31}); // GFIF01
+
+    private final byte[] bytes;
+
+    OPLOG_TYPE(byte[] byteSeq) {
+      this.bytes = byteSeq;
+    }
+
+    public byte[] getBytes() {
+      return bytes;
+    }
+
+    public static int getLen() {
+      return 6;
+    }
+  }
+
+  /**
+   * Enumeration of the possible results of the okToSkipModifyRecord
+   */
+  private enum OkToSkipResult {
+    SKIP_RECORD, // Skip reading the key and value
+    SKIP_VALUE, // skip reading just the value
+    DONT_SKIP; // don't skip the record
+
+    public boolean skip() {
+      return this != DONT_SKIP;
+    }
+
+    public boolean skipKey() {
+      return this == SKIP_RECORD;
+    }
+
+  }
+
+  /**
+   * Used when creating a KRF to keep track of what DiskRegionView a DiskEntry 
belongs to.
+   */
+  private static class KRFEntry {
+    private final DiskEntry de;
+    private final DiskRegionView drv;
+    /**
+     * Fix for 42733 - a stable snapshot of the offset so we can sort It 
doesn't matter that this is
+     * stale, we'll filter out these entries later.
+     */
+    private final long offsetInOplog;
+    private VersionHolder versionTag;
+
+    public KRFEntry(DiskRegionView drv, DiskEntry de, VersionHolder tag) {
+      this.de = de;
+      this.drv = drv;
+      DiskId diskId = de.getDiskId();
+      this.offsetInOplog = diskId != null ? diskId.getOffsetInOplog() : 0;
+      this.versionTag = tag;
+    }
+
+    public DiskEntry getDiskEntry() {
+      return this.de;
+    }
+
+    public DiskRegionView getDiskRegionView() {
+      return this.drv;
+    }
+
+    public long getOffsetInOplogForSorting() {
+      return offsetInOplog;
+    }
+  }
+
+  private static class OplogFile {
+    public File f;
+    public UninterruptibleRandomAccessFile raf;
+    public volatile boolean RAFClosed = true;
+    public UninterruptibleFileChannel channel;
+    public ByteBuffer writeBuf;
+    public long currSize;
+    public long bytesFlushed;
+    public boolean unpreblown;
+  }
+
+  private static class KRFile {
+    public File f;
+    FileOutputStream fos;
+    BufferedOutputStream bos;
+    DataOutputStream dos;
+    long lastOffset = 0;
+    int keyNum = 0;
+  }
+
   /**
    * Holds all the state for the current operation. Since an oplog can only 
have one operation in
    * progress at any given time we only need a single instance of this class 
per oplog.
@@ -7300,7 +7386,7 @@ public class Oplog implements CompactableOplog, Flushable 
{
   /**
    * Used as the value in the regionMap. Tracks information about what the 
region has in this oplog.
    */
-  public interface DiskRegionInfo {
+  private interface DiskRegionInfo {
     DiskRegionView getDiskRegion();
 
     int addLiveEntriesToList(KRFEntry[] liveEntries, int idx);
@@ -7337,7 +7423,7 @@ public class Oplog implements CompactableOplog, Flushable 
{
     void afterKrfCreated();
   }
 
-  public abstract static class AbstractDiskRegionInfo implements 
DiskRegionInfo {
+  private abstract static class AbstractDiskRegionInfo implements 
DiskRegionInfo {
     private DiskRegionView dr;
     private boolean unrecovered = false;
 
@@ -7390,7 +7476,7 @@ public class Oplog implements CompactableOplog, Flushable 
{
     }
   }
 
-  public static class DiskRegionInfoNoList extends AbstractDiskRegionInfo {
+  private static class DiskRegionInfoNoList extends AbstractDiskRegionInfo {
     private final AtomicInteger liveCount = new AtomicInteger();
 
     public DiskRegionInfoNoList(DiskRegionView dr) {
@@ -7437,7 +7523,7 @@ public class Oplog implements CompactableOplog, Flushable 
{
     }
   }
 
-  public static class DiskRegionInfoWithList extends AbstractDiskRegionInfo {
+  private static class DiskRegionInfoWithList extends AbstractDiskRegionInfo {
     /**
      * A linked list of the live entries in this oplog. Updates to 
pendingKrfTags are protected by
      * synchronizing on object.
@@ -7618,7 +7704,7 @@ public class Oplog implements CompactableOplog, Flushable 
{
       return new Iterator();
     }
 
-    public class Iterator {
+    class Iterator {
       private boolean doingInt = true;
       ObjectIterator<Int2ObjectMap.Entry<?>> intIt = 
ints.int2ObjectEntrySet().fastIterator();
       ObjectIterator<Long2ObjectMap.Entry<?>> longIt = 
longs.long2ObjectEntrySet().fastIterator();
@@ -7660,74 +7746,6 @@ public class Oplog implements CompactableOplog, 
Flushable {
     }
   }
 
-  public void finishKrf() {
-    createKrf(false);
-  }
-
-  void prepareForClose() {
-    try {
-      finishKrf();
-    } catch (CancelException e) {
-      // workaround for 50465
-      if (logger.isDebugEnabled()) {
-        logger.debug("Got a cancel exception while creating a krf during 
shutown", e);
-      }
-    }
-  }
-
-  private Object deserializeKey(byte[] keyBytes, final Version version,
-      final ByteArrayDataInput in) {
-    if (!getParent().isOffline() || !PdxWriterImpl.isPdx(keyBytes)) {
-      return EntryEventImpl.deserialize(keyBytes, version, in);
-    } else {
-      return new RawByteKey(keyBytes);
-    }
-  }
-
-  /**
-   * If this OpLog is from an older version of the product, then return that 
{@link Version} else
-   * return null.
-   */
-  public Version getProductVersionIfOld() {
-    final Version version = this.gfversion;
-    if (version == null) {
-      // check for the case of diskstore upgrade from 6.6 to >= 7.0
-      if (getParent().isUpgradeVersionOnly()) {
-        // assume previous release version
-        return Version.GFE_66;
-      } else {
-        return null;
-      }
-    } else if (version == Version.CURRENT) {
-      return null;
-    } else {
-      // version changed so return that for VersionedDataStream
-      return version;
-    }
-  }
-
-  /**
-   * If this OpLog has data that was written by an older version of the 
product, then return that
-   * {@link Version} else return null.
-   */
-  public Version getDataVersionIfOld() {
-    final Version version = this.dataVersion;
-    if (version == null) {
-      // check for the case of diskstore upgrade from 6.6 to >= 7.0
-      if (getParent().isUpgradeVersionOnly()) {
-        // assume previous release version
-        return Version.GFE_66;
-      } else {
-        return null;
-      }
-    } else if (version == Version.CURRENT) {
-      return null;
-    } else {
-      // version changed so return that for VersionedDataStream
-      return version;
-    }
-  }
-
   /**
    * Used in offline mode to prevent pdx deserialization of keys. The raw 
bytes are a serialized
    * pdx.
@@ -7763,34 +7781,4 @@ public class Oplog implements CompactableOplog, 
Flushable {
 
   }
 
-  /**
-   * Enumeration of operation log file types.
-   *
-   */
-  enum OplogFileType {
-    OPLOG_CRF, // Creates and updates
-    OPLOG_DRF, // Deletes
-    OPLOG_KRF // Keys
-  }
-
-  /**
-   * Enumeration of the possible results of the okToSkipModifyRecord
-   *
-   *
-   */
-  private static enum OkToSkipResult {
-    SKIP_RECORD, // Skip reading the key and value
-    SKIP_VALUE, // skip reading just the value
-    DONT_SKIP; // don't skip the record
-
-    public boolean skip() {
-      return this != DONT_SKIP;
-    }
-
-    public boolean skipKey() {
-      return this == SKIP_RECORD;
-    }
-
-  }
-
 }
diff --git 
a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
 
b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
index 623d59f..6df6ea0 100644
--- 
a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
+++ 
b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
@@ -288,7 +288,6 @@ 
org/apache/geode/internal/cache/InitialImageOperation$GIITestHookType,false
 
org/apache/geode/internal/cache/LocalRegion$1,true,0,this$0:org/apache/geode/internal/cache/LocalRegion
 org/apache/geode/internal/cache/LocalRegion$IteratorType,false
 org/apache/geode/internal/cache/Oplog$OkToSkipResult,false
-org/apache/geode/internal/cache/Oplog$OplogFileType,false
 org/apache/geode/internal/cache/PartitionAttributesImpl,false
 org/apache/geode/internal/cache/PRContainsValueFunction,false
 
org/apache/geode/internal/cache/PRHARedundancyProvider$ArrayListWithClearState,true,1,wasCleared:boolean

Reply via email to