Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Override annotation should be used where necessary #1221

Open
wants to merge 1 commit into
base: titan10
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@

public class BerkeleyFixedLengthKCVSTest extends KeyColumnValueStoreTest {

@Override
public KeyColumnValueStoreManager openStorageManager() throws BackendException {
BerkeleyJEStoreManager sm = new BerkeleyJEStoreManager(BerkeleyStorageSetup.getBerkeleyJEConfiguration());
return new OrderedKeyValueStoreManagerAdapter(sm, ImmutableMap.of(storeName, 8));
}

@Override
@Test
public void testGetKeysWithKeyRange() throws Exception {
super.testGetKeysWithKeyRange();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

public class BerkeleyLogTest extends KCVSLogTest {

@Override
public KeyColumnValueStoreManager openStorageManager() throws BackendException {
BerkeleyJEStoreManager sm = new BerkeleyJEStoreManager(BerkeleyStorageSetup.getBerkeleyJEConfiguration());
return new OrderedKeyValueStoreManagerAdapter(sm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@

public class BerkeleyVariableLengthKCVSTest extends KeyColumnValueStoreTest {

@Override
public KeyColumnValueStoreManager openStorageManager() throws BackendException {
BerkeleyJEStoreManager sm = new BerkeleyJEStoreManager(BerkeleyStorageSetup.getBerkeleyJEConfiguration());
return new OrderedKeyValueStoreManagerAdapter(sm);
}

@Override
@Test
public void testGetKeysWithKeyRange() throws Exception {
super.testGetKeysWithKeyRange();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ public StoreFeatures getFeatures() {
*/
public abstract Map<String, String> getCompressionOptions(String cf) throws BackendException;

@Override
public String getName() {
return getClass().getSimpleName() + keySpaceName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public synchronized KeyColumnValueStore openDatabase(String name, StoreMetaData.
* {@link StorageService#getLocalPrimaryRanges(String)} returns a raw
* (unparameterized) type.
*/
@Override
public List<KeyRange> getLocalKeyPartition() throws BackendException {
ensureKeyspaceExists(keySpaceName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ public List<KeyRange> getLocalKeyPartition() throws BackendException {
*
* @throws com.thinkaurelius.titan.diskstorage.BackendException if any checked Thrift or UnknownHostException is thrown in the body of this method
*/
@Override
public void clearStorage() throws BackendException {
openStores.clear();
final String lp = "ClearStorage: "; // "log prefix"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public interface TitanGraphTransaction extends Graph, SchemaManager {
* @param vertexLabel the name of the vertex label to use
* @return a new vertex in the graph created in the context of this transaction
*/
@Override
public TitanVertex addVertex(String vertexLabel);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public interface TitanRelation extends TitanElement {
* @param key string identifying a key
* @return value or list of values associated with key
*/
@Override
public <V> V value(String key);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public boolean test(Object value, Object condition) {
return evaluateRaw(value.toString(),(String)condition);
}

@Override
public boolean evaluateRaw(String value, String regex) {
return value.matches(regex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public interface TitanGraphIndex extends TitanIndex {
* Returns the name of the index
* @return
*/
@Override
public String name();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ public BackendTransaction beginTransaction(TransactionConfiguration configuratio
maxReadTime, indexTx, threadPool);
}

@Override
public synchronized void close() throws BackendException {
if (!hasAttemptedClose) {
hasAttemptedClose = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public Set<String> getContainedNamespaces(ConfigNamespace umbrella, String... um
return result;
}

@Override
public Map<String,Object> getSubset(ConfigNamespace umbrella, String... umbrellaElements) {
Map<String,Object> result = Maps.newHashMap();
for (ReadConfiguration config : new ReadConfiguration[]{global,local}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public String toString() {
return staticBuffer2Object(result, datatype);
}

@Override
public<O> void set(String key, O value, O expectedValue) {
set(key,value,expectedValue,true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ KeyColumnValueStore getBackingStore() {
return store;
}

@Override
protected StoreTransaction unwrapTx(StoreTransaction t) {
assert null != t;
assert t instanceof ExpectedValueCheckingTransaction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public String getSenderId() {
return senderId;
}

@Override
public Instant getTimestamp() {
return timestamp;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ private MetricInstrumentedIterator(KeyIterator i, String p) {
public boolean hasNext() {
return MetricInstrumentedStore.runWithMetrics(p, null, M_HAS_NEXT,
new UncheckedCallable<Boolean>() {
@Override
public Boolean call() {
return Boolean.valueOf(iterator.hasNext());
}
Expand All @@ -69,6 +70,7 @@ public Boolean call() {
public StaticBuffer next() {
return MetricInstrumentedStore.runWithMetrics(p, null, M_NEXT,
new UncheckedCallable<StaticBuffer>() {
@Override
public StaticBuffer call() {
return iterator.next();
}
Expand All @@ -80,6 +82,7 @@ public StaticBuffer call() {
public void close() throws IOException {
MetricInstrumentedStore.runWithMetrics(p, null, M_CLOSE,
new IOCallable<Void>() {
@Override
public Void call() throws IOException {
iterator.close();
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public MetricInstrumentedStore(KeyColumnValueStore backend, String metricsStoreN
public EntryList getSlice(final KeySliceQuery query, final StoreTransaction txh) throws BackendException {
return runWithMetrics(txh, metricsStoreName, M_GET_SLICE,
new StorageCallable<EntryList>() {
@Override
public EntryList call() throws BackendException {
EntryList result = backend.getSlice(query, txh);
recordSliceMetrics(txh, result);
Expand All @@ -103,6 +104,7 @@ public Map<StaticBuffer,EntryList> getSlice(final List<StaticBuffer> keys,
final StoreTransaction txh) throws BackendException {
return runWithMetrics(txh, metricsStoreName, M_GET_SLICE,
new StorageCallable<Map<StaticBuffer,EntryList>>() {
@Override
public Map<StaticBuffer,EntryList> call() throws BackendException {
Map<StaticBuffer,EntryList> results = backend.getSlice(keys, query, txh);

Expand All @@ -122,6 +124,7 @@ public void mutate(final StaticBuffer key,
final StoreTransaction txh) throws BackendException {
runWithMetrics(txh, metricsStoreName, M_MUTATE,
new StorageCallable<Void>() {
@Override
public Void call() throws BackendException {
backend.mutate(key, additions, deletions, txh);
return null;
Expand All @@ -137,6 +140,7 @@ public void acquireLock(final StaticBuffer key,
final StoreTransaction txh) throws BackendException {
runWithMetrics(txh, metricsStoreName, M_ACQUIRE_LOCK,
new StorageCallable<Void>() {
@Override
public Void call() throws BackendException {
backend.acquireLock(key, column, expectedValue, txh);
return null;
Expand All @@ -149,6 +153,7 @@ public Void call() throws BackendException {
public KeyIterator getKeys(final KeyRangeQuery query, final StoreTransaction txh) throws BackendException {
return runWithMetrics(txh, metricsStoreName, M_GET_KEYS,
new StorageCallable<KeyIterator>() {
@Override
public KeyIterator call() throws BackendException {
KeyIterator ki = backend.getKeys(query, txh);
if (txh.getConfiguration().hasGroupName()) {
Expand All @@ -165,6 +170,7 @@ public KeyIterator call() throws BackendException {
public KeyIterator getKeys(final SliceQuery query, final StoreTransaction txh) throws BackendException {
return runWithMetrics(txh, metricsStoreName, M_GET_KEYS,
new StorageCallable<KeyIterator>() {
@Override
public KeyIterator call() throws BackendException {
KeyIterator ki = backend.getKeys(query, txh);
if (txh.getConfiguration().hasGroupName()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,42 +104,49 @@ public double getDouble() {

//------

@Override
public byte[] getBytes(int length) {
byte[] result = super.getBytes(position,length);
position += length*BYTE_LEN;
return result;
}

@Override
public short[] getShorts(int length) {
short[] result = super.getShorts(position,length);
position += length*SHORT_LEN;
return result;
}

@Override
public int[] getInts(int length) {
int[] result = super.getInts(position,length);
position += length*INT_LEN;
return result;
}

@Override
public long[] getLongs(int length) {
long[] result = super.getLongs(position,length);
position += length*LONG_LEN;
return result;
}

@Override
public char[] getChars(int length) {
char[] result = super.getChars(position,length);
position += length*CHAR_LEN;
return result;
}

@Override
public float[] getFloats(int length) {
float[] result = super.getFloats(position,length);
position += length*FLOAT_LEN;
return result;
}

@Override
public double[] getDoubles(int length) {
double[] result = super.getDoubles(position,length);
position += length*DOUBLE_LEN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ public byte[] getBytes(int position, int length) {
return result;
}

@Override
public short[] getShorts(int position, int length) {
short[] result = new short[length];
for (int i = 0; i < length; i++) {
Expand All @@ -251,6 +252,7 @@ public short[] getShorts(int position, int length) {
return result;
}

@Override
public int[] getInts(int position, int length) {
int[] result = new int[length];
for (int i = 0; i < length; i++) {
Expand All @@ -260,6 +262,7 @@ public int[] getInts(int position, int length) {
return result;
}

@Override
public long[] getLongs(int position, int length) {
long[] result = new long[length];
for (int i = 0; i < length; i++) {
Expand All @@ -269,6 +272,7 @@ public long[] getLongs(int position, int length) {
return result;
}

@Override
public char[] getChars(int position, int length) {
char[] result = new char[length];
for (int i = 0; i < length; i++) {
Expand All @@ -278,6 +282,7 @@ public char[] getChars(int position, int length) {
return result;
}

@Override
public float[] getFloats(int position, int length) {
float[] result = new float[length];
for (int i = 0; i < length; i++) {
Expand All @@ -287,6 +292,7 @@ public float[] getFloats(int position, int length) {
return result;
}

@Override
public double[] getDoubles(int position, int length) {
double[] result = new double[length];
for (int i = 0; i < length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public void setCache(RelationCache cache) {
caches[currentIndex]=cache;
}

@Override
public boolean hasMetaData() {
verifyAccess();
return !metadata.isEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,31 @@ public class UncaughtExceptionLogger implements UncaughtExceptionHandler {
*/
public static enum UELevel implements UELogLevel {
TRACE {
@Override
public void dispatch(String message, Throwable t) {
log.trace(message, t);
}
},
DEBUG {
@Override
public void dispatch(String message, Throwable t) {
log.debug(message, t);
}
},
INFO {
@Override
public void dispatch(String message, Throwable t) {
log.info(message, t);
}
},
WARN {
@Override
public void dispatch(String message, Throwable t) {
log.warn(message, t);
}
},
ERROR {
@Override
public void dispatch(String message, Throwable t) {
log.error(message, t);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ public static RecordEntry[] indexMatch(TitanRelation relation, CompositeIndexTyp

public static class IndexRecords extends ArrayList<RecordEntry[]> {

@Override
public boolean add(RecordEntry[] record) {
return super.add(Arrays.copyOf(record,record.length));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public CacheEntry call() throws Exception {
return ce.get(dir);
}

@Override
public void close() {
cache.invalidateAll();
cache.cleanUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public IDManager getIDManager() {
return idManager;
}

@Override
public synchronized void close() {
schemaIdPool.close();
for (PartitionIDPool pool : idPools.values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public long longId() {
return id;
}

@Override
public boolean hasId() {
return !isTemporaryId(longId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public long[] getStatistics() {
return new long[]{successTxCounter.get(),failureTxCounter.get()};
}

@Override
public synchronized void shutdown() throws TitanException {
cleaner.close(CLEAN_SLEEP_TIME);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ public QueryBuilder keys(String... keys) {
return this;
}

@Override
public QueryBuilder type(RelationType type) {
super.type(type);
return this;
Expand Down
Loading