zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject svn commit: r1354326 - in /zookeeper/bookkeeper/trunk: CHANGES.txt bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
Date Wed, 27 Jun 2012 05:10:47 GMT
Author: sijie
Date: Wed Jun 27 05:10:46 2012
New Revision: 1354326

URL: http://svn.apache.org/viewvc?rev=1354326&view=rev
Log:
BOOKKEEPER-307: BookieShell introduces 4 findbugs warnings (ivank via sijie)

Modified:
    zookeeper/bookkeeper/trunk/CHANGES.txt
    zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
    zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java

Modified: zookeeper/bookkeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/CHANGES.txt?rev=1354326&r1=1354325&r2=1354326&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/CHANGES.txt (original)
+++ zookeeper/bookkeeper/trunk/CHANGES.txt Wed Jun 27 05:10:46 2012
@@ -22,6 +22,8 @@ Trunk (unreleased changes)
 
         BOOKKEEPER-183: Provide tools to read/check data files in bookie server (sijie via
ivank)
 
+        BOOKKEEPER-307: BookieShell introduces 4 findbugs warnings (ivank via sijie)
+
       hedwig-client:
 
         BOOKKEEPER-274: Hedwig cpp client library should not link to cppunit which is just
used for test. (sijie via ivank)

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java?rev=1354326&r1=1354325&r2=1354326&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
(original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
Wed Jun 27 05:10:46 2012
@@ -21,11 +21,9 @@ package org.apache.bookkeeper.bookie;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.io.RandomAccessFile;
 import java.nio.ByteBuffer;
 import java.util.Formatter;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 import org.apache.bookkeeper.bookie.EntryLogger.EntryLogScanner;
@@ -35,7 +33,6 @@ import org.apache.bookkeeper.conf.Server
 import org.apache.bookkeeper.util.EntryFormatter;
 import org.apache.bookkeeper.util.Tool;
 import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.CompositeConfiguration;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.commons.cli.BasicParser;
@@ -473,10 +470,11 @@ public class BookieShell implements Tool
         entryLogger.scanEntryLog(logId, scanner);
     }
 
-    private synchronized void initJournal() throws IOException {
+    private synchronized Journal getJournal() throws IOException {
         if (null == journal) {
             journal = new Journal(bkConf);
         }
+        return journal;
     }
 
     /**
@@ -488,8 +486,7 @@ public class BookieShell implements Tool
      *          Journal File Scanner
      */
     protected void scanJournal(long journalId, JournalScanner scanner) throws IOException
{
-        initJournal();
-        journal.scanJournal(journalId, 0L, scanner);
+        getJournal().scanJournal(journalId, 0L, scanner);
     }
 
     ///
@@ -617,11 +614,10 @@ public class BookieShell implements Tool
      * Print last log mark
      */
     protected void printLastLogMark() throws IOException {
-        initJournal();
-        LastLogMark lastLogMark = journal.getLastLogMark();
-        System.out.println("LastLogMark: Journal Id - " + lastLogMark.txnLogId + "("
-                         + Long.toHexString(lastLogMark.txnLogId) + ".txn), Pos - "
-                         + lastLogMark.txnLogPosition);
+        LastLogMark lastLogMark = getJournal().getLastLogMark();
+        System.out.println("LastLogMark: Journal Id - " + lastLogMark.getTxnLogId() + "("
+                + Long.toHexString(lastLogMark.getTxnLogId()) + ".txn), Pos - "
+                + lastLogMark.getTxnLogPosition());
     }
 
     /**
@@ -652,7 +648,6 @@ public class BookieShell implements Tool
         }
         // process a data entry
         long lastAddConfirmed = recBuff.getLong();
-        long length = recBuff.getLong();
         System.out.println("Type:           DATA");
         System.out.println("LastConfirmed:  " + lastAddConfirmed);
         if (!printMsg) {

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java?rev=1354326&r1=1354325&r2=1354326&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
(original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
Wed Jun 27 05:10:46 2012
@@ -85,9 +85,9 @@ class Journal extends Thread {
      * Last Log Mark
      */
     class LastLogMark {
-        long txnLogId;
-        long txnLogPosition;
-        LastLogMark lastMark;
+        private long txnLogId;
+        private long txnLogPosition;
+        private LastLogMark lastMark;
         LastLogMark(long logId, long logPosition) {
             this.txnLogId = logId;
             this.txnLogPosition = logPosition;



Mime
View raw message