Skip to content

Commit

Permalink
catch throwable
Browse files Browse the repository at this point in the history
  • Loading branch information
firestar committed Aug 17, 2024
1 parent f5126fc commit b4b276a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;

import java.util.Queue;
import java.util.concurrent.ExecutionException;
import java.util.logging.Logger;

class ModQueueHandler implements Runnable {
Expand All @@ -21,7 +22,11 @@ public void run() {
while (true) {
int left = 0;
while (!modqueue.isEmpty() && (mqi = modqueue.poll()) != null) {
this.dataTable.modify(mqi.getMod(), mqi.getModification());
try {
this.dataTable.modify(mqi.getMod(), mqi.getModification());
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
int leftTmp = dataTable.getLeftInModQueue().decrementAndGet();
if (left == leftTmp) {
overkillCheck = true;
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/com/nucleodb/library/mqs/QueueHandlerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import java.io.IOException;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicInteger;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -32,7 +33,7 @@ public void setup() {
}

@Test
public void testRun_method() throws IOException {
public void testRun_method() throws IOException, ExecutionException {

// Define mocks, for testing different branches of the run method
// Mock for the database modification branch
Expand Down

0 comments on commit b4b276a

Please sign in to comment.