use of edu.umd.cs.findbugs.annotations.Nullable in project hbase by apache.
the class TerminalImpl method doResizeIfNecessary.
@Nullable
@Override
public TerminalSize doResizeIfNecessary() {
TerminalSize currentTerminalSize = queryTerminalSize();
if (!currentTerminalSize.equals(cachedTerminalSize)) {
cachedTerminalSize = currentTerminalSize;
updateTerminalSize(cachedTerminalSize.getColumns(), cachedTerminalSize.getRows());
return cachedTerminalSize;
}
return null;
}
use of edu.umd.cs.findbugs.annotations.Nullable in project hbase by apache.
the class TableStateManager method readMetaState.
@Nullable
private TableState readMetaState(TableName tableName) throws IOException {
TableState.State state = tableName2State.get(tableName);
if (state != null) {
return new TableState(tableName, state);
}
TableState tableState = MetaTableAccessor.getTableState(master.getConnection(), tableName);
if (tableState != null) {
tableName2State.putIfAbsent(tableName, tableState.getState());
}
return tableState;
}
use of edu.umd.cs.findbugs.annotations.Nullable in project hbase by apache.
the class CatalogFamilyFormat method getRegionLocations.
/**
* Returns an HRegionLocationList extracted from the result.
* @return an HRegionLocationList containing all locations for the region range or null if we
* can't deserialize the result.
*/
@Nullable
public static RegionLocations getRegionLocations(final Result r) {
if (r == null) {
return null;
}
RegionInfo regionInfo = getRegionInfo(r, HConstants.REGIONINFO_QUALIFIER);
if (regionInfo == null) {
return null;
}
List<HRegionLocation> locations = new ArrayList<>(1);
NavigableMap<byte[], NavigableMap<byte[], byte[]>> familyMap = r.getNoVersionMap();
locations.add(getRegionLocation(r, regionInfo, 0));
NavigableMap<byte[], byte[]> infoMap = familyMap.get(HConstants.CATALOG_FAMILY);
if (infoMap == null) {
return new RegionLocations(locations);
}
// iterate until all serverName columns are seen
int replicaId = 0;
byte[] serverColumn = getServerColumn(replicaId);
SortedMap<byte[], byte[]> serverMap;
serverMap = infoMap.tailMap(serverColumn, false);
if (serverMap.isEmpty()) {
return new RegionLocations(locations);
}
for (Map.Entry<byte[], byte[]> entry : serverMap.entrySet()) {
replicaId = parseReplicaIdFromServerColumn(entry.getKey());
if (replicaId < 0) {
break;
}
HRegionLocation location = getRegionLocation(r, regionInfo, replicaId);
// have HRL's in RegionLocations object with null ServerName. They are handled as null HRLs.
if (location.getServerName() == null) {
locations.add(null);
} else {
locations.add(location);
}
}
return new RegionLocations(locations);
}
use of edu.umd.cs.findbugs.annotations.Nullable in project incubator-rya by apache.
the class StatementPatternMatcherTest method getSp.
/**
* Fetch the {@link StatementPattern} from a SPARQL string.
*
* @param sparql - A SPARQL query that contains only a single Statement Patern. (not nul)
* @return The {@link StatementPattern} that was in the query, if it could be found. Otherwise {@code null}
* @throws Exception The statement pattern could not be found in the parsed SPARQL query.
*/
@Nullable
public static StatementPattern getSp(final String sparql) throws Exception {
requireNonNull(sparql);
final AtomicReference<StatementPattern> statementPattern = new AtomicReference<>();
final ParsedQuery parsed = new SPARQLParser().parseQuery(sparql, null);
parsed.getTupleExpr().visitChildren(new QueryModelVisitorBase<Exception>() {
@Override
public void meet(final StatementPattern node) throws Exception {
statementPattern.set(node);
}
});
return statementPattern.get();
}
use of edu.umd.cs.findbugs.annotations.Nullable in project incubator-rya by apache.
the class FilterEvaluatorTest method getFilter.
/**
* Get the first {@link Filter} node from a SPARQL query.
*
* @param sparql - The query that contains a single Projection node.
* @return The first {@link Filter} that is encountered.
* @throws Exception The query could not be parsed.
*/
@Nullable
public static Filter getFilter(final String sparql) throws Exception {
requireNonNull(sparql);
final AtomicReference<Filter> filter = new AtomicReference<>();
final ParsedQuery parsed = new SPARQLParser().parseQuery(sparql, null);
parsed.getTupleExpr().visit(new QueryModelVisitorBase<Exception>() {
@Override
public void meet(final Filter node) throws Exception {
filter.set(node);
}
});
return filter.get();
}
Aggregations