diff options
Diffstat (limited to 'src/main/java/com/amazon/carbonado/spi')
3 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/com/amazon/carbonado/spi/LobEngine.java b/src/main/java/com/amazon/carbonado/spi/LobEngine.java index e91bf59..a897cac 100644 --- a/src/main/java/com/amazon/carbonado/spi/LobEngine.java +++ b/src/main/java/com/amazon/carbonado/spi/LobEngine.java @@ -257,7 +257,7 @@ public class LobEngine { throw new PersistNoneException("Lob deleted: " + this);
}
- OutputStream out = new Output(lob, 0, txn);
+ Output out = new Output(lob, 0, txn);
byte[] buffer = new byte[lob.getBlockSize()];
@@ -271,12 +271,18 @@ public class LobEngine { } finally {
data.close();
}
- out.close();
if (total < lob.getLength()) {
new BlobImpl(lob).setLength(total);
}
+ // Note: Closing Output commits the transaction. No other resources
+ // are freed. This close is explicitly not put into a finally block
+ // in order for an exception to cause the transaction to rollback.
+ out.close();
+
+ // This isn't really needed due to closing Output, but it is good
+ // practice to include it anyhow.
txn.commit();
} catch (IOException e) {
if (e.getCause() instanceof RepositoryException) {
diff --git a/src/main/java/com/amazon/carbonado/spi/RepairExecutor.java b/src/main/java/com/amazon/carbonado/spi/RepairExecutor.java index adf2f34..0bc45ab 100644 --- a/src/main/java/com/amazon/carbonado/spi/RepairExecutor.java +++ b/src/main/java/com/amazon/carbonado/spi/RepairExecutor.java @@ -132,6 +132,7 @@ public class RepairExecutor { while (true) {
synchronized (this) {
mIdle = true;
+ // Only one wait condition, so okay to not call notifyAll.
notify();
}
Runnable task = mQueue.poll(mKeepAliveSeconds, TimeUnit.SECONDS);
@@ -141,6 +142,7 @@ public class RepairExecutor { return task;
}
if (mQueue.size() == 0) {
+ // Only one wait condition, so okay to not call notifyAll.
notify();
mWorker = null;
return null;
diff --git a/src/main/java/com/amazon/carbonado/spi/SequenceValueGenerator.java b/src/main/java/com/amazon/carbonado/spi/SequenceValueGenerator.java index 21b0676..efe8ebd 100644 --- a/src/main/java/com/amazon/carbonado/spi/SequenceValueGenerator.java +++ b/src/main/java/com/amazon/carbonado/spi/SequenceValueGenerator.java @@ -262,7 +262,7 @@ public class SequenceValueGenerator extends AbstractSequenceValueProducer { long next = mStoredSequence.getNextValue();
long nextStored = next + mReserveAmount * mIncrement;
- if (next >= 0 & nextStored < 0) {
+ if (next >= 0 && nextStored < 0) {
// Wrapped around. There might be just a few values left.
long avail = (Long.MAX_VALUE - next) / mIncrement;
if (avail > 0) {
|