cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1030160 - in /cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra: io/util/FileUtils.java utils/FBUtilities.java
Date Tue, 02 Nov 2010 18:27:48 GMT
Author: jbellis
Date: Tue Nov  2 18:27:47 2010
New Revision: 1030160

URL: http://svn.apache.org/viewvc?rev=1030160&view=rev
Log:
invert instanceof check of LastErrorException to make slightly cleaner and more copy-paste
friendly.  patch by jbellis

Modified:
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/util/FileUtils.java
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/utils/FBUtilities.java

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/util/FileUtils.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/util/FileUtils.java?rev=1030160&r1=1030159&r2=1030160&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/util/FileUtils.java
(original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/util/FileUtils.java
Tue Nov  2 18:27:47 2010
@@ -214,14 +214,12 @@ public class FileUtils
         }
         catch (RuntimeException e)
         {
-            if (e instanceof LastErrorException)
-            {
-                // there are 17 different error codes listed on the man page.  punt until/unless
we find which
-                // ones actually turn up in practice.
-                throw new IOException(String.format("Unable to create hard link from %s to
%s (errno %d)",
-                                                    sourceFile, destinationFile, CLibrary.errno(e)));
-            }
-            throw e;
+            if (!(e instanceof LastErrorException))
+                throw e;
+            // there are 17 different error codes listed on the man page.  punt until/unless
we find which
+            // ones actually turn up in practice.
+            throw new IOException(String.format("Unable to create hard link from %s to %s
(errno %d)",
+                                                sourceFile, destinationFile, CLibrary.errno(e)));
         }
     }
 

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/utils/FBUtilities.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/utils/FBUtilities.java?rev=1030160&r1=1030159&r2=1030160&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/utils/FBUtilities.java
(original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/utils/FBUtilities.java
Tue Nov  2 18:27:47 2010
@@ -565,21 +565,19 @@ public class FBUtilities
         }
         catch (RuntimeException e)
         {
-            if (e instanceof LastErrorException)
+            if (!(e instanceof LastErrorException))
+                throw e;
+            if (CLibrary.errno(e) == CLibrary.ENOMEM && System.getProperty("os.name").toLowerCase().contains("linux"))
             {
-                if (CLibrary.errno(e) == CLibrary.ENOMEM && System.getProperty("os.name").toLowerCase().contains("linux"))
-                {
-                    logger_.warn("Unable to lock JVM memory (ENOMEM)."
-                                 + " This can result in part of the JVM being swapped out,
especially with mmapped I/O enabled."
-                                 + " Increase RLIMIT_MEMLOCK or run Cassandra as root.");
-                }
-                else if (!System.getProperty("os.name").toLowerCase().contains("mac"))
-                {
-                    // OS X allows mlockall to be called, but always returns an error
-                    logger_.warn("Unknown mlockall error " + CLibrary.errno(e));
-                }
+                logger_.warn("Unable to lock JVM memory (ENOMEM)."
+                             + " This can result in part of the JVM being swapped out, especially
with mmapped I/O enabled."
+                             + " Increase RLIMIT_MEMLOCK or run Cassandra as root.");
+            }
+            else if (!System.getProperty("os.name").toLowerCase().contains("mac"))
+            {
+                // OS X allows mlockall to be called, but always returns an error
+                logger_.warn("Unknown mlockall error " + CLibrary.errno(e));
             }
-            throw e;
         }
     }
 }



Mime
View raw message