当前位置: 首页>>代码示例>>Java>>正文


Java CloseHelper.close方法代码示例

本文整理汇总了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,
        () ->
        {
        }
    );
}
 
开发者ID:real-logic,项目名称:artio,代码行数:23,代码来源:EngineAndLibraryIntegrationTest.java

示例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;
        }
    }
}
 
开发者ID:real-logic,项目名称:artio,代码行数:24,代码来源:DynamicLibraryScheduler.java

示例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();
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:17,代码来源:ClusterNodeTest.java

示例4: close

import org.agrona.CloseHelper; //导入方法依赖的package包/类
@Override
public void close() throws IOException
{
    positionInFile = 0;
    journalAllocator.reset();

    CloseHelper.close(currentJournal);
    currentJournal = null;
}
 
开发者ID:canepat,项目名称:Helios,代码行数:10,代码来源:AbstractJournalling.java

示例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();
}
 
开发者ID:canepat,项目名称:Helios,代码行数:12,代码来源:AbstractJournalling.java

示例6: close

import org.agrona.CloseHelper; //导入方法依赖的package包/类
@Override
public void close() throws Exception
{
    running = false;
    processorThread.join();

    CloseHelper.close(handler);
}
 
开发者ID:canepat,项目名称:Helios,代码行数:9,代码来源:RingBufferProcessor.java

示例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));
}
 
开发者ID:canepat,项目名称:Helios,代码行数:16,代码来源:JournalAllocatorTest.java

示例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);
}
 
开发者ID:real-logic,项目名称:artio,代码行数:12,代码来源:AbstractGatewayToGatewaySystemTest.java

示例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);
    }
}
 
开发者ID:real-logic,项目名称:artio,代码行数:31,代码来源:FixLibraryCleanupTest.java

示例10: onClose

import org.agrona.CloseHelper; //导入方法依赖的package包/类
public void onClose()
{
    if (!isClosed)
    {
        quiesce();

        sessionIdToArchive.clear();
        metaData.close();
        CloseHelper.close(subscription);

        isClosed = true;
    }
}
 
开发者ID:real-logic,项目名称:artio,代码行数:14,代码来源:Archiver.java

示例11: close

import org.agrona.CloseHelper; //导入方法依赖的package包/类
public void close()
{
    try
    {
        logFile.force(true);
    }
    catch (final IOException ex)
    {
        errorHandler.onError(ex);
    }

    CloseHelper.close(logFile);
}
 
开发者ID:real-logic,项目名称:artio,代码行数:14,代码来源:HistogramLogWriter.java

示例12: close

import org.agrona.CloseHelper; //导入方法依赖的package包/类
public void close()
{
    failedInboundPublications.close();
    failedOutboundPublications.close();
    failedReplayPublications.close();
    CloseHelper.close(failedRaftPublications);
}
 
开发者ID:real-logic,项目名称:artio,代码行数:8,代码来源:FixCounters.java

示例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);
}
 
开发者ID:real-logic,项目名称:artio,代码行数:14,代码来源:NodeRunner.java

示例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();
}
 
开发者ID:real-logic,项目名称:artio,代码行数:13,代码来源:ArchiverTest.java

示例15: tearDown

import org.agrona.CloseHelper; //导入方法依赖的package包/类
@After
public void tearDown()
{
    try
    {
        writer.onClose();
        CloseHelper.close(reader);
    }
    finally
    {
        file.delete();
    }
}
 
开发者ID:real-logic,项目名称:artio,代码行数:14,代码来源:HistogramLoggingTest.java


注:本文中的org.agrona.CloseHelper.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。