我看不到方法在哪里执行 Aeron 低延迟库
I don't see where a method is executed Aeron low latency library
早上好,
我正在尝试了解低延迟库 aeron,我有一个 class 出版物的实例:
Publication publication=new Publication(CHANNEL, STREAM_ID);
其中:
CHANNEL=System.getProperty("aeron.sample.channel", "aeron:udp?endpoint=224.0.1.1:40456");
和
STREAM_ID=Integer.getInteger("aeron.sample.streamId", 10);
创建实例后,发送消息的作用是:
String a="What I want to send"; //Text that I want to send
bytes[] aBytes=a.getBytes(); // Convert the string to an array of bytes
UnsafeBuffer BUFFER = new UnsafeBuffer(BufferUtil.allocateDirectAligned(256, 64)); //Create an UnsafeBuffer (https://github.com/real-logic/agrona/blob/master/agrona/src/main/java/org/agrona/concurrent/UnsafeBuffer.java)
BUFFER.putBytes(0, aBytes); //Put the Bytes of the array of bytes that contains the text intro tje BUFFER
final long result = publication.offer(BUFFER, 0, messageBytes.length); //This is the last line of the code to send the message, so I guess that this line is used to send the message to the mediaDriver.
我想了解最后一行代码是如何工作的,方法 offer() 在以下文件中:https://github.com/real-logic/aeron/blob/master/aeron-client/src/main/java/io/aeron/Publication.java
在第373行有如下方法:
public final long offer(final DirectBuffer buffer, final int offset, final int length)
{
return offer(buffer, offset, length, null);
}
那个 returns 函数,如果我在 Publication.java 文件中搜索这个函数,我只找到以下内容:
public abstract long offer(DirectBuffer buffer, int offset, int length, ReservedValueSupplier reservedValueSupplier);
这是一个抽象方法,我不知道在哪里可以找到它的定义。
如果有人能帮助我,我将不胜感激以了解该库的工作原理。
我敢打赌你已经找到了所有答案,但以防将来的搜索者:
发布 class 有 2 个实现:
我可以推荐观看 Martin 关于 Aeron 工作原理的视频 https://www.youtube.com/watch?v=tM4YskS94b0
早上好,
我正在尝试了解低延迟库 aeron,我有一个 class 出版物的实例:
Publication publication=new Publication(CHANNEL, STREAM_ID);
其中:
CHANNEL=System.getProperty("aeron.sample.channel", "aeron:udp?endpoint=224.0.1.1:40456");
和
STREAM_ID=Integer.getInteger("aeron.sample.streamId", 10);
创建实例后,发送消息的作用是:
String a="What I want to send"; //Text that I want to send
bytes[] aBytes=a.getBytes(); // Convert the string to an array of bytes
UnsafeBuffer BUFFER = new UnsafeBuffer(BufferUtil.allocateDirectAligned(256, 64)); //Create an UnsafeBuffer (https://github.com/real-logic/agrona/blob/master/agrona/src/main/java/org/agrona/concurrent/UnsafeBuffer.java)
BUFFER.putBytes(0, aBytes); //Put the Bytes of the array of bytes that contains the text intro tje BUFFER
final long result = publication.offer(BUFFER, 0, messageBytes.length); //This is the last line of the code to send the message, so I guess that this line is used to send the message to the mediaDriver.
我想了解最后一行代码是如何工作的,方法 offer() 在以下文件中:https://github.com/real-logic/aeron/blob/master/aeron-client/src/main/java/io/aeron/Publication.java
在第373行有如下方法:
public final long offer(final DirectBuffer buffer, final int offset, final int length)
{
return offer(buffer, offset, length, null);
}
那个 returns 函数,如果我在 Publication.java 文件中搜索这个函数,我只找到以下内容:
public abstract long offer(DirectBuffer buffer, int offset, int length, ReservedValueSupplier reservedValueSupplier);
这是一个抽象方法,我不知道在哪里可以找到它的定义。
如果有人能帮助我,我将不胜感激以了解该库的工作原理。
我敢打赌你已经找到了所有答案,但以防将来的搜索者:
发布 class 有 2 个实现:
我可以推荐观看 Martin 关于 Aeron 工作原理的视频 https://www.youtube.com/watch?v=tM4YskS94b0