Skip to content

Commit

Permalink
HSEARCH-3425 Warnings: resource leak
Browse files Browse the repository at this point in the history
  • Loading branch information
yrodiere committed Feb 8, 2019
1 parent 6c6b857 commit 516cad6
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
Expand Up @@ -84,6 +84,11 @@ public void simple() {
assertThat( futureAll ).isPending();
sequenceFuture.complete( null );
assertThat( futureAll ).isSuccessful( (Void) null );

resetAll();
replayAll();
orchestrator.close();
verifyAll();
}

@Test
Expand Down Expand Up @@ -137,6 +142,11 @@ public void parallelSequenceBetweenChangeset() {
assertThat( futureAll ).isPending();
sequence1Future.complete( null );
assertThat( futureAll ).isSuccessful( (Void) null );

resetAll();
replayAll();
orchestrator.close();
verifyAll();
}

@Test
Expand Down Expand Up @@ -197,6 +207,11 @@ public void reuseBulkAccrossSequences() {
sequence1Future.complete( null );
verifyAll();
assertThat( futureAll ).isSuccessful( (Void) null );

resetAll();
replayAll();
orchestrator.close();
verifyAll();
}

@Test
Expand Down Expand Up @@ -245,6 +260,11 @@ public void newBulkIfNonBulkable_sameChangeset() {
sequence1Future.complete( null );
verifyAll();
assertThat( futureAll ).isSuccessful( (Void) null );

resetAll();
replayAll();
orchestrator.close();
verifyAll();
}

@Test
Expand Down Expand Up @@ -310,6 +330,11 @@ public void newBulkIfNonBulkable_differenceChangesets() {
sequence1Future.complete( null );
verifyAll();
assertThat( futureAll ).isSuccessful( (Void) null );

resetAll();
replayAll();
orchestrator.close();
verifyAll();
}

private <T> ElasticsearchWork<T> work(int index) {
Expand Down
Expand Up @@ -82,6 +82,11 @@ public void simple() {
CompletableFuture<Void> futureAll = orchestrator.executeSubmitted();
verifyAll();
assertThat( futureAll ).isSameAs( sequenceFuture );

resetAll();
replayAll();
orchestrator.close();
verifyAll();
}

@Test
Expand Down Expand Up @@ -131,6 +136,11 @@ public void newSequenceBetweenChangeset() {
CompletableFuture<Void> futureAll = orchestrator.executeSubmitted();
verifyAll();
assertThat( futureAll ).isSameAs( sequence2Future );

resetAll();
replayAll();
orchestrator.close();
verifyAll();
}

@Test
Expand Down Expand Up @@ -179,6 +189,11 @@ public void reuseBulkAcrossSequences() {
CompletableFuture<Void> futureAll = orchestrator.executeSubmitted();
verifyAll();
assertThat( futureAll ).isSameAs( sequence2Future );

resetAll();
replayAll();
orchestrator.close();
verifyAll();
}

@Test
Expand Down Expand Up @@ -221,6 +236,11 @@ public void newBulkIfNonBulkable_sameChangeset() {
CompletableFuture<Void> futureAll = orchestrator.executeSubmitted();
verifyAll();
assertThat( futureAll ).isSameAs( sequence1Future );

resetAll();
replayAll();
orchestrator.close();
verifyAll();
}

@Test
Expand Down Expand Up @@ -274,6 +294,11 @@ public void newBulkIfNonBulkable_differentChangesets() {
CompletableFuture<Void> futureAll = orchestrator.executeSubmitted();
verifyAll();
assertThat( futureAll ).isSameAs( sequence2Future );

resetAll();
replayAll();
orchestrator.close();
verifyAll();
}

private ElasticsearchWork<?> work(int index) {
Expand Down
Expand Up @@ -78,6 +78,7 @@ public HibernateOrmMapping getMapping() {
public HibernateOrmSearchManager getSearchManager(SessionImplementor sessionImplementor) {
TransientReference<HibernateOrmSearchManager> reference =
(TransientReference<HibernateOrmSearchManager>) sessionImplementor.getProperties().get( SEARCH_MANAGER_KEY );
@SuppressWarnings("resource") // The listener below handles closing
HibernateOrmSearchManager searchManager = reference == null ? null : reference.get();
if ( searchManager == null ) {
searchManager = getMapping().createSearchManager( sessionImplementor );
Expand Down

0 comments on commit 516cad6

Please sign in to comment.