You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by vi...@apache.org on 2011/10/27 17:25:17 UTC
svn commit: r1189806 [27/46] - in /incubator/accumulo: branches/1.3/contrib/
branches/1.3/src/core/src/main/java/org/apache/accumulo/core/client/
branches/1.3/src/core/src/main/java/org/apache/accumulo/core/client/admin/
branches/1.3/src/core/src/main/...
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java Thu Oct 27 15:24:51 2011
@@ -46,7 +46,8 @@ abstract class Basic extends BasicServle
public static int getIntParameter(HttpServletRequest req, String name, int defaultMinutes) {
String valueString = req.getParameter(name);
- if (valueString == null) return defaultMinutes;
+ if (valueString == null)
+ return defaultMinutes;
int result = 0;
try {
result = Integer.parseInt(valueString);
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/ListType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/ListType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/ListType.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/ListType.java Thu Oct 27 15:24:51 2011
@@ -49,7 +49,8 @@ public class ListType extends Basic {
private static class ShowTraceLinkType extends StringType<RemoteSpan> {
public String format(Object obj) {
- if (obj == null) return "-";
+ if (obj == null)
+ return "-";
RemoteSpan span = (RemoteSpan) obj;
return String.format("<a href='/trace/show?id=%s'>%s</a>", Long.toHexString(span.traceId), TraceFormatter.DATE_FORMAT.format(new Date(span.start)));
}
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/ShowTrace.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/ShowTrace.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/ShowTrace.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/ShowTrace.java Thu Oct 27 15:24:51 2011
@@ -49,7 +49,8 @@ public class ShowTrace extends Basic {
@Override
public String getTitle(HttpServletRequest req) {
String id = getTraceId(req);
- if (id == null) return "No trace id specified";
+ if (id == null)
+ return "No trace id specified";
return "Trace ID " + id;
}
@@ -101,8 +102,10 @@ public class ShowTrace extends Basic {
sb.append(String.format("<td style='text-indent: %dpx'>%s@%s</td>\n", level * 5, node.svc, node.sender));
sb.append("<td>" + node.description + "</td>");
boolean hasData = node.data != null && !node.data.isEmpty();
- if (hasData) sb.append("<td><input type='checkbox' onclick='toggle(\"" + Long.toHexString(node.spanId) + "\")'></td>\n");
- else sb.append("<td></td>\n");
+ if (hasData)
+ sb.append("<td><input type='checkbox' onclick='toggle(\"" + Long.toHexString(node.spanId) + "\")'></td>\n");
+ else
+ sb.append("<td></td>\n");
sb.append("</tr>\n");
sb.append("<tr id='" + Long.toHexString(node.spanId) + "' style='display:none'>");
sb.append("<td colspan='5'>\n");
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Summary.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Summary.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Summary.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Summary.java Thu Oct 27 15:24:51 2011
@@ -85,7 +85,8 @@ public class Summary extends Basic {
}
public String format(Object obj) {
- if (obj == null) return "-";
+ if (obj == null)
+ return "-";
String type = obj.toString();
String encodedType = BasicServlet.encode(type);
return String.format("<a href='/trace/listType?type=%s&minutes=%d'>%s</a>", encodedType, minutes, type);
@@ -99,8 +100,10 @@ public class Summary extends Basic {
sb.append("<table>");
sb.append("<tr>");
for (long count : stat.histogram) {
- if (count > 0) sb.append(String.format("<td style='width:5em'>%d</td>", count));
- else sb.append("<td style='width:5em'>-</td>");
+ if (count > 0)
+ sb.append(String.format("<td style='width:5em'>%d</td>", count));
+ else
+ sb.append("<td style='width:5em'>-</td>");
}
sb.append("</tr></table>");
return sb.toString();
@@ -110,8 +113,10 @@ public class Summary extends Basic {
public int compare(Stats o1, Stats o2) {
for (int i = 0; i < o1.histogram.length; i++) {
long diff = o1.histogram[i] - o2.histogram[i];
- if (diff < 0) return -1;
- if (diff > 0) return 1;
+ if (diff < 0)
+ return -1;
+ if (diff > 0)
+ return 1;
}
return 0;
}
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/Table.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/Table.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/Table.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/Table.java Thu Oct 27 15:24:51 2011
@@ -53,12 +53,14 @@ public class Table {
}
public synchronized <T> void addColumn(TableColumn<T> column) {
- if (hasBegunAddingRows) throw new IllegalStateException("Cannot add more columns newServer rows have been added");
+ if (hasBegunAddingRows)
+ throw new IllegalStateException("Cannot add more columns newServer rows have been added");
columns.add(column);
}
private synchronized <T> void addColumn(String title, CellType<T> type, String legend, boolean sortable) {
- if (type == null) type = new StringType<T>();
+ if (type == null)
+ type = new StringType<T>();
type.setSortable(sortable);
addColumn(new TableColumn<T>(title, type, legend));
}
@@ -86,13 +88,15 @@ public class Table {
public synchronized void addRow(TableRow row) {
hasBegunAddingRows = true;
- if (columns.size() != row.size()) throw new IllegalStateException("Row must be the same size as the columns");
+ if (columns.size() != row.size())
+ throw new IllegalStateException("Row must be the same size as the columns");
rows.add(row);
}
public synchronized void addRow(Object... cells) {
TableRow row = prepareRow();
- if (cells.length != columns.size()) throw new IllegalArgumentException("Argument length not equal to the number of columns");
+ if (cells.length != columns.size())
+ throw new IllegalArgumentException("Argument length not equal to the number of columns");
for (Object cell : cells)
row.add(cell);
addRow(row);
@@ -100,20 +104,25 @@ public class Table {
public synchronized void generate(HttpServletRequest req, StringBuilder sb) {
String page = req.getRequestURI();
- if (columns.isEmpty()) throw new IllegalStateException("No columns in table");
+ if (columns.isEmpty())
+ throw new IllegalStateException("No columns in table");
for (TableRow row : rows)
- if (row.size() != columns.size()) throw new RuntimeException("Each row must have the same number of columns");
+ if (row.size() != columns.size())
+ throw new RuntimeException("Each row must have the same number of columns");
boolean sortAscending = true;
Cookie c = BasicServlet.getCookie(req, "tableSort." + page + "." + table + "." + "sortAsc");
- if (c != null && "false".equals(c.getValue())) sortAscending = false;
+ if (c != null && "false".equals(c.getValue()))
+ sortAscending = false;
int sortCol = -1; // set to first sortable column by default
int numLegends = 0;
for (int i = 0; i < columns.size(); ++i) {
TableColumn<?> col = columns.get(i);
- if (sortCol < 0 && col.getCellType().isSortable()) sortCol = i;
- if (col.getLegend() != null && !col.getLegend().isEmpty()) ++numLegends;
+ if (sortCol < 0 && col.getCellType().isSortable())
+ sortCol = i;
+ if (col.getLegend() != null && !col.getLegend().isEmpty())
+ ++numLegends;
}
// only get cookie if there is a possibility that it is sortable
@@ -123,7 +132,8 @@ public class Table {
try {
int col = Integer.parseInt(c.getValue());
// only bother if specified column is sortable
- if (!(col < 0 || sortCol >= columns.size()) && columns.get(col).getCellType().isSortable()) sortCol = col;
+ if (!(col < 0 || sortCol >= columns.size()) && columns.get(col).getCellType().isSortable())
+ sortCol = col;
} catch (NumberFormatException e) {
// ignore improperly formatted user cookie
}
@@ -140,16 +150,20 @@ public class Table {
sb.append("<a name='").append(table).append("'> </a>\n");
sb.append("<table id='").append(table).append("' class='sortable'>\n");
sb.append("<caption");
- if (captionclass != null && !captionclass.isEmpty()) sb.append(" class='").append(captionclass).append("'");
+ if (captionclass != null && !captionclass.isEmpty())
+ sb.append(" class='").append(captionclass).append("'");
sb.append(">\n");
- if (caption != null && !caption.isEmpty()) sb.append("<span class='table-caption'>").append(caption).append("</span><br />\n");
- if (subcaption != null && !subcaption.isEmpty()) sb.append("<span class='table-subcaption'>").append(subcaption).append("</span><br />\n");
+ if (caption != null && !caption.isEmpty())
+ sb.append("<span class='table-caption'>").append(caption).append("</span><br />\n");
+ if (subcaption != null && !subcaption.isEmpty())
+ sb.append("<span class='table-subcaption'>").append(subcaption).append("</span><br />\n");
String redir = BasicServlet.currentPage(req);
if (numLegends > 0) {
String legendUrl = String.format("/op?action=toggleLegend&redir=%s&page=%s&table=%s&show=%s", redir, page, table, !showLegend);
sb.append("<a href='").append(legendUrl).append("'>").append(showLegend ? "Hide" : "Show").append(" Legend</a>\n");
- if (showLegend) sb.append("<div class='left ").append(showLegend ? "show" : "hide").append("'><dl>\n");
+ if (showLegend)
+ sb.append("<div class='left ").append(showLegend ? "show" : "hide").append("'><dl>\n");
}
for (int i = 0; i < columns.size(); ++i) {
TableColumn<?> col = columns.get(i);
@@ -158,15 +172,16 @@ public class Table {
String url = String.format("/op?action=sortTable&redir=%s&page=%s&table=%s&%s=%s", redir, page, table, sortCol == i ? "asc" : "col",
sortCol == i ? !sortAscending : i);
String img = "";
- if (sortCol == i) img = String.format(" <img width='10px' height='10px' src='/web/%s.gif' alt='%s' />", sortAscending ? "up" : "down",
- !sortAscending ? "^" : "v");
+ if (sortCol == i)
+ img = String.format(" <img width='10px' height='10px' src='/web/%s.gif' alt='%s' />", sortAscending ? "up" : "down", !sortAscending ? "^" : "v");
col.setTitle(String.format("<a href='%s'>%s%s</a>", url, title, img));
}
String legend = col.getLegend();
- if (showLegend && legend != null && !legend.isEmpty()) sb.append("<dt class='smalltext'><b>").append(title.replace("<br />", " "))
- .append("</b><dd>").append(legend).append("</dd></dt>\n");
+ if (showLegend && legend != null && !legend.isEmpty())
+ sb.append("<dt class='smalltext'><b>").append(title.replace("<br />", " ")).append("</b><dd>").append(legend).append("</dd></dt>\n");
}
- if (showLegend && numLegends > 0) sb.append("</dl></div>\n");
+ if (showLegend && numLegends > 0)
+ sb.append("</dl></div>\n");
sb.append("</caption>\n");
sb.append("<tr>");
boolean first = true;
@@ -179,7 +194,8 @@ public class Table {
// don't sort if no columns are sortable or if there aren't enough rows
if (rows.size() > 1 && sortCol > -1) {
Collections.sort(rows, TableRow.getComparator(sortCol, columns.get(sortCol).getCellType()));
- if (!sortAscending) Collections.reverse(rows);
+ if (!sortAscending)
+ Collections.reverse(rows);
}
boolean highlight = true;
for (TableRow row : rows) {
@@ -193,7 +209,8 @@ public class Table {
row(sb, highlight, columns, row);
highlight = !highlight;
}
- if (rows.isEmpty()) sb.append("<tr><td class='center' colspan='").append(columns.size()).append("'><i>Empty</i></td></tr>\n");
+ if (rows.isEmpty())
+ sb.append("<tr><td class='center' colspan='").append(columns.size()).append("'><i>Empty</i></td></tr>\n");
sb.append("</table>\n</div>\n\n");
}
@@ -202,9 +219,11 @@ public class Table {
boolean first = true;
for (int i = 0; i < row.size(); ++i) {
String cellValue = String.valueOf(row.get(i)).trim();
- if (cellValue.isEmpty() || cellValue.equals(String.valueOf((Object) null))) cellValue = "-";
+ if (cellValue.isEmpty() || cellValue.equals(String.valueOf((Object) null)))
+ cellValue = "-";
sb.append("<td class='").append(first ? "firstcell" : "");
- if (columns.get(i).getCellType().alignment() != null) sb.append(first ? " " : "").append(columns.get(i).getCellType().alignment());
+ if (columns.get(i).getCellType().alignment() != null)
+ sb.append(first ? " " : "").append(columns.get(i).getCellType().alignment());
sb.append("'>").append(cellValue).append("</td>");
first = false;
}
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/TableRow.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/TableRow.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/TableRow.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/TableRow.java Thu Oct 27 15:24:51 2011
@@ -29,7 +29,8 @@ public class TableRow {
}
public boolean add(Object obj) {
- if (row.size() == size) throw new IllegalStateException("Row is full.");
+ if (row.size() == size)
+ throw new IllegalStateException("Row is full.");
return row.add(obj);
}
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/CompactionsType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/CompactionsType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/CompactionsType.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/CompactionsType.java Thu Oct 27 15:24:51 2011
@@ -29,11 +29,14 @@ public class CompactionsType extends Cel
@Override
public String format(Object obj) {
- if (obj == null) return "-";
+ if (obj == null)
+ return "-";
TableInfo summary = (TableInfo) obj;
Compacting c = summary.major;
- if (fieldName.equals("minor")) c = summary.minor;
- if (c == null) c = new Compacting();
+ if (fieldName.equals("minor"))
+ c = summary.minor;
+ if (c == null)
+ c = new Compacting();
return String.format("%s (%,d)", NumberType.commas(c.running, c.queued == 0 ? 0 : 1, summary.onlineTablets), c.queued);
}
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/DateTimeType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/DateTimeType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/DateTimeType.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/DateTimeType.java Thu Oct 27 15:24:51 2011
@@ -38,18 +38,24 @@ public class DateTimeType extends CellTy
@Override
public String format(Object obj) {
- if (obj == null) return "-";
+ if (obj == null)
+ return "-";
Long millis = (Long) obj;
- if (millis == 0) return "-";
- if (simple != null) return simple.format(new Date(millis)).replace(" ", " ");
+ if (millis == 0)
+ return "-";
+ if (simple != null)
+ return simple.format(new Date(millis)).replace(" ", " ");
return DateFormat.getDateTimeInstance(dateFormat, timeFormat, Locale.getDefault()).format(new Date(millis)).replace(" ", " ");
}
@Override
public int compare(Long o1, Long o2) {
- if (o1 == null && o2 == null) return 0;
- else if (o1 == null) return -1;
- else return o1.compareTo(o2);
+ if (o1 == null && o2 == null)
+ return 0;
+ else if (o1 == null)
+ return -1;
+ else
+ return o1.compareTo(o2);
}
@Override
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/DurationType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/DurationType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/DurationType.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/DurationType.java Thu Oct 27 15:24:51 2011
@@ -33,15 +33,18 @@ public class DurationType extends Number
@Override
public String format(Object obj) {
- if (obj == null) return "-";
+ if (obj == null)
+ return "-";
Long millis = (Long) obj;
- if (errMin != null && errMax != null) return seconds(millis, errMin, errMax);
+ if (errMin != null && errMax != null)
+ return seconds(millis, errMin, errMax);
return Duration.format(millis);
}
private static String seconds(long secs, long errMin, long errMax) {
String numbers = Duration.format(secs);
- if (secs < errMin || secs > errMax) return "<span class='error'>" + numbers + "</span>";
+ if (secs < errMin || secs > errMax)
+ return "<span class='error'>" + numbers + "</span>";
return numbers;
}
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/LoggerLinkType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/LoggerLinkType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/LoggerLinkType.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/LoggerLinkType.java Thu Oct 27 15:24:51 2011
@@ -25,13 +25,15 @@ public class LoggerLinkType extends Cell
@Override
public String format(Object obj) {
- if (obj == null) return "-";
+ if (obj == null)
+ return "-";
RecoveryStatus status = (RecoveryStatus) obj;
return String.format("<a href='/loggers?s=%s'>%s</a>", status.host, displayName(status));
}
public static String displayName(RecoveryStatus status) {
- if (status.host == null) return "--Unknown--";
+ if (status.host == null)
+ return "--Unknown--";
InetSocketAddress monitorAddress = AddressUtil.parseAddress(status.host, 0);
return monitorAddress.getHostName() + ":" + monitorAddress.getPort();
}
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/NumberType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/NumberType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/NumberType.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/NumberType.java Thu Oct 27 15:24:51 2011
@@ -41,27 +41,36 @@ public class NumberType<T extends Number
T number = (T) obj;
String s = "-";
if (number instanceof Double || number instanceof Float) {
- if (warnMin != null && warnMax != null && errMin != null && errMax != null) s = commas(number.doubleValue(), warnMin.doubleValue(),
- warnMax.doubleValue(), errMin.doubleValue(), errMax.doubleValue());
- else if (errMin != null && errMax != null) s = commas(number.doubleValue(), errMin.doubleValue(), errMax.doubleValue());
- else s = commas(number.doubleValue());
+ if (warnMin != null && warnMax != null && errMin != null && errMax != null)
+ s = commas(number.doubleValue(), warnMin.doubleValue(), warnMax.doubleValue(), errMin.doubleValue(), errMax.doubleValue());
+ else if (errMin != null && errMax != null)
+ s = commas(number.doubleValue(), errMin.doubleValue(), errMax.doubleValue());
+ else
+ s = commas(number.doubleValue());
} else if (number instanceof Long || number instanceof Integer || number instanceof Short || number instanceof Byte) {
- if (warnMin != null && warnMax != null && errMin != null && errMax != null) s = commas(number.longValue(), warnMin.longValue(), warnMax.longValue(),
- errMin.longValue(), errMax.longValue());
- else if (errMin != null && errMax != null) s = commas(number.longValue(), errMin.longValue(), errMax.longValue());
- else s = commas(number.longValue());
+ if (warnMin != null && warnMax != null && errMin != null && errMax != null)
+ s = commas(number.longValue(), warnMin.longValue(), warnMax.longValue(), errMin.longValue(), errMax.longValue());
+ else if (errMin != null && errMax != null)
+ s = commas(number.longValue(), errMin.longValue(), errMax.longValue());
+ else
+ s = commas(number.longValue());
} else {
- if (number != null) s = String.valueOf(number);
+ if (number != null)
+ s = String.valueOf(number);
}
return s;
}
@Override
public int compare(T o1, T o2) {
- if (o1 == null && o2 == null) return 0;
- else if (o1 == null) return -1;
- else if (o2 == null) return 1;
- else return Double.valueOf(o1.doubleValue()).compareTo(o2.doubleValue());
+ if (o1 == null && o2 == null)
+ return 0;
+ else if (o1 == null)
+ return -1;
+ else if (o2 == null)
+ return 1;
+ else
+ return Double.valueOf(o1.doubleValue()).compareTo(o2.doubleValue());
}
public static String commas(long i) {
@@ -69,7 +78,8 @@ public class NumberType<T extends Number
}
public static String commas(long i, long errMin, long errMax) {
- if (i < errMin || i > errMax) return String.format("<span class='error'>%s</span>", bigNumber(i));
+ if (i < errMin || i > errMax)
+ return String.format("<span class='error'>%s</span>", bigNumber(i));
return bigNumber(i);
}
@@ -78,19 +88,24 @@ public class NumberType<T extends Number
}
public static String commas(double d, double errMin, double errMax) {
- if (d < errMin || d > errMax) return String.format("<span class='error'>%s</span>", bigNumber(d));
+ if (d < errMin || d > errMax)
+ return String.format("<span class='error'>%s</span>", bigNumber(d));
return bigNumber(d);
}
public static String commas(long i, long warnMin, long warnMax, long errMin, long errMax) {
- if (i < errMin || i > errMax) return String.format("<span class='error'>%s</span>", bigNumber(i));
- if (i < warnMin || i > warnMax) return String.format("<span class='warning'>%s</span>", bigNumber(i));
+ if (i < errMin || i > errMax)
+ return String.format("<span class='error'>%s</span>", bigNumber(i));
+ if (i < warnMin || i > warnMax)
+ return String.format("<span class='warning'>%s</span>", bigNumber(i));
return bigNumber(i);
}
public static String commas(double d, double warnMin, double warnMax, double errMin, double errMax) {
- if (d < errMin || d > errMax) return String.format("<span class='error'>%s</span>", bigNumber(d));
- if (d < warnMin || d > warnMax) return String.format("<span class='warning'>%s</span>", bigNumber(d));
+ if (d < errMin || d > errMax)
+ return String.format("<span class='error'>%s</span>", bigNumber(d));
+ if (d < warnMin || d > warnMax)
+ return String.format("<span class='warning'>%s</span>", bigNumber(d));
return bigNumber(d);
}
@@ -108,7 +123,8 @@ public class NumberType<T extends Number
float divisor = 1;
for (int i = 0; i < SUFFIXES.length; i++) {
if (big / divisor < 1024) {
- if (i == 0) return String.format("%,d", big);
+ if (i == 0)
+ return String.format("%,d", big);
return String.format("%,.2f%s", big / divisor, SUFFIXES[i]);
}
divisor *= base;
@@ -119,7 +135,8 @@ public class NumberType<T extends Number
public static String bigNumber(double big, String[] SUFFIXES, long base) {
float divisor = 1;
for (int i = 0; i < SUFFIXES.length; i++) {
- if (big / divisor < 1024) return String.format("%,.2f%s", big / divisor, SUFFIXES[i]);
+ if (big / divisor < 1024)
+ return String.format("%,.2f%s", big / divisor, SUFFIXES[i]);
divisor *= base;
}
return String.format("%,.2f%s", big / divisor, SUFFIXES[SUFFIXES.length - 1]);
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/ProgressChartType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/ProgressChartType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/ProgressChartType.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/ProgressChartType.java Thu Oct 27 15:24:51 2011
@@ -30,7 +30,8 @@ public class ProgressChartType extends N
@Override
public String format(Object obj) {
- if (obj == null) return "-";
+ if (obj == null)
+ return "-";
Double num = (Double) obj;
return getChart(num, max);
}
@@ -38,12 +39,16 @@ public class ProgressChartType extends N
public static String getChart(double num, double total) {
StringBuilder result = new StringBuilder();
double percent = 0;
- if (total != 0) percent = (num / total) * 100;
+ if (total != 0)
+ percent = (num / total) * 100;
int width = 0;
- if (percent < 1) width = 0;
- else if (percent > 100) width = 100;
- else width = (int) percent;
+ if (percent < 1)
+ width = 0;
+ else if (percent > 100)
+ width = 100;
+ else
+ width = (int) percent;
result.append("<div class='progress-chart'>");
result.append("<div style='width: ").append(width).append("%;'></div>");
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/StringType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/StringType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/StringType.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/StringType.java Thu Oct 27 15:24:51 2011
@@ -24,9 +24,12 @@ public class StringType<T> extends CellT
@Override
public int compare(T o1, T o2) {
- if (o1 == null && o2 == null) return 0;
- else if (o1 == null) return -1;
- else if (o2 == null) return 1;
+ if (o1 == null && o2 == null)
+ return 0;
+ else if (o1 == null)
+ return -1;
+ else if (o2 == null)
+ return 1;
return o1.toString().compareTo(o2.toString());
}
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TServerLinkType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TServerLinkType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TServerLinkType.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TServerLinkType.java Thu Oct 27 15:24:51 2011
@@ -25,13 +25,15 @@ public class TServerLinkType extends Cel
@Override
public String format(Object obj) {
- if (obj == null) return "-";
+ if (obj == null)
+ return "-";
TabletServerStatus status = (TabletServerStatus) obj;
return String.format("<a href='/tservers?s=%s'>%s</a>", status.name, displayName(status));
}
public static String displayName(TabletServerStatus status) {
- if (status.name == null) return "--Unknown--";
+ if (status.name == null)
+ return "--Unknown--";
InetSocketAddress address = AddressUtil.parseAddress(status.name, 0);
return address.getHostName() + ":" + address.getPort();
}
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableLinkType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableLinkType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableLinkType.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableLinkType.java Thu Oct 27 15:24:51 2011
@@ -31,13 +31,15 @@ public class TableLinkType extends CellT
@Override
public String format(Object obj) {
- if (obj == null) return "-";
+ if (obj == null)
+ return "-";
String tableId = (String) obj;
return String.format("<a href='/tables?t=%s'>%s</a>", tableId, displayName(tableId));
}
private String displayName(String tableId) {
- if (tableId == null) return "-";
+ if (tableId == null)
+ return "-";
return Tables.getPrintableTableNameFromId(tidToNameMap, tableId);
}
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableStateType.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableStateType.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableStateType.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableStateType.java Thu Oct 27 15:24:51 2011
@@ -51,8 +51,10 @@ public class TableStateType extends Cell
@Override
public int compare(TableState o1, TableState o2) {
- if (o1 == null && o2 == null) return 0;
- else if (o1 == null) return -1;
+ if (o1 == null && o2 == null)
+ return 0;
+ else if (o1 == null)
+ return -1;
return o1.compareTo(o2);
}
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java Thu Oct 27 15:24:51 2011
@@ -168,7 +168,8 @@ public class ProblemReports implements I
delMut.putDelete(entry.getKey().getColumnFamily(), entry.getKey().getColumnQualifier());
}
- if (hasProblems) MetadataTable.getMetadataTable(SecurityConstants.systemCredentials).update(delMut);
+ if (hasProblems)
+ MetadataTable.getMetadataTable(SecurityConstants.systemCredentials).update(delMut);
}
public Iterator<ProblemReport> iterator(final String table) {
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java Thu Oct 27 15:24:51 2011
@@ -72,7 +72,8 @@ public class SecurityConstants {
* @return RESERVED if the passwords match, otherwise a state that describes the failure state
*/
public static TabletServerState compareSystemPassword(byte[] base64encodedPassword) {
- if (Arrays.equals(SYSTEM_PASSWORD, base64encodedPassword)) return TabletServerState.RESERVED;
+ if (Arrays.equals(SYSTEM_PASSWORD, base64encodedPassword))
+ return TabletServerState.RESERVED;
// parse to determine why
byte[] decodedPassword = Base64.decodeBase64(base64encodedPassword);
@@ -90,7 +91,8 @@ public class SecurityConstants {
buff = new byte[in.readInt()];
in.readFully(buff);
confFails = !Arrays.equals(buff, getSystemConfigChecksum());
- if (in.available() > 0) throw new IOException();
+ if (in.available() > 0)
+ throw new IOException();
} catch (IOException e) {
return TabletServerState.BAD_SYSTEM_PASSWORD;
} catch (NoSuchAlgorithmException e) {
@@ -101,10 +103,12 @@ public class SecurityConstants {
// nested ternary conditionals, but
// this is more readable; no fun :/
if (versionFails) {
- if (instanceFails) return confFails ? TabletServerState.BAD_VERSION_AND_INSTANCE_AND_CONFIG : TabletServerState.BAD_VERSION_AND_INSTANCE;
+ if (instanceFails)
+ return confFails ? TabletServerState.BAD_VERSION_AND_INSTANCE_AND_CONFIG : TabletServerState.BAD_VERSION_AND_INSTANCE;
return confFails ? TabletServerState.BAD_VERSION_AND_CONFIG : TabletServerState.BAD_VERSION;
}
- if (instanceFails) return confFails ? TabletServerState.BAD_INSTANCE_AND_CONFIG : TabletServerState.BAD_INSTANCE;
+ if (instanceFails)
+ return confFails ? TabletServerState.BAD_INSTANCE_AND_CONFIG : TabletServerState.BAD_INSTANCE;
return confFails ? TabletServerState.BAD_CONFIG : TabletServerState.BAD_SYSTEM_PASSWORD;
}
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java Thu Oct 27 15:24:51 2011
@@ -62,7 +62,8 @@ public final class ZKAuthenticator imple
private final ZooCache zooCache;
public static synchronized ZKAuthenticator getInstance() {
- if (zkAuthenticatorInstance == null) zkAuthenticatorInstance = new ZKAuthenticator();
+ if (zkAuthenticatorInstance == null)
+ zkAuthenticatorInstance = new ZKAuthenticator();
return zkAuthenticatorInstance;
}
@@ -82,15 +83,17 @@ public final class ZKAuthenticator imple
* @throws AccumuloSecurityException
*/
private boolean authenticate(AuthInfo credentials) throws AccumuloSecurityException {
- if (!credentials.instanceId.equals(HdfsZooInstance.getInstance().getInstanceID())) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.INVALID_INSTANCEID);
+ if (!credentials.instanceId.equals(HdfsZooInstance.getInstance().getInstanceID()))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.INVALID_INSTANCEID);
- if (credentials.user.equals(SecurityConstants.SYSTEM_USERNAME)) return credentials.equals(SecurityConstants.systemCredentials);
+ if (credentials.user.equals(SecurityConstants.SYSTEM_USERNAME))
+ return credentials.equals(SecurityConstants.systemCredentials);
byte[] pass;
String zpath = ZKUserPath + "/" + credentials.user;
pass = zooCache.get(zpath);
- if (pass == null) return false;
+ if (pass == null)
+ return false;
return Tool.checkPass(credentials.password, pass);
}
@@ -98,8 +101,8 @@ public final class ZKAuthenticator imple
* Only SYSTEM user can call this method
*/
public void initializeSecurity(AuthInfo credentials, String rootuser, byte[] rootpass) throws AccumuloSecurityException {
- if (!credentials.user.equals(SecurityConstants.SYSTEM_USERNAME) || !authenticate(credentials)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ if (!credentials.user.equals(SecurityConstants.SYSTEM_USERNAME) || !authenticate(credentials))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
try {
// remove old settings from zookeeper first, if any
@@ -162,21 +165,24 @@ public final class ZKAuthenticator imple
}
public synchronized String getRootUsername() {
- if (rootUserName == null) rootUserName = new String(zooCache.get(ZKUserPath));
+ if (rootUserName == null)
+ rootUserName = new String(zooCache.get(ZKUserPath));
return rootUserName;
}
public boolean authenticateUser(AuthInfo credentials, String user, byte[] pass) throws AccumuloSecurityException {
- if (!authenticate(credentials)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
- if (!credentials.user.equals(user) && !hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM)) throw new AccumuloSecurityException(
- credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+ if (!authenticate(credentials))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
+ if (!credentials.user.equals(user) && !hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
return authenticate(new AuthInfo(user, pass, credentials.instanceId));
}
@Override
public Set<String> listUsers(AuthInfo credentials) throws AccumuloSecurityException {
- if (!authenticate(credentials)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
+ if (!authenticate(credentials))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
return new TreeSet<String>(zooCache.getChildren(ZKUserPath));
}
@@ -185,18 +191,20 @@ public final class ZKAuthenticator imple
* Creates a user with no permissions whatsoever
*/
public void createUser(AuthInfo credentials, String user, byte[] pass, Authorizations authorizations) throws AccumuloSecurityException {
- if (!hasSystemPermission(credentials, credentials.user, SystemPermission.CREATE_USER)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ if (!hasSystemPermission(credentials, credentials.user, SystemPermission.CREATE_USER))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// don't allow creating a user with the same name as system user
- if (user.equals(SecurityConstants.SYSTEM_USERNAME)) throw new AccumuloSecurityException(user, SecurityErrorCode.PERMISSION_DENIED);
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME))
+ throw new AccumuloSecurityException(user, SecurityErrorCode.PERMISSION_DENIED);
try {
constructUser(user, Tool.createPass(pass), new TreeSet<SystemPermission>(), new HashMap<String,Set<TablePermission>>(), authorizations);
log.info("Created user " + user + " at the request of user " + credentials.user);
} catch (KeeperException e) {
log.error(e, e);
- if (e.code().equals(KeeperException.Code.NODEEXISTS)) throw new AccumuloSecurityException(user, SecurityErrorCode.USER_EXISTS, e);
+ if (e.code().equals(KeeperException.Code.NODEEXISTS))
+ throw new AccumuloSecurityException(user, SecurityErrorCode.USER_EXISTS, e);
throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
} catch (InterruptedException e) {
log.error(e, e);
@@ -208,12 +216,12 @@ public final class ZKAuthenticator imple
}
public void dropUser(AuthInfo credentials, String user) throws AccumuloSecurityException {
- if (!hasSystemPermission(credentials, credentials.user, SystemPermission.DROP_USER)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ if (!hasSystemPermission(credentials, credentials.user, SystemPermission.DROP_USER))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// can't delete root or system users
- if (user.equals(getRootUsername()) || user.equals(SecurityConstants.SYSTEM_USERNAME)) throw new AccumuloSecurityException(user,
- SecurityErrorCode.PERMISSION_DENIED);
+ if (user.equals(getRootUsername()) || user.equals(SecurityConstants.SYSTEM_USERNAME))
+ throw new AccumuloSecurityException(user, SecurityErrorCode.PERMISSION_DENIED);
try {
synchronized (zooCache) {
@@ -226,17 +234,19 @@ public final class ZKAuthenticator imple
throw new RuntimeException(e);
} catch (KeeperException e) {
log.error(e, e);
- if (e.code().equals(KeeperException.Code.NONODE)) throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST, e);
+ if (e.code().equals(KeeperException.Code.NONODE))
+ throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST, e);
throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
}
}
public void changePassword(AuthInfo credentials, String user, byte[] pass) throws AccumuloSecurityException {
- if (!hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_USER) && !credentials.user.equals(user)) throw new AccumuloSecurityException(
- credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+ if (!hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_USER) && !credentials.user.equals(user))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// can't modify system user
- if (user.equals(SecurityConstants.SYSTEM_USERNAME)) throw new AccumuloSecurityException(user, SecurityErrorCode.PERMISSION_DENIED);
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME))
+ throw new AccumuloSecurityException(user, SecurityErrorCode.PERMISSION_DENIED);
if (userExists(user)) {
try {
@@ -255,7 +265,8 @@ public final class ZKAuthenticator imple
log.error(e, e);
throw new AccumuloSecurityException(user, SecurityErrorCode.DEFAULT_SECURITY_ERROR, e);
}
- } else throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
+ } else
+ throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
}
/**
@@ -266,11 +277,12 @@ public final class ZKAuthenticator imple
}
public void changeAuthorizations(AuthInfo credentials, String user, Authorizations authorizations) throws AccumuloSecurityException {
- if (!hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_USER)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ if (!hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_USER))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// can't modify system user
- if (user.equals(SecurityConstants.SYSTEM_USERNAME)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
if (userExists(user)) {
try {
@@ -286,17 +298,20 @@ public final class ZKAuthenticator imple
log.error(e, e);
throw new RuntimeException(e);
}
- } else throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
+ } else
+ throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
}
public Authorizations getUserAuthorizations(AuthInfo credentials, String user) throws AccumuloSecurityException {
- if (!hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM) && !credentials.user.equals(user)) throw new AccumuloSecurityException(
- credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+ if (!hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM) && !credentials.user.equals(user))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// system user doesn't need record-level authorizations for the tables it reads (for now)
- if (user.equals(SecurityConstants.SYSTEM_USERNAME)) return Constants.NO_AUTHS;
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME))
+ return Constants.NO_AUTHS;
- if (userExists(user)) return Tool.convertAuthorizations(zooCache.get(ZKUserPath + "/" + user + ZKUserAuths));
+ if (userExists(user))
+ return Tool.convertAuthorizations(zooCache.get(ZKUserPath + "/" + user + ZKUserAuths));
throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
}
@@ -307,40 +322,47 @@ public final class ZKAuthenticator imple
*/
@Override
public boolean hasSystemPermission(AuthInfo credentials, String user, SystemPermission permission) throws AccumuloSecurityException {
- if (!authenticate(credentials)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
+ if (!authenticate(credentials))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
// some people just aren't allowed to ask about other users; here are those who can ask
if (!credentials.user.equals(user) && !hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM)
&& !hasSystemPermission(credentials, credentials.user, SystemPermission.CREATE_USER)
&& !hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_USER)
- && !hasSystemPermission(credentials, credentials.user, SystemPermission.DROP_USER)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ && !hasSystemPermission(credentials, credentials.user, SystemPermission.DROP_USER))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
- if (user.equals(getRootUsername()) || user.equals(SecurityConstants.SYSTEM_USERNAME)) return true;
+ if (user.equals(getRootUsername()) || user.equals(SecurityConstants.SYSTEM_USERNAME))
+ return true;
- if (userExists(user)) return Tool.convertSystemPermissions(zooCache.get(ZKUserPath + "/" + user + ZKUserSysPerms)).contains(permission);
+ if (userExists(user))
+ return Tool.convertSystemPermissions(zooCache.get(ZKUserPath + "/" + user + ZKUserSysPerms)).contains(permission);
throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
}
@Override
public boolean hasTablePermission(AuthInfo credentials, String user, String table, TablePermission permission) throws AccumuloSecurityException {
- if (!authenticate(credentials)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
+ if (!authenticate(credentials))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
// some people just aren't allowed to ask about other users; here are those who can ask
if (!credentials.user.equals(user) && !hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM)
&& !hasSystemPermission(credentials, credentials.user, SystemPermission.CREATE_USER)
&& !hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_USER)
- && !hasSystemPermission(credentials, credentials.user, SystemPermission.DROP_USER)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ && !hasSystemPermission(credentials, credentials.user, SystemPermission.DROP_USER))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// always allow system user
- if (user.equals(SecurityConstants.SYSTEM_USERNAME)) return true;
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME))
+ return true;
// Don't let nonexistant users scan
- if (!userExists(user)) throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
-
+ if (!userExists(user))
+ throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
+
// allow anybody to read the METADATA table
- if (table.equals(Constants.METADATA_TABLE_ID) && permission.equals(TablePermission.READ)) return true;
+ if (table.equals(Constants.METADATA_TABLE_ID) && permission.equals(TablePermission.READ))
+ return true;
if (userTableExists(user, table)) {
return Tool.convertTablePermissions(zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table)).contains(permission);
@@ -357,13 +379,15 @@ public final class ZKAuthenticator imple
@Override
public void grantSystemPermission(AuthInfo credentials, String user, SystemPermission permission) throws AccumuloSecurityException {
- if (!hasSystemPermission(credentials, credentials.user, SystemPermission.GRANT)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ if (!hasSystemPermission(credentials, credentials.user, SystemPermission.GRANT))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// can't modify system user
- if (user.equals(SecurityConstants.SYSTEM_USERNAME)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
- if (permission.equals(SystemPermission.GRANT)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.GRANT_INVALID);
+ if (permission.equals(SystemPermission.GRANT))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.GRANT_INVALID);
if (userExists(user)) {
Set<SystemPermission> perms = Tool.convertSystemPermissions(zooCache.get(ZKUserPath + "/" + user + ZKUserSysPerms));
@@ -382,23 +406,27 @@ public final class ZKAuthenticator imple
log.error(e, e);
throw new RuntimeException(e);
}
- } else throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
+ } else
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
}
@Override
public void grantTablePermission(AuthInfo credentials, String user, String table, TablePermission permission) throws AccumuloSecurityException {
if (!hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_USER)
- && !hasTablePermission(credentials, credentials.user, table, TablePermission.GRANT)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ && !hasTablePermission(credentials, credentials.user, table, TablePermission.GRANT))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// can't modify system user
- if (user.equals(SecurityConstants.SYSTEM_USERNAME)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
if (userExists(user)) {
Set<TablePermission> tablePerms;
boolean hasTable = userTableExists(user, table);
- if (hasTable) tablePerms = Tool.convertTablePermissions(zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table));
- else tablePerms = new TreeSet<TablePermission>();
+ if (hasTable)
+ tablePerms = Tool.convertTablePermissions(zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table));
+ else
+ tablePerms = new TreeSet<TablePermission>();
try {
if (tablePerms.add(permission)) {
@@ -416,19 +444,21 @@ public final class ZKAuthenticator imple
log.error(e, e);
throw new RuntimeException(e);
}
- } else throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
+ } else
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
}
@Override
public void revokeSystemPermission(AuthInfo credentials, String user, SystemPermission permission) throws AccumuloSecurityException {
- if (!hasSystemPermission(credentials, credentials.user, SystemPermission.GRANT)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ if (!hasSystemPermission(credentials, credentials.user, SystemPermission.GRANT))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// can't modify system user or revoke permissions from root user
- if (user.equals(SecurityConstants.SYSTEM_USERNAME) || user.equals(getRootUsername())) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME) || user.equals(getRootUsername()))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
- if (permission.equals(SystemPermission.GRANT)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.GRANT_INVALID);
+ if (permission.equals(SystemPermission.GRANT))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.GRANT_INVALID);
if (userExists(user)) {
Set<SystemPermission> sysPerms = Tool.convertSystemPermissions(zooCache.get(ZKUserPath + "/" + user + ZKUserSysPerms));
@@ -447,27 +477,32 @@ public final class ZKAuthenticator imple
log.error(e, e);
throw new RuntimeException(e);
}
- } else throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.USER_DOESNT_EXIST);
+ } else
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.USER_DOESNT_EXIST);
}
@Override
public void revokeTablePermission(AuthInfo credentials, String user, String table, TablePermission permission) throws AccumuloSecurityException {
if (!hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_USER)
- && !hasTablePermission(credentials, credentials.user, table, TablePermission.GRANT)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ && !hasTablePermission(credentials, credentials.user, table, TablePermission.GRANT))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
// can't modify system user
- if (user.equals(SecurityConstants.SYSTEM_USERNAME)) throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
+ if (user.equals(SecurityConstants.SYSTEM_USERNAME))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
if (userExists(user)) {
- if (!userTableExists(user, table)) return;
+ if (!userTableExists(user, table))
+ return;
Set<TablePermission> tablePerms = Tool.convertTablePermissions(zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table));
try {
if (tablePerms.remove(permission)) {
zooCache.clear();
- if (tablePerms.size() == 0) ZooUtil.recursiveDelete(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, NodeMissingPolicy.SKIP);
- else ZooUtil.putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, Tool.convertTablePermissions(tablePerms),
- NodeExistsPolicy.OVERWRITE);
+ if (tablePerms.size() == 0)
+ ZooUtil.recursiveDelete(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, NodeMissingPolicy.SKIP);
+ else
+ ZooUtil.putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, Tool.convertTablePermissions(tablePerms),
+ NodeExistsPolicy.OVERWRITE);
}
} catch (KeeperException e) {
log.error(e, e);
@@ -477,14 +512,15 @@ public final class ZKAuthenticator imple
throw new RuntimeException(e);
}
log.info("Revoked table permission " + permission + " for user " + user + " on the table " + table + " at the request of user " + credentials.user);
- } else throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.USER_DOESNT_EXIST);
+ } else
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.USER_DOESNT_EXIST);
}
@Override
public void deleteTable(AuthInfo credentials, String table) throws AccumuloSecurityException {
if (!hasSystemPermission(credentials, credentials.user, SystemPermission.DROP_TABLE)
- && !hasTablePermission(credentials, credentials.user, table, TablePermission.DROP_TABLE)) throw new AccumuloSecurityException(credentials.user,
- SecurityErrorCode.PERMISSION_DENIED);
+ && !hasTablePermission(credentials, credentials.user, table, TablePermission.DROP_TABLE))
+ throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
try {
synchronized (zooCache) {
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/CompactionQueue.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/CompactionQueue.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/CompactionQueue.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/CompactionQueue.java Thu Oct 27 15:24:51 2011
@@ -32,7 +32,8 @@ public class CompactionQueue extends Abs
@Override
public synchronized Runnable poll() {
- if (task.size() == 0) return null;
+ if (task.size() == 0)
+ return null;
Comparable min = Collections.min(task);
task.remove(min);
@@ -41,7 +42,8 @@ public class CompactionQueue extends Abs
@Override
public synchronized Runnable peek() {
- if (task.size() == 0) return null;
+ if (task.size() == 0)
+ return null;
Comparable min = Collections.min(task);
return (Runnable) min;
@@ -82,7 +84,8 @@ public class CompactionQueue extends Abs
wait(unit.toMillis(timeout));
}
- if (task.size() == 0) return null;
+ if (task.size() == 0)
+ return null;
return poll();
}
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/EncodedBinaryTreePath.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/EncodedBinaryTreePath.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/EncodedBinaryTreePath.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/EncodedBinaryTreePath.java Thu Oct 27 15:24:51 2011
@@ -136,9 +136,10 @@ public class EncodedBinaryTreePath {
sb.append('-');
- if (len % 4 > 0 || len == 0) for (int i = 0; i < 4 - (len % 4); i++) {
- sb.append('.');
- }
+ if (len % 4 > 0 || len == 0)
+ for (int i = 0; i < 4 - (len % 4); i++) {
+ sb.append('.');
+ }
int startBit = ((len - 1) / 4) * 4;
for (int i = startBit; i < len; i++) {
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/FileManager.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/FileManager.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/FileManager.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/FileManager.java Thu Oct 27 15:24:51 2011
@@ -164,7 +164,8 @@ public class FileManager {
*/
FileManager(Configuration conf, FileSystem fs, int maxOpen, BlockCache dataCache, BlockCache indexCache) {
- if (maxOpen <= 0) throw new IllegalArgumentException("maxOpen <= 0");
+ if (maxOpen <= 0)
+ throw new IllegalArgumentException("maxOpen <= 0");
this.dataCache = dataCache;
this.indexCache = indexCache;
@@ -359,11 +360,13 @@ public class FileManager {
for (FileSKVIterator reader : readers) {
String fileName = reservedReaders.remove(reader);
- if (!sawIOException) getFileList(fileName, openFiles).add(new OpenReader(fileName, reader));
+ if (!sawIOException)
+ getFileList(fileName, openFiles).add(new OpenReader(fileName, reader));
}
}
- if (sawIOException) closeReaders(readers);
+ if (sawIOException)
+ closeReaders(readers);
// decrement the semaphore
filePermits.release(readers.size());
@@ -502,7 +505,8 @@ public class FileManager {
}
synchronized void reattach() throws IOException {
- if (tabletReservedReaders.size() != 0) throw new IllegalStateException();
+ if (tabletReservedReaders.size() != 0)
+ throw new IllegalStateException();
Collection<String> files = new ArrayList<String>();
for (FileDataSource fds : dataSources)
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/InMemoryMap.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/InMemoryMap.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/InMemoryMap.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/InMemoryMap.java Thu Oct 27 15:24:51 2011
@@ -86,9 +86,13 @@ class MemKeyComparator implements Compar
int cmp = k1.compareTo(k2);
if (cmp == 0) {
- if (k1 instanceof MemKey) if (k2 instanceof MemKey) cmp = ((MemKey) k2).mutationCount - ((MemKey) k1).mutationCount;
- else cmp = 1;
- else if (k2 instanceof MemKey) cmp = -1;
+ if (k1 instanceof MemKey)
+ if (k2 instanceof MemKey)
+ cmp = ((MemKey) k2).mutationCount - ((MemKey) k1).mutationCount;
+ else
+ cmp = 1;
+ else if (k2 instanceof MemKey)
+ cmp = -1;
}
return cmp;
@@ -173,7 +177,8 @@ public class InMemoryMap {
public void put(Key key, Value value) {
bytesInMemory.addAndGet(key.getLength());
bytesInMemory.addAndGet(value.getSize());
- if (map.put(key, value) == null) size.incrementAndGet();
+ if (map.put(key, value) == null)
+ size.incrementAndGet();
}
public Value get(Key key) {
@@ -191,7 +196,8 @@ public class InMemoryMap {
}
public synchronized InterruptibleIterator skvIterator() {
- if (map == null) throw new IllegalStateException();
+ if (map == null)
+ throw new IllegalStateException();
return new SortedMapIterator(map);
}
@@ -323,8 +329,9 @@ public class InMemoryMap {
*
*/
public DataFileValue minorCompact(Configuration conf, FileSystem fs, String dirname, KeyExtent extent) {
- if (nextMutationCount.get() - 1 != mutationCount.get()) throw new IllegalStateException("Memory map in unexpected state : nextMutationCount = "
- + nextMutationCount.get() + " mutationCount = " + mutationCount.get());
+ if (nextMutationCount.get() - 1 != mutationCount.get())
+ throw new IllegalStateException("Memory map in unexpected state : nextMutationCount = " + nextMutationCount.get() + " mutationCount = "
+ + mutationCount.get());
log.debug("Begin minor compaction " + dirname);
@@ -405,7 +412,8 @@ public class InMemoryMap {
reportedProblem = true;
} finally {
try {
- if (mfw != null) mfw.close();
+ if (mfw != null)
+ mfw.close();
} catch (IOException e1) {
log.error(e1, e1);
}
@@ -455,25 +463,30 @@ public class InMemoryMap {
for (LGroupBin currentBin : lgBins) {
- if (!currentBin.present) continue;
+ if (!currentBin.present)
+ continue;
fai.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
boolean startedLocalityGroup = false;
while (fai.hasTop()) {
LGroupBin bin = cfToBinMap.get(fai.getTopKey().getColumnFamilyData());
- if (bin == null) bin = defaultLGBin;
+ if (bin == null)
+ bin = defaultLGBin;
if (bin == currentBin) {
if (!startedLocalityGroup) {
- if (currentBin.name == null) mfw.startDefaultLocalityGroup();
- else mfw.startNewLocalityGroup(currentBin.name, currentBin.columnFamilies);
+ if (currentBin.name == null)
+ mfw.startDefaultLocalityGroup();
+ else
+ mfw.startNewLocalityGroup(currentBin.name, currentBin.columnFamilies);
startedLocalityGroup = true;
}
mfw.append(fai.getTopKey(), fai.getTopValue());
entriesCompacted++;
- } else bin.present = true;
+ } else
+ bin.present = true;
fai.next();
}
@@ -488,7 +501,8 @@ public class InMemoryMap {
* @return bytesInMemory
*/
public synchronized long estimatedSizeInBytes() {
- if (map == null) return 0;
+ if (map == null)
+ return 0;
return map.getMemoryUsed();
}
@@ -519,13 +533,16 @@ public class InMemoryMap {
@Override
public boolean isCurrent() {
- if (switched) return true;
- else return memDumpFile == null;
+ if (switched)
+ return true;
+ else
+ return memDumpFile == null;
}
@Override
public DataSource getNewDataSource() {
- if (switched) throw new IllegalStateException();
+ if (switched)
+ throw new IllegalStateException();
if (!isCurrent()) {
switched = true;
@@ -538,18 +555,20 @@ public class InMemoryMap {
@SuppressWarnings("deprecation")
@Override
public SortedKeyValueIterator<Key,Value> iterator() throws IOException {
- if (iter == null) if (!switched) iter = map.skvIterator();
- else {
-
- Configuration conf = CachedConfiguration.getInstance();
- LocalFileSystem fs = FileSystem.getLocal(conf);
-
- FileSKVIterator reader = new MapFileOperations.RangeIterator(new MyMapFile.Reader(fs, memDumpFile, conf));
-
- readers.add(reader);
-
- iter = reader;
- }
+ if (iter == null)
+ if (!switched)
+ iter = map.skvIterator();
+ else {
+
+ Configuration conf = CachedConfiguration.getInstance();
+ LocalFileSystem fs = FileSystem.getLocal(conf);
+
+ FileSKVIterator reader = new MapFileOperations.RangeIterator(new MyMapFile.Reader(fs, memDumpFile, conf));
+
+ readers.add(reader);
+
+ iter = reader;
+ }
return iter;
}
@@ -568,7 +587,8 @@ public class InMemoryMap {
private MemoryDataSource mds;
protected SortedKeyValueIterator<Key,Value> getSource() {
- if (closed.get()) throw new IllegalStateException("Memory iterator is closed");
+ if (closed.get())
+ throw new IllegalStateException("Memory iterator is closed");
return super.getSource();
}
@@ -604,7 +624,8 @@ public class InMemoryMap {
}
private synchronized boolean switchNow() throws IOException {
- if (closed.get()) return false;
+ if (closed.get())
+ return false;
ssi.switchNow();
return true;
@@ -626,9 +647,11 @@ public class InMemoryMap {
}
public synchronized MemoryIterator skvIterator() {
- if (map == null) throw new NullPointerException();
+ if (map == null)
+ throw new NullPointerException();
- if (deleted) throw new IllegalStateException("Can not obtain iterator after map deleted");
+ if (deleted)
+ throw new IllegalStateException("Can not obtain iterator after map deleted");
int mc = mutationCount.get();
MemoryDataSource mds = new MemoryDataSource();
@@ -646,7 +669,8 @@ public class InMemoryMap {
public void delete(long waitTime) {
synchronized (this) {
- if (deleted) throw new IllegalStateException("Double delete");
+ if (deleted)
+ throw new IllegalStateException("Double delete");
deleted = true;
}
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java Thu Oct 27 15:24:51 2011
@@ -80,8 +80,10 @@ public class LargestFirstMemoryManager i
for (TabletState ts : tablets) {
mts = ts.getMemTableSize();
mcmts = ts.getMinorCompactingMemTableSize();
- if (ts.getLastCommitTime() > 0) idleTime = ct - ts.getLastCommitTime();
- else idleTime = ct - zerotime;
+ if (ts.getLastCommitTime() > 0)
+ idleTime = ct - ts.getLastCommitTime();
+ else
+ idleTime = ct - zerotime;
ingestMemory += mts;
tml = timeMemoryLoad(mts, idleTime);
if (mcmts == 0 && mts > 0) {
@@ -92,8 +94,9 @@ public class LargestFirstMemoryManager i
largestMemTableIdleTime = idleTime;
}
Text tableId = ts.getExtent().getTableId();
- if (!mincIdleThresholds.containsKey(tableId)) mincIdleThresholds.put(tableId,
- AccumuloConfiguration.getTableConfiguration(instanceId, tableId.toString()).getTimeInMillis(Property.TABLE_MINC_COMPACT_IDLETIME));
+ if (!mincIdleThresholds.containsKey(tableId))
+ mincIdleThresholds.put(tableId,
+ AccumuloConfiguration.getTableConfiguration(instanceId, tableId.toString()).getTimeInMillis(Property.TABLE_MINC_COMPACT_IDLETIME));
if (idleTime > mincIdleThresholds.get(tableId) && tml > largestIdleMemTableLoad) {
largestIdleMemTableLoad = tml;
largestIdleMemTablet = ts.getExtent();
@@ -107,7 +110,8 @@ public class LargestFirstMemoryManager i
// }
compactionMemory += mcmts;
- if (mcmts > 0) numWaitingMincs++;
+ if (mcmts > 0)
+ numWaitingMincs++;
}
if (ingestMemory + compactionMemory > maxObserved) {
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/MutationLog.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/MutationLog.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/MutationLog.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/MutationLog.java Thu Oct 27 15:24:51 2011
@@ -41,7 +41,8 @@ public class MutationLog {
Configuration conf = CachedConfiguration.getInstance();
FileSystem fs = FileSystem.get(conf);
- if (!fs.exists(logfile)) logout = fs.create(logfile);
+ if (!fs.exists(logfile))
+ logout = fs.create(logfile);
}
public void log(Mutation m) throws IOException {
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/NativeMap.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/NativeMap.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/NativeMap.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/NativeMap.java Thu Oct 27 15:24:51 2011
@@ -215,19 +215,22 @@ public class NativeMap implements Iterab
end = 0;
index = 0;
- if (source.hasNext()) source.doNextPreCheck();
+ if (source.hasNext())
+ source.doNextPreCheck();
int amountRead = 0;
// as we keep filling, increase the read ahead buffer
- if (nextEntries.length < MAX_READ_AHEAD_ENTRIES) nextEntries = new Entry[Math.min(nextEntries.length * 2, MAX_READ_AHEAD_ENTRIES)];
+ if (nextEntries.length < MAX_READ_AHEAD_ENTRIES)
+ nextEntries = new Entry[Math.min(nextEntries.length * 2, MAX_READ_AHEAD_ENTRIES)];
while (source.hasNext() && end < nextEntries.length) {
Entry<Key,Value> ne = source.next();
nextEntries[end++] = ne;
amountRead += ne.getKey().getSize() + ne.getValue().getSize();
- if (amountRead > READ_AHEAD_BYTES) break;
+ if (amountRead > READ_AHEAD_BYTES)
+ break;
}
}
@@ -615,8 +618,10 @@ public class NativeMap implements Iterab
this.map = map;
this.range = new Range();
iter = map.new ConcurrentIterator();
- if (iter.hasNext()) entry = iter.next();
- else entry = null;
+ if (iter.hasNext())
+ entry = iter.next();
+ else
+ entry = null;
this.interruptFlag = interruptFlag;
}
@@ -643,18 +648,21 @@ public class NativeMap implements Iterab
@Override
public void next() throws IOException {
- if (entry == null) throw new IllegalStateException();
+ if (entry == null)
+ throw new IllegalStateException();
// checking the interrupt flag for every call to next had bad a bad performance impact
// so check it every 100th time
- if (interruptFlag != null && interruptCheckCount++ % 100 == 0 && interruptFlag.get()) throw new IterationInterruptedException();
+ if (interruptFlag != null && interruptCheckCount++ % 100 == 0 && interruptFlag.get())
+ throw new IterationInterruptedException();
if (iter.hasNext()) {
entry = iter.next();
if (range.afterEndKey(entry.getKey())) {
entry = null;
}
- } else entry = null;
+ } else
+ entry = null;
}
@@ -665,7 +673,8 @@ public class NativeMap implements Iterab
throw new IllegalArgumentException("I do not know how to filter column families");
}
- if (interruptFlag != null && interruptFlag.get()) throw new IterationInterruptedException();
+ if (interruptFlag != null && interruptFlag.get())
+ throw new IterationInterruptedException();
iter.delete();
@@ -682,7 +691,8 @@ public class NativeMap implements Iterab
if (range.afterEndKey(entry.getKey())) {
entry = null;
}
- } else entry = null;
+ } else
+ entry = null;
while (hasTop() && range.beforeStartKey(getTopKey())) {
next();
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Rate.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Rate.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Rate.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Rate.java Thu Oct 27 15:24:51 2011
@@ -32,7 +32,8 @@ public class Rate {
* the rate at which each update influences the curve; must be (0., 1.0)
*/
public Rate(double ratio) {
- if (ratio <= 0. || ratio >= 1.0) throw new IllegalArgumentException("ratio must be > 0. and < 1.0");
+ if (ratio <= 0. || ratio >= 1.0)
+ throw new IllegalArgumentException("ratio must be > 0. and < 1.0");
this.ratio = ratio;
}
Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TLevel.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TLevel.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TLevel.java (original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TLevel.java Thu Oct 27 15:24:51 2011
@@ -28,7 +28,8 @@ public class TLevel extends Level {
}
static public Level toLevel(int val) {
- if (val == Level.DEBUG_INT + 100) return Level.DEBUG;
+ if (val == Level.DEBUG_INT + 100)
+ return Level.DEBUG;
return Level.toLevel(val);
}