本文整理汇总了Java中org.agrona.CloseHelper.close方法的典型用法代码示例。如果您正苦于以下问题:Java CloseHelper.close方法的具体用法?Java CloseHelper.close怎么用?Java CloseHelper.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.agrona.CloseHelper
的用法示例。
在下文中一共展示了CloseHelper.close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: libraryDetectsEngineDisconnect
import org.agrona.CloseHelper; //导入方法依赖的package包/类
@Test
public void libraryDetectsEngineDisconnect()
{
library = connectLibrary();
awaitLibraryConnect(library);
CloseHelper.close(engine);
assertEventuallyTrue(
() -> "Engine still hasn't disconnected",
() ->
{
library.poll(5);
return !library.isConnected();
},
AWAIT_TIMEOUT,
() ->
{
}
);
}
示例2: close
import org.agrona.CloseHelper; //导入方法依赖的package包/类
public synchronized void close(final int libraryId)
{
final Agent agentToRemove = libraryIdToDelegateAgent.remove(libraryId);
if (agentToRemove != null)
{
while (!dynamicAgent.tryRemove(agentToRemove))
{
Thread.yield();
}
while (!dynamicAgent.hasRemoveAgentCompleted())
{
Thread.yield();
}
if (libraryIdToDelegateAgent.isEmpty())
{
CloseHelper.close(runner);
runner = null;
}
}
}
示例3: after
import org.agrona.CloseHelper; //导入方法依赖的package包/类
@After
public void after()
{
CloseHelper.close(aeronCluster);
CloseHelper.close(container);
CloseHelper.close(clusteredMediaDriver);
if (null != container)
{
container.context().deleteDirectory();
}
clusteredMediaDriver.consensusModule().context().deleteDirectory();
clusteredMediaDriver.archive().context().deleteArchiveDirectory();
clusteredMediaDriver.mediaDriver().context().deleteAeronDirectory();
}
示例4: close
import org.agrona.CloseHelper; //导入方法依赖的package包/类
@Override
public void close() throws IOException
{
positionInFile = 0;
journalAllocator.reset();
CloseHelper.close(currentJournal);
currentJournal = null;
}
示例5: roll
import org.agrona.CloseHelper; //导入方法依赖的package包/类
private void roll() throws IOException
{
CloseHelper.close(currentJournal);
if (lastJournalReached() && handler != null)
{
handler.onJournalDepletion(this);
}
currentJournal = journalAllocator.getNextJournal();
}
示例6: close
import org.agrona.CloseHelper; //导入方法依赖的package包/类
@Override
public void close() throws Exception
{
running = false;
processorThread.join();
CloseHelper.close(handler);
}
示例7: shouldRotateNextJournalNumber
import org.agrona.CloseHelper; //导入方法依赖的package包/类
private static <T extends Closeable> void shouldRotateNextJournalNumber(final JournalAllocator<T> allocator) throws IOException
{
assertThat(allocator.nextJournalNumber(), is(0));
for (int i = 0; i < JOURNAL_COUNT; i++)
{
final T nextJournal = allocator.getNextJournal();
assertThat(allocator.nextJournalNumber(), is((i + 1 < JOURNAL_COUNT) ? (i + 1) : 0));
CloseHelper.close(nextJournal);
}
assertThat(allocator.nextJournalNumber(), is(0));
}
示例8: close
import org.agrona.CloseHelper; //导入方法依赖的package包/类
@After
public void close()
{
CloseHelper.close(initiatingLibrary);
CloseHelper.close(acceptingLibrary);
CloseHelper.close(initiatingEngine);
CloseHelper.close(acceptingEngine);
cleanupMediaDriver(mediaDriver);
}
示例9: shouldCleanupLibrary
import org.agrona.CloseHelper; //导入方法依赖的package包/类
@Test
public void shouldCleanupLibrary()
{
final MediaDriver mediaDriver = TestFixtures.launchMediaDriver();
try
{
final LibraryConfiguration configuration = new LibraryConfiguration()
.libraryAeronChannels(singletonList(IPC_CHANNEL));
final FixLibrary library = FixLibrary.connect(configuration);
final File monitoringFile = new File(configuration.monitoringFile());
final File histogramLoggingFile = new File(configuration.histogramLoggingFile());
try
{
assertTrue(monitoringFile + " does not exist", monitoringFile.exists());
}
finally
{
CloseHelper.close(library);
}
assertFalse(monitoringFile + " hasn't been deleted", monitoringFile.exists());
assertFalse(histogramLoggingFile + " hasn't been deleted", histogramLoggingFile.exists());
}
finally
{
TestFixtures.cleanupMediaDriver(mediaDriver);
}
}
示例10: onClose
import org.agrona.CloseHelper; //导入方法依赖的package包/类
public void onClose()
{
if (!isClosed)
{
quiesce();
sessionIdToArchive.clear();
metaData.close();
CloseHelper.close(subscription);
isClosed = true;
}
}
示例11: close
import org.agrona.CloseHelper; //导入方法依赖的package包/类
public void close()
{
try
{
logFile.force(true);
}
catch (final IOException ex)
{
errorHandler.onError(ex);
}
CloseHelper.close(logFile);
}
示例12: close
import org.agrona.CloseHelper; //导入方法依赖的package包/类
public void close()
{
failedInboundPublications.close();
failedOutboundPublications.close();
failedReplayPublications.close();
CloseHelper.close(failedRaftPublications);
}
示例13: close
import org.agrona.CloseHelper; //导入方法依赖的package包/类
public void close()
{
completionPosition.complete(new Long2LongHashMap(-1));
while (!guard.compareAndSet(false, true))
{
Thread.yield();
}
clusterAgent.onClose();
CloseHelper.close(aeron);
cleanupMediaDriver(mediaDriver);
}
示例14: tearDown
import org.agrona.CloseHelper; //导入方法依赖的package包/类
@After
public void tearDown()
{
CloseHelper.close(archiveReader);
archiver.onClose();
CloseHelper.close(filteredArchiveReader);
CloseHelper.close(aeron);
cleanupMediaDriver(mediaDriver);
deleteLogFileDir();
}
示例15: tearDown
import org.agrona.CloseHelper; //导入方法依赖的package包/类
@After
public void tearDown()
{
try
{
writer.onClose();
CloseHelper.close(reader);
}
finally
{
file.delete();
}
}