Package io.netty.handler.codec.haproxy
Class HAProxyMessage
- java.lang.Object
-
- io.netty.util.AbstractReferenceCounted
-
- io.netty.handler.codec.haproxy.HAProxyMessage
-
- All Implemented Interfaces:
ReferenceCounted
public final class HAProxyMessage extends AbstractReferenceCounted
Message container for decoded HAProxy proxy protocol parameters
-
-
Constructor Summary
Constructors Constructor Description HAProxyMessage(HAProxyProtocolVersion protocolVersion, HAProxyCommand command, HAProxyProxiedProtocol proxiedProtocol, java.lang.String sourceAddress, java.lang.String destinationAddress, int sourcePort, int destinationPort)
Creates a new instance of HAProxyMessage.HAProxyMessage(HAProxyProtocolVersion protocolVersion, HAProxyCommand command, HAProxyProxiedProtocol proxiedProtocol, java.lang.String sourceAddress, java.lang.String destinationAddress, int sourcePort, int destinationPort, java.util.List<? extends HAProxyTLV> tlvs)
Creates a new instance of HAProxyMessage.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HAProxyCommand
command()
Returns theHAProxyCommand
of thisHAProxyMessage
.protected void
deallocate()
Called onceAbstractReferenceCounted.refCnt()
is equals 0.java.lang.String
destinationAddress()
Returns the human-readable destination address of thisHAProxyMessage
.int
destinationPort()
Returns the UDP/TCP destination port of thisHAProxyMessage
.HAProxyProtocolVersion
protocolVersion()
Returns theHAProxyProtocolVersion
of thisHAProxyMessage
.HAProxyProxiedProtocol
proxiedProtocol()
Returns theHAProxyProxiedProtocol
of thisHAProxyMessage
.boolean
release()
Decreases the reference count by1
and deallocates this object if the reference count reaches at0
.boolean
release(int decrement)
Decreases the reference count by the specifieddecrement
and deallocates this object if the reference count reaches at0
.HAProxyMessage
retain()
Increases the reference count by1
.HAProxyMessage
retain(int increment)
Increases the reference count by the specifiedincrement
.java.lang.String
sourceAddress()
Returns the human-readable source address of thisHAProxyMessage
ornull
if HAProxy performs health check withsend-proxy-v2
.int
sourcePort()
Returns the UDP/TCP source port of thisHAProxyMessage
.java.util.List<HAProxyTLV>
tlvs()
Returns a list ofHAProxyTLV
or an empty list if no TLVs are present.java.lang.String
toString()
HAProxyMessage
touch()
Records the current access location of this object for debugging purposes.HAProxyMessage
touch(java.lang.Object hint)
Records the current access location of this object with an additional arbitrary information for debugging purposes.-
Methods inherited from class io.netty.util.AbstractReferenceCounted
refCnt, setRefCnt
-
-
-
-
Constructor Detail
-
HAProxyMessage
public HAProxyMessage(HAProxyProtocolVersion protocolVersion, HAProxyCommand command, HAProxyProxiedProtocol proxiedProtocol, java.lang.String sourceAddress, java.lang.String destinationAddress, int sourcePort, int destinationPort)
Creates a new instance of HAProxyMessage.- Parameters:
protocolVersion
- the protocol version.command
- the command.proxiedProtocol
- the protocol containing the address family and transport protocol.sourceAddress
- the source address.destinationAddress
- the destination address.sourcePort
- the source port. This value must be 0 for unix, unspec addresses.destinationPort
- the destination port. This value must be 0 for unix, unspec addresses.
-
HAProxyMessage
public HAProxyMessage(HAProxyProtocolVersion protocolVersion, HAProxyCommand command, HAProxyProxiedProtocol proxiedProtocol, java.lang.String sourceAddress, java.lang.String destinationAddress, int sourcePort, int destinationPort, java.util.List<? extends HAProxyTLV> tlvs)
Creates a new instance of HAProxyMessage.- Parameters:
protocolVersion
- the protocol version.command
- the command.proxiedProtocol
- the protocol containing the address family and transport protocol.sourceAddress
- the source address.destinationAddress
- the destination address.sourcePort
- the source port. This value must be 0 for unix, unspec addresses.destinationPort
- the destination port. This value must be 0 for unix, unspec addresses.tlvs
- the list of tlvs.
-
-
Method Detail
-
protocolVersion
public HAProxyProtocolVersion protocolVersion()
Returns theHAProxyProtocolVersion
of thisHAProxyMessage
.
-
command
public HAProxyCommand command()
Returns theHAProxyCommand
of thisHAProxyMessage
.
-
proxiedProtocol
public HAProxyProxiedProtocol proxiedProtocol()
Returns theHAProxyProxiedProtocol
of thisHAProxyMessage
.
-
sourceAddress
public java.lang.String sourceAddress()
Returns the human-readable source address of thisHAProxyMessage
ornull
if HAProxy performs health check withsend-proxy-v2
.
-
destinationAddress
public java.lang.String destinationAddress()
Returns the human-readable destination address of thisHAProxyMessage
.
-
sourcePort
public int sourcePort()
Returns the UDP/TCP source port of thisHAProxyMessage
.
-
destinationPort
public int destinationPort()
Returns the UDP/TCP destination port of thisHAProxyMessage
.
-
tlvs
public java.util.List<HAProxyTLV> tlvs()
Returns a list ofHAProxyTLV
or an empty list if no TLVs are present.TLVs are only available for the Proxy Protocol V2
-
touch
public HAProxyMessage touch()
Description copied from interface:ReferenceCounted
Records the current access location of this object for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector
. This method is a shortcut totouch(null)
.- Specified by:
touch
in interfaceReferenceCounted
- Overrides:
touch
in classAbstractReferenceCounted
-
touch
public HAProxyMessage touch(java.lang.Object hint)
Description copied from interface:ReferenceCounted
Records the current access location of this object with an additional arbitrary information for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector
.
-
retain
public HAProxyMessage retain()
Description copied from interface:ReferenceCounted
Increases the reference count by1
.- Specified by:
retain
in interfaceReferenceCounted
- Overrides:
retain
in classAbstractReferenceCounted
-
retain
public HAProxyMessage retain(int increment)
Description copied from interface:ReferenceCounted
Increases the reference count by the specifiedincrement
.- Specified by:
retain
in interfaceReferenceCounted
- Overrides:
retain
in classAbstractReferenceCounted
-
release
public boolean release()
Description copied from interface:ReferenceCounted
Decreases the reference count by1
and deallocates this object if the reference count reaches at0
.- Specified by:
release
in interfaceReferenceCounted
- Overrides:
release
in classAbstractReferenceCounted
- Returns:
true
if and only if the reference count became0
and this object has been deallocated
-
release
public boolean release(int decrement)
Description copied from interface:ReferenceCounted
Decreases the reference count by the specifieddecrement
and deallocates this object if the reference count reaches at0
.- Specified by:
release
in interfaceReferenceCounted
- Overrides:
release
in classAbstractReferenceCounted
- Returns:
true
if and only if the reference count became0
and this object has been deallocated
-
deallocate
protected void deallocate()
Description copied from class:AbstractReferenceCounted
Called onceAbstractReferenceCounted.refCnt()
is equals 0.- Specified by:
deallocate
in classAbstractReferenceCounted
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-