public abstract class AbstractProtocol extends java.lang.Object implements Protocol
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
group |
protected int |
port |
private java.net.DatagramSocket |
socket |
protected java.net.InetAddress |
udpAddr |
| Constructor and Description |
|---|
AbstractProtocol(java.lang.String group,
int port,
GMetric.UDPAddressingMode mode,
int ttl) |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
announce(java.lang.String name,
java.lang.String value,
GMetricType type,
java.lang.String units,
GMetricSlope slope,
int tmax,
int dmax,
java.lang.String groupName)
Announces a metric
|
void |
close()
Closes the underlying socket to prevent socket leaks.
|
protected void |
finalize() |
protected void |
send(byte[] buf,
int len)
Sends the provided byte buffer
|
protected java.net.InetAddress udpAddr
protected int port
protected java.lang.String group
private java.net.DatagramSocket socket
public AbstractProtocol(java.lang.String group,
int port,
GMetric.UDPAddressingMode mode,
int ttl)
throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionprotected void send(byte[] buf,
int len)
throws java.lang.Exception
buf - a buffer containing the messagelen - the num of bytes to send from the bufferjava.lang.Exceptionpublic abstract void announce(java.lang.String name,
java.lang.String value,
GMetricType type,
java.lang.String units,
GMetricSlope slope,
int tmax,
int dmax,
java.lang.String groupName)
throws java.lang.Exception
Protocolprotected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.ThrowableObject.finalize()