MultiDestination.java 文件源码

java
阅读 17 收藏 0 点赞 0 评论 0

项目:aeron 作者:
int send(
    final DatagramChannel datagramChannel,
    final ByteBuffer buffer,
    final SendChannelEndpoint channelEndpoint,
    final int bytesToSend)
{
    final int position = buffer.position();
    int minBytesSent = bytesToSend;

    for (final InetSocketAddress destination : destinations)
    {
        int bytesSent = 0;
        try
        {
            channelEndpoint.presend(buffer, destination);

            buffer.position(position);
            bytesSent = datagramChannel.send(buffer, destination);
        }
        catch (final PortUnreachableException | ClosedChannelException ignore)
        {
        }
        catch (final IOException ex)
        {
            throw new RuntimeException("Failed to send: " + bytesToSend, ex);
        }

        minBytesSent = Math.min(minBytesSent, bytesSent);
    }

    return minBytesSent;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号