當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。