Java Code Examples for org.agrona.CloseHelper#closeAll()
The following examples show how to use
org.agrona.CloseHelper#closeAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PublicationImage.java From aeron with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ public void close() { CloseHelper.close(errorHandler, hwmPosition); CloseHelper.close(errorHandler, rebuildPosition); CloseHelper.closeAll(errorHandler, subscriberPositions); for (int i = 0, size = untetheredSubscriptions.size(); i < size; i++) { final UntetheredSubscription untetheredSubscription = untetheredSubscriptions.get(i); if (UntetheredSubscription.State.RESTING == untetheredSubscription.state) { CloseHelper.close(errorHandler, untetheredSubscription.position); } } CloseHelper.close(errorHandler, congestionControl); CloseHelper.close(errorHandler, rawLog); }
Example 2
Source File: NetworkPublication.java From aeron with Apache License 2.0 | 6 votes |
public void close() { CloseHelper.close(errorHandler, publisherPos); CloseHelper.close(errorHandler, publisherLimit); CloseHelper.close(errorHandler, senderPosition); CloseHelper.close(errorHandler, senderLimit); CloseHelper.close(errorHandler, senderBpe); CloseHelper.closeAll(errorHandler, spyPositions); for (int i = 0, size = untetheredSubscriptions.size(); i < size; i++) { final UntetheredSubscription untetheredSubscription = untetheredSubscriptions.get(i); if (UntetheredSubscription.State.RESTING == untetheredSubscription.state) { CloseHelper.close(errorHandler, untetheredSubscription.position); } } CloseHelper.close(errorHandler, rawLog); }
Example 3
Source File: ClusterNodeTest.java From aeron with Apache License 2.0 | 6 votes |
@AfterEach public void after() { final ConsensusModule consensusModule = null == clusteredMediaDriver ? null : clusteredMediaDriver.consensusModule(); CloseHelper.closeAll(aeronCluster, consensusModule, container, clusteredMediaDriver); if (null != clusteredMediaDriver) { clusteredMediaDriver.consensusModule().context().deleteDirectory(); clusteredMediaDriver.archive().context().deleteDirectory(); clusteredMediaDriver.mediaDriver().context().deleteDirectory(); container.context().deleteDirectory(); } }
Example 4
Source File: ReplicateRecordingTest.java From aeron with Apache License 2.0 | 6 votes |
@AfterEach public void after() { CloseHelper.closeAll( srcAeronArchive, dstAeronArchive, srcAeron, dstAeron, srcArchive, dstArchive, dstMediaDriver, srcMediaDriver); dstArchive.context().deleteDirectory(); dstMediaDriver.context().deleteDirectory(); srcArchive.context().deleteDirectory(); srcMediaDriver.context().deleteDirectory(); }
Example 5
Source File: AuthenticationTest.java From aeron with Apache License 2.0 | 5 votes |
@AfterEach public void after() { final ConsensusModule consensusModule = null == clusteredMediaDriver ? null : clusteredMediaDriver.consensusModule(); CloseHelper.closeAll(aeronCluster, consensusModule, container, clusteredMediaDriver); if (null != clusteredMediaDriver) { clusteredMediaDriver.consensusModule().context().deleteDirectory(); clusteredMediaDriver.archive().context().deleteDirectory(); clusteredMediaDriver.mediaDriver().context().deleteDirectory(); } }
Example 6
Source File: ClusterNodeRestartTest.java From aeron with Apache License 2.0 | 5 votes |
@AfterEach public void after() { CloseHelper.closeAll(clusteredMediaDriver.consensusModule(), aeronCluster, container, clusteredMediaDriver); if (null != clusteredMediaDriver) { clusteredMediaDriver.consensusModule().context().deleteDirectory(); clusteredMediaDriver.archive().context().deleteDirectory(); clusteredMediaDriver.mediaDriver().context().deleteDirectory(); container.context().deleteDirectory(); } }
Example 7
Source File: PubAndSubTest.java From aeron with Apache License 2.0 | 5 votes |
@AfterEach public void after() { CloseHelper.closeAll(publishingClient, subscribingClient, driver); if (null != driver) { driver.context().deleteDirectory(); } }
Example 8
Source File: EmbeddedReplayThroughput.java From aeron with Apache License 2.0 | 5 votes |
public void close() { CloseHelper.closeAll( aeronArchive, aeron, archivingMediaDriver, () -> archivingMediaDriver.archive().context().deleteDirectory(), () -> archivingMediaDriver.mediaDriver().context().deleteDirectory()); }
Example 9
Source File: ArchivingMediaDriver.java From benchmarks with Apache License 2.0 | 5 votes |
public void close() throws Exception { CloseHelper.closeAll(archive, driver); archive.context().deleteDirectory(); if (null != driver) { driver.context().deleteDirectory(); } }
Example 10
Source File: StartFromTruncatedRecordingLogTest.java From aeron with Apache License 2.0 | 5 votes |
@AfterEach public void after() { CloseHelper.closeAll(client, clientMediaDriver); CloseHelper.closeAll(clusteredMediaDrivers); CloseHelper.closeAll(containers); clientMediaDriver.context().deleteDirectory(); for (final ClusteredMediaDriver driver : clusteredMediaDrivers) { if (null != driver) { driver.consensusModule().context().deleteDirectory(); driver.archive().context().deleteDirectory(); driver.mediaDriver().context().deleteDirectory(); } } for (final ClusteredServiceContainer container : containers) { if (null != container) { container.context().deleteDirectory(); } } }
Example 11
Source File: ArchiveAuthenticationTest.java From aeron with Apache License 2.0 | 5 votes |
@AfterEach public void after() { CloseHelper.closeAll(aeronArchive, aeron, archive, mediaDriver); archive.context().deleteDirectory(); mediaDriver.context().deleteDirectory(); }
Example 12
Source File: ClusterNodeRestartTest.java From aeron with Apache License 2.0 | 4 votes |
private void forceCloseForRestart() { CloseHelper.closeAll(clusteredMediaDriver.consensusModule(), aeronCluster, container, clusteredMediaDriver); }
Example 13
Source File: CounterTest.java From aeron with Apache License 2.0 | 4 votes |
@AfterEach public void after() { CloseHelper.closeAll(clientA, clientB, driver); driver.context().deleteDirectory(); }
Example 14
Source File: SpySubscriptionTest.java From aeron with Apache License 2.0 | 4 votes |
@AfterEach public void after() { CloseHelper.closeAll(aeron, driver); driver.context().deleteDirectory(); }
Example 15
Source File: PublishFromArbitraryPositionTest.java From aeron with Apache License 2.0 | 4 votes |
@AfterEach public void after() { CloseHelper.closeAll(aeron, driver); driver.context().deleteDirectory(); }
Example 16
Source File: PublicationUnblockTest.java From aeron with Apache License 2.0 | 4 votes |
@AfterEach public void after() { CloseHelper.closeAll(aeron, driver); driver.context().deleteDirectory(); }
Example 17
Source File: WildcardPortsSystemTest.java From aeron with Apache License 2.0 | 4 votes |
@AfterEach void tearDown() { CloseHelper.closeAll(client, driver); }
Example 18
Source File: SessionSpecificSubscriptionTest.java From aeron with Apache License 2.0 | 4 votes |
@AfterEach public void after() { CloseHelper.closeAll(aeron, driver); driver.context().deleteDirectory(); }
Example 19
Source File: MaxPositionPublicationTest.java From aeron with Apache License 2.0 | 4 votes |
@AfterEach public void after() { CloseHelper.closeAll(aeron, driver); driver.context().deleteDirectory(); }
Example 20
Source File: MinFlowControlSystemTest.java From aeron with Apache License 2.0 | 4 votes |
@SuppressWarnings("methodlength") @Test @Timeout(20) void shouldPreventConnectionUntilGroupMinSizeIsMet() { final Integer groupSize = 3; final ChannelUriStringBuilder builder = new ChannelUriStringBuilder() .media("udp") .endpoint("224.20.30.39:24326") .networkInterface("localhost"); final String uriPlain = builder .flowControl((String)null) .build(); final String uriWithMinFlowControl = builder .groupTag((Long)null) .minFlowControl(groupSize, null) .build(); driverBContext.imageLivenessTimeoutNs(TimeUnit.MILLISECONDS.toNanos(500)); launch(); final CountersReader countersReader = clientA.countersReader(); TestMediaDriver driverC = null; Aeron clientC = null; Publication publication = null; Subscription subscription0 = null; Subscription subscription1 = null; Subscription subscription2 = null; try { driverC = TestMediaDriver.launch( new MediaDriver.Context().publicationTermBufferLength(TERM_BUFFER_LENGTH) .aeronDirectoryName(ROOT_DIR + "C") .timerIntervalNs(TimeUnit.MILLISECONDS.toNanos(100)) .errorHandler(Tests::onError) .threadingMode(ThreadingMode.SHARED), testWatcher); clientC = Aeron.connect( new Aeron.Context() .aeronDirectoryName(driverC.aeronDirectoryName())); subscription0 = clientA.addSubscription(uriPlain, STREAM_ID); subscription1 = clientB.addSubscription(uriPlain, STREAM_ID); publication = clientA.addPublication(uriWithMinFlowControl, STREAM_ID); awaitConnectionAndStatusMessages(countersReader, subscription0, subscription1); assertFalse(publication.isConnected()); subscription2 = clientC.addSubscription(uriPlain, STREAM_ID); // Should now have 3 receivers and publication should eventually be connected. while (!publication.isConnected()) { Tests.sleep(1); } subscription2.close(); subscription2 = null; // Lost a receiver and publication should eventually be disconnected. while (publication.isConnected()) { Tests.sleep(1); } subscription2 = clientC.addSubscription(uriPlain, STREAM_ID); while (!publication.isConnected()) { Tests.sleep(1); } } finally { CloseHelper.closeAll( publication, subscription0, subscription1, subscription2, clientC, driverC); } }