Author: ecn
Date: Wed May 2 14:54:09 2012
New Revision: 1333070
URL: http://svn.apache.org/viewvc?rev=1333070&view=rev
Log:
ACCUMULO-49 parse out the newline, do not repeat the constant for the proc
filename
Modified:
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/Accumulo.java
Modified:
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/Accumulo.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/Accumulo.java?rev=1333070&r1=1333069&r2=1333070&view=diff
==============================================================================
---
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/Accumulo.java
(original)
+++
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/Accumulo.java
Wed May 2 14:54:09 2012
@@ -145,13 +145,15 @@ public class Accumulo {
@Override
public void run() {
try {
- File swappiness = new File("/proc/sys/vm/swappiness");
+ String procFile = "/proc/sys/vm/swappiness";
+ File swappiness = new File(procFile);
if (swappiness.exists() && swappiness.canRead()) {
- InputStream is = new FileInputStream("/proc/sys/vm/swappiness");
+ InputStream is = new FileInputStream(procFile);
try {
byte[] buffer = new byte[10];
int bytes = is.read(buffer);
String setting = new String(buffer, 0, bytes);
+ setting = setting.trim();
if (bytes > 0 && Integer.parseInt(setting) > 0) {
log.warn("System swappiness setting is greater than zero (" +
setting + ") which can cause time-sensitive operations to be delayed. "
+ " Accumulo is time sensitive because it needs to
maintain distributed lock agreement.");