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


Java LongHashSet类代码示例

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


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

示例1: accept

import org.agrona.collections.LongHashSet; //导入依赖的package包/类
/**
 * Clear and populate the supplied LongHashSet with the inodes associated with sockets owned by this process.
 * @param targetForOwnedSocketInodes the container for the retrieved inodes
 */
@Override
public void accept(final LongHashSet targetForOwnedSocketInodes)
{
    targetForOwnedSocketInodes.clear();
    try
    {
        Files.list(Paths.get("/proc/self/fd")).
                filter(Files::isSymbolicLink).
                mapToLong(CurrentProcessSocketInodeRetriever::socketLinkInode).
                filter(inode -> inode != NOT_A_SOCKET).
                forEach(targetForOwnedSocketInodes::add);
    }
    catch(final IOException e)
    {
        throw new UncheckedIOException(e);
    }
}
 
开发者ID:LMAX-Exchange,项目名称:angler,代码行数:22,代码来源:CurrentProcessSocketInodeRetriever.java

示例2: EndPointFactory

import org.agrona.collections.LongHashSet; //导入依赖的package包/类
EndPointFactory(
    final EngineConfiguration configuration,
    final SessionContexts sessionContexts,
    final GatewayPublication inboundLibraryPublication,
    final GatewayPublication inboundClusterablePublication,
    final FixCounters fixCounters,
    final ErrorHandler errorHandler,
    final LongHashSet replicatedConnectionIds,
    final GatewaySessions gatewaySessions)
{
    this.configuration = configuration;
    this.sessionContexts = sessionContexts;
    this.inboundLibraryPublication = inboundLibraryPublication;
    this.inboundClusterablePublication = inboundClusterablePublication;
    this.fixCounters = fixCounters;
    this.errorHandler = errorHandler;
    this.replicatedConnectionIds = replicatedConnectionIds;
    this.gatewaySessions = gatewaySessions;
}
 
开发者ID:real-logic,项目名称:artio,代码行数:20,代码来源:EndPointFactory.java

示例3: SubscriptionSplitter

import org.agrona.collections.LongHashSet; //导入依赖的package包/类
SubscriptionSplitter(
    final ClusterableStreams clusterableStreams,
    final EngineProtocolSubscription engineProtocolSubscription,
    final ClusterablePublication clusterPublication,
    final GatewayPublication replyToLibraryPublication,
    final EngineDescriptorStore engineDescriptorStore,
    final String bindAddress,
    final LongHashSet replicatedConnectionIds)
{
    this.clusterableStreams = clusterableStreams;
    this.engineProtocolSubscription = engineProtocolSubscription;
    this.clusterPublication = clusterPublication;
    this.replyToLibraryPublication = replyToLibraryPublication;
    this.engineDescriptorStore = engineDescriptorStore;
    this.bindAddress = bindAddress;
    this.replicatedConnectionIds = replicatedConnectionIds;
}
 
开发者ID:real-logic,项目名称:artio,代码行数:18,代码来源:SubscriptionSplitter.java

示例4: shouldFindSocketInodeValue

import org.agrona.collections.LongHashSet; //导入依赖的package包/类
@Test
public void shouldFindSocketInodeValue() throws Exception
{
    try(final DatagramChannel channel = DatagramChannel.open().bind(new InetSocketAddress(55555)))
    {
        final LongHashSet target = new LongHashSet(4);

        retriever.accept(target);

        assertThat(target.size(), is(atLeast(1)));
    }
}
 
开发者ID:LMAX-Exchange,项目名称:angler,代码行数:13,代码来源:CurrentProcessSocketInodeRetrieverTest.java

示例5: shouldFindMultipleSocketInodeValues

import org.agrona.collections.LongHashSet; //导入依赖的package包/类
@Test
public void shouldFindMultipleSocketInodeValues() throws Exception
{
    try(final DatagramChannel channel1 = DatagramChannel.open().bind(new InetSocketAddress(55555));
        final DatagramChannel channel2 = DatagramChannel.open().bind(new InetSocketAddress(44444)))
    {
        final LongHashSet target = new LongHashSet(4);

        retriever.accept(target);

        assertThat(target.size(), is(atLeast(2)));
    }
}
 
开发者ID:LMAX-Exchange,项目名称:angler,代码行数:14,代码来源:CurrentProcessSocketInodeRetrieverTest.java

示例6: SocketOwnedByCurrentProcessFilter

import org.agrona.collections.LongHashSet; //导入依赖的package包/类
public SocketOwnedByCurrentProcessFilter(final UdpSocketStatisticsHandler delegate,
                                         final Consumer<LongHashSet> socketInodeRetriever)
{
    this.delegate = delegate;
    this.socketInodeRetriever = socketInodeRetriever;
}
 
开发者ID:LMAX-Exchange,项目名称:angler,代码行数:7,代码来源:SocketOwnedByCurrentProcessFilter.java

示例7: SocketOwnedByCurrentProcessFilter

import org.agrona.collections.LongHashSet; //导入依赖的package包/类
public SocketOwnedByCurrentProcessFilter(final TcpSocketStatisticsHandler delegate,
                                         final Consumer<LongHashSet> socketInodeRetriever)
{
    this.delegate = delegate;
    this.socketInodeRetriever = socketInodeRetriever;
}
 
开发者ID:LMAX-Exchange,项目名称:angler,代码行数:7,代码来源:SocketOwnedByCurrentProcessFilter.java

示例8: populateSocketInodes

import org.agrona.collections.LongHashSet; //导入依赖的package包/类
private void populateSocketInodes(final LongHashSet socketInodes)
{
    socketInodes.add(INODE_OWNED_BY_PROCESS);
    socketInodeRequestCount++;
}
 
开发者ID:LMAX-Exchange,项目名称:angler,代码行数:6,代码来源:SocketOwnedByCurrentProcessFilterTest.java

示例9: ReceiverEndPoint

import org.agrona.collections.LongHashSet; //导入依赖的package包/类
ReceiverEndPoint(
    final TcpChannel channel,
    final int bufferSize,
    final GatewayPublication libraryPublication,
    final GatewayPublication clusterablePublication,
    final long connectionId,
    final long sessionId,
    final int sequenceIndex,
    final SessionContexts sessionContexts,
    final SequenceNumberIndexReader sentSequenceNumberIndex,
    final SequenceNumberIndexReader receivedSequenceNumberIndex,
    final AtomicCounter messagesRead,
    final Framer framer,
    final ErrorHandler errorHandler,
    final int libraryId,
    final SequenceNumberType sequenceNumberType,
    final ConnectionType connectionType,
    final LongHashSet replicatedConnectionIds,
    final GatewaySessions gatewaySessions)
{
    Objects.requireNonNull(clusterablePublication, "clusterablePublication");
    Objects.requireNonNull(libraryPublication, "libraryPublication");
    Objects.requireNonNull(sessionContexts, "sessionContexts");
    Objects.requireNonNull(gatewaySessions, "gatewaySessions");

    this.channel = channel;
    this.clusterablePublication = clusterablePublication;
    this.libraryPublication = libraryPublication;
    this.connectionId = connectionId;
    this.sessionId = sessionId;
    this.sequenceIndex = sequenceIndex;
    this.sessionContexts = sessionContexts;
    this.sentSequenceNumberIndex = sentSequenceNumberIndex;
    this.receivedSequenceNumberIndex = receivedSequenceNumberIndex;
    this.messagesRead = messagesRead;
    this.framer = framer;
    this.errorHandler = errorHandler;
    this.libraryId = libraryId;
    this.replicatedConnectionIds = replicatedConnectionIds;
    this.gatewaySessions = gatewaySessions;

    byteBuffer = ByteBuffer.allocateDirect(bufferSize);
    buffer = new MutableAsciiBuffer(byteBuffer);

    // Initiator sessions are persistent if the sequence numbers are expected to be persistent.
    if (connectionType == INITIATOR)
    {
        choosePublication(sequenceNumberType == TRANSIENT ? LOCAL_ARCHIVE : REPLICATED);
    }
}
 
开发者ID:real-logic,项目名称:artio,代码行数:51,代码来源:ReceiverEndPoint.java

示例10: setUp

import org.agrona.collections.LongHashSet; //导入依赖的package包/类
@Before
@SuppressWarnings("unchecked")
public void setUp() throws IOException
{
    server = ServerSocketChannel.open().bind(TEST_ADDRESS);
    server.configureBlocking(false);

    clientBuffer.putInt(10, 5);

    when(outboundSlowSubscription.hasNoImages()).thenReturn(false);
    when(outboundSlowSubscription.imageBySessionId(anyInt())).thenReturn(peekImage);
    when(outboundLibrarySubscription.imageBySessionId(anyInt())).thenReturn(normalImage);

    when(mockEndPointFactory.receiverEndPoint(
        any(), connectionId.capture(), anyLong(), anyInt(), anyInt(), any(),
        eq(sentSequenceNumberIndex), eq(receivedSequenceNumberIndex), any(), any()))
        .thenReturn(mockReceiverEndPoint);

    when(mockEndPointFactory.senderEndPoint(any(), anyLong(), anyInt(), any(), any()))
        .thenReturn(mockSenderEndPoint);

    when(mockReceiverEndPoint.connectionId()).then((inv) -> connectionId.getValue());

    when(mockSenderEndPoint.connectionId()).then((inv) -> connectionId.getValue());

    when(mockReceiverEndPoint.libraryId()).thenReturn(LIBRARY_ID);

    when(gatewaySession.session()).thenReturn(session);

    when(session.logonTime()).thenReturn(-1L);
    when(session.compositeKey()).thenReturn(sessionKey);

    isLeader(true);

    framer = new Framer(
        mockClock,
        mock(Timer.class),
        mock(Timer.class),
        engineConfiguration,
        mockEndPointFactory,
        node,
        null,
        null,
        outboundLibrarySubscription,
        outboundSlowSubscription,
        replayImage,
        replaySlowImage,
        replayQuery,
        mock(GatewayPublication.class),
        inboundPublication,
        mock(QueuedPipe.class),
        mockSessionIdStrategy,
        sessionContexts,
        sentSequenceNumberIndex,
        receivedSequenceNumberIndex,
        gatewaySessions,
        errorHandler,
        mock(EngineDescriptorStore.class),
        new LongHashSet(),
        DEFAULT_NAME_PREFIX,
        mock(CompletionPosition.class),
        mock(CompletionPosition.class),
        mock(CompletionPosition.class),
        finalImagePositions,
        mock(AgentInvoker.class));

    when(sessionContexts.onLogon(any())).thenReturn(new SessionContext(SESSION_ID,
        SessionContext.UNKNOWN_SEQUENCE_INDEX,
        Session.NO_LOGON_TIME,
        sessionContexts,
        0));
}
 
开发者ID:real-logic,项目名称:artio,代码行数:73,代码来源:FramerTest.java


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