feat: Makes the single-port harvester's sockets' receive buffer sizes
configurable.
This commit is contained in:
parent
38cfe178c6
commit
84ca00a325
@ -76,6 +76,14 @@ public class SinglePortUdpHarvester
|
|||||||
*/
|
*/
|
||||||
private static final int POOL_SIZE = 256;
|
private static final int POOL_SIZE = 256;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the property which controls the size of the receive buffer
|
||||||
|
* which {@link SinglePortUdpHarvester} will request for the sockets that
|
||||||
|
* it creates.
|
||||||
|
*/
|
||||||
|
private static final String SO_RCVBUF_PNAME
|
||||||
|
= SinglePortUdpHarvester.class.getName() + ".SO_RCVBUF";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new <tt>SinglePortUdpHarvester</tt> instance for each allowed
|
* Creates a new <tt>SinglePortUdpHarvester</tt> instance for each allowed
|
||||||
* IP address found on each allowed network interface, with the given port.
|
* IP address found on each allowed network interface, with the given port.
|
||||||
@ -200,9 +208,23 @@ public class SinglePortUdpHarvester
|
|||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
this.localAddress = localAddress;
|
this.localAddress = localAddress;
|
||||||
this.socket = new DatagramSocket(localAddress);
|
socket = new DatagramSocket(localAddress);
|
||||||
logger.info("Initialized SinglePortUdpHarvester with address "
|
|
||||||
+ localAddress);
|
|
||||||
|
int receiveBufferSize = StackProperties.getInt(SO_RCVBUF_PNAME, -1);
|
||||||
|
if (receiveBufferSize > 0)
|
||||||
|
{
|
||||||
|
socket.setReceiveBufferSize(receiveBufferSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
String logMessage
|
||||||
|
= "Initialized SinglePortUdpHarvester with address " + localAddress;
|
||||||
|
logMessage += ". Receive buffer size " + socket.getReceiveBufferSize();
|
||||||
|
if (receiveBufferSize > 0)
|
||||||
|
{
|
||||||
|
logMessage += " (asked for " + receiveBufferSize + ")";
|
||||||
|
}
|
||||||
|
logger.info(logMessage);
|
||||||
|
|
||||||
thread = new Thread()
|
thread = new Thread()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user