Skip to content

Commit

Permalink
fix(java):ClassLoaderFuryPooled#setFactoryCallback effect old Fury
Browse files Browse the repository at this point in the history
  • Loading branch information
shuchang.li committed Nov 20, 2024
1 parent 5b22ccd commit 2c228fa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ private void addFury() {
}

void setFactoryCallback(Consumer<Fury> factoryCallback) {
this.factoryCallback = factoryCallback;
this.factoryCallback = this.factoryCallback.andThen(factoryCallback);
allFury.keySet().forEach(factoryCallback);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,23 @@ public void testGetFuryWithIncreaseCapacity() {
}
}

@Test
public void testFuryAfterSetFactoryCallback() {
int minPoolSize = 4;
ClassLoaderFuryPooled pooled = getPooled(minPoolSize, 6);

try {
pooled.setFactoryCallback(
fury -> {
throw new RuntimeException();
});
pooled.getFury();
Assert.fail();
} catch (RuntimeException e) {
// Success
}
}

@Test
public void testGetFuryAwait() throws InterruptedException {
int minPoolSize = 3;
Expand Down

0 comments on commit 2c228fa

Please sign in to comment.