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


Java CloseHelper类代码示例

本文整理汇总了Java中org.agrona.CloseHelper的典型用法代码示例。如果您正苦于以下问题:Java CloseHelper类的具体用法?Java CloseHelper怎么用?Java CloseHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CloseHelper类属于org.agrona包,在下文中一共展示了CloseHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: close

import org.agrona.CloseHelper; //导入依赖的package包/类
@Override
public void close()
{
    CloseHelper.quietClose(reporter);

    gatewayList.forEach(CloseHelper::quietClose);
    gatewayList.clear();
    gatewaySubscriptionRepository.clear();

    serviceList.forEach(CloseHelper::quietClose);
    serviceList.clear();
    serviceSubscriptionRepository.clear();

    CloseHelper.quietClose(aeron);
    CloseHelper.quietClose(driver);
}
 
开发者ID:canepat,项目名称:Helios,代码行数:17,代码来源:Helios.java

示例2: 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

示例3: 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

示例4: close

import org.agrona.CloseHelper; //导入依赖的package包/类
/**
 * Notify the archive that this control session is closed so it can promptly release resources then close the
 * local resources associated with the client.
 */
public void close()
{
    lock.lock();
    try
    {
        archiveProxy.closeSession(controlSessionId);

        if (!context.ownsAeronClient())
        {
            CloseHelper.close(controlResponsePoller.subscription());
            CloseHelper.close(archiveProxy.publication());
        }

        CloseHelper.close(context);
    }
    finally
    {
        lock.unlock();
    }
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:25,代码来源:AeronArchive.java

示例5: closeOnError

import org.agrona.CloseHelper; //导入依赖的package包/类
private void closeOnError(final Throwable ex, final String errorMessage)
{
    state = State.INACTIVE;
    CloseHelper.quietClose(replayPublication);

    if (null != cursor)
    {
        cursor.close();
    }

    if (!controlSession.isDone())
    {
        controlSession.sendResponse(
            correlationId,
            ControlResponseCode.ERROR,
            errorMessage,
            threadLocalControlResponseProxy);
    }

    if (ex != null)
    {
        LangUtil.rethrowUnchecked(ex);
    }
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:25,代码来源:ReplaySession.java

示例6: newRecordingSegmentFile

import org.agrona.CloseHelper; //导入依赖的package包/类
private void newRecordingSegmentFile()
{
    final File file = new File(archiveDir, segmentFileName(recordingId, segmentIndex));

    RandomAccessFile recordingFile = null;
    try
    {
        recordingFile = new RandomAccessFile(file, "rw");
        recordingFile.setLength(segmentFileLength + DataHeaderFlyweight.HEADER_LENGTH);
        recordingFileChannel = recordingFile.getChannel();
        if (forceWrites && null != archiveDirChannel)
        {
            archiveDirChannel.force(forceMetadata);
        }
    }
    catch (final IOException ex)
    {
        CloseHelper.quietClose(recordingFile);
        close();
        LangUtil.rethrowUnchecked(ex);
    }
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:23,代码来源:RecordingWriter.java

示例7: close

import org.agrona.CloseHelper; //导入依赖的package包/类
/**
 * Close session and release associated resources.
 */
public void close()
{
    lock.lock();
    try
    {
        if (publication.isConnected())
        {
            closeSession();
        }

        if (!ctx.ownsAeronClient())
        {
            CloseHelper.close(subscription);
            CloseHelper.close(publication);
        }

        ctx.close();
    }
    finally
    {
        lock.unlock();
    }
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:27,代码来源:AeronCluster.java

示例8: 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

示例9: close

import org.agrona.CloseHelper; //导入依赖的package包/类
/**
 * Stop the server
 * @throws Exception
 */
@Override
public void close() throws Exception {
    if (subscriber != null) {
        for (int i = 0; i < subscriber.length; i++) {
            if (subscriber[i] != null) {
                subscriber[i].close();
            }
        }
    }
    if (server != null)
        server.stop();
    if (mediaDriver != null)
        CloseHelper.quietClose(mediaDriver);
    if (aeron != null)
        CloseHelper.quietClose(aeron);

}
 
开发者ID:deeplearning4j,项目名称:nd4j,代码行数:22,代码来源:ParameterServerNode.java

示例10: close

import org.agrona.CloseHelper; //导入依赖的package包/类
@Override
public void close() throws Exception
{
    writeBatchingBuffer();
    journalling.flush();

    CloseHelper.quietClose(journalling);
    DirectBufferAllocator.free(batchingBuffer);
}
 
开发者ID:canepat,项目名称:Helios,代码行数:10,代码来源:JournalWriter.java

示例11: close

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

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

示例12: 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

示例13: 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

示例14: close

import org.agrona.CloseHelper; //导入依赖的package包/类
@Override
public void close() throws Exception
{
    CloseHelper.quietClose(journalling);
    DirectBufferAllocator.free(readBuffer1.byteBuffer());
    DirectBufferAllocator.free(readBuffer2.byteBuffer());
}
 
开发者ID:canepat,项目名称:Helios,代码行数:8,代码来源:JournalReader.java

示例15: close

import org.agrona.CloseHelper; //导入依赖的package包/类
@Override
public void close()
{
    gwInputProcessorList.forEach(CloseHelper::quietClose);
    gwOutputProcessorList.forEach(CloseHelper::quietClose);
    eventProcessorList.forEach(CloseHelper::quietClose);
    gatewayProcessorList.forEach(CloseHelper::quietClose);
}
 
开发者ID:canepat,项目名称:Helios,代码行数:9,代码来源:HeliosGateway.java


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