本文整理汇总了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);
}
}
示例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;
}
示例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;
}
示例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)));
}
}
示例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)));
}
}
示例6: SocketOwnedByCurrentProcessFilter
import org.agrona.collections.LongHashSet; //导入依赖的package包/类
public SocketOwnedByCurrentProcessFilter(final UdpSocketStatisticsHandler delegate,
final Consumer<LongHashSet> socketInodeRetriever)
{
this.delegate = delegate;
this.socketInodeRetriever = socketInodeRetriever;
}
示例7: SocketOwnedByCurrentProcessFilter
import org.agrona.collections.LongHashSet; //导入依赖的package包/类
public SocketOwnedByCurrentProcessFilter(final TcpSocketStatisticsHandler delegate,
final Consumer<LongHashSet> socketInodeRetriever)
{
this.delegate = delegate;
this.socketInodeRetriever = socketInodeRetriever;
}
示例8: populateSocketInodes
import org.agrona.collections.LongHashSet; //导入依赖的package包/类
private void populateSocketInodes(final LongHashSet socketInodes)
{
socketInodes.add(INODE_OWNED_BY_PROCESS);
socketInodeRequestCount++;
}
示例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);
}
}
示例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));
}