本文整理汇总了Java中org.agrona.CloseHelper类的典型用法代码示例。如果您正苦于以下问题:Java CloseHelper类的具体用法?Java CloseHelper怎么用?Java CloseHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CloseHelper类属于org.agrona包,在下文中一共展示了CloseHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: 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
示例17: close
import org.agrona.CloseHelper; //导入依赖的package包/类
@Override
public void close() throws Exception
{
running = false;
processorThread.join();
CloseHelper.quietClose(inputSubscription);
}
开发者ID:canepat,项目名称:Helios,代码行数:9,代码来源:InputMessageProcessor.java
示例18: close
import org.agrona.CloseHelper; //导入依赖的package包/类
@Override
public void close()
{
snapshotTimer.close();
timerWheelRunning.set(false);
timerExecutor.shutdown();
CloseHelper.quietClose(svcInputProcessor);
gwResponseProcessorList.forEach(CloseHelper::quietClose);
eventProcessorList.forEach(CloseHelper::quietClose);
CloseHelper.quietClose(journalProcessor);
CloseHelper.quietClose(replicaProcessor);
CloseHelper.quietClose(serviceProcessor);
}
开发者ID:canepat,项目名称:Helios,代码行数:15,代码来源:HeliosService.java
示例19: 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
示例20: shutdown
import org.agrona.CloseHelper; //导入依赖的package包/类
public void shutdown() throws InterruptedException {
CloseHelper.quietClose(subscription);
CloseHelper.quietClose(publication);
CloseHelper.quietClose(aeron);
CloseHelper.quietClose(ctx);
CloseHelper.quietClose(driver);
}
开发者ID:benalexau,项目名称:rpc-bench,代码行数:8,代码来源:BenchServer.java
注:本文中的org.agrona.CloseHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论