Replace "throws Exception" with the specific Exception(s) thrown.

This commit is contained in:
Peter Lawrey
2015-06-28 18:52:05 +01:00
parent 9f9aaa9b9e
commit 9c8fea8367
25 changed files with 67 additions and 65 deletions
@@ -180,7 +180,7 @@ public final class DataValueBytesMarshallers {
" }\n" +
"\n" +
" @Override\n" +
" " + simpleName + " getInstance() throws Exception {\n" +
" " + simpleName + " getInstance() {\n" +
" return factory.create();\n" +
" }\n" +
"}\n";
@@ -531,7 +531,7 @@ public final class DataValueBytesMarshallers {
private static void generateGetInstance(StringBuilder sb, Class cl) {
sb.append(" ").append(cl.getCanonicalName())
.append(" getInstance() throws Exception {\n");
.append(" getInstance() {\n");
sb.append(" ").append("return new ").append(cl.getName()).append("$$Native();\n");
sb.append(" ").append("}\n\n");
}
@@ -133,7 +133,7 @@ public interface EngineReplicationLangBytes extends Closeable {
* @return {@code true} if the entry was accepted by the {@code callback.onEntry()} method,
* {@code false} if the entry was not accepted or was not available
*/
boolean nextEntry(@NotNull final EngineEntryCallback callback) throws InterruptedException;
boolean nextEntry(@NotNull final EngineEntryCallback callback);
/**
* Dirties all entries with a modification time equal to {@code fromTimeStamp} or newer. It
@@ -455,7 +455,7 @@ final class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? supe
}
@Override
public boolean nextEntry(@NotNull final EngineEntryCallback callback) throws InterruptedException {
public boolean nextEntry(@NotNull final EngineEntryCallback callback) {
return modificationIterator.nextEntry(new EntryCallback() {
@@ -1719,7 +1719,7 @@ final class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? supe
* @return true if an entry was processed
*/
@Override
public boolean nextEntry(@NotNull final EntryCallback entryCallback, final int chronicleId) throws InterruptedException {
public boolean nextEntry(@NotNull final EntryCallback entryCallback, final int chronicleId) {
long position = this.position;
while (true) {
long oldPosition = position;
@@ -1866,7 +1866,7 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable, Clon
}
}
private void resizeToMessageOutBuffer(long start, @NotNull Exception e) throws Exception {
private <T extends Exception> void resizeToMessageOutBuffer(long start, @NotNull T e) throws T {
assert outBytesLock.isHeldByCurrentThread();
assert !inBytesLock.isHeldByCurrentThread();
String message = e.getMessage();
@@ -1822,12 +1822,16 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
@Override
public final ReadLocked<K, KI, MKI, V, VI, MVI> readLock(
@Nullable SegmentState segmentState) throws InterruptedException {
@Nullable SegmentState segmentState) {
while (true) {
// final boolean success = segmentHeader.tryRWReadLock(LOCK_OFFSET, lockTimeOutNS);
final boolean success;
boolean success = false;
success = segmentHeader.tryRWWriteLock(LOCK_OFFSET, lockTimeOutNS);
try {
success = segmentHeader.tryRWWriteLock(LOCK_OFFSET, lockTimeOutNS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
/*
boolean success = false;
@@ -2825,11 +2829,8 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
final Segment segment = segments[segIndex];
ThreadLocalCopies copies = SegmentState.getCopies(null);
try (SegmentState segmentState = SegmentState.get(copies)) {
try {
segment.readLock(null);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
if (segment.hashLookup().getPositions().isClear(pos)) {
// the pos was removed after the previous advance
advance(segIndex, pos);