public final class ChannelAccessErrorMessage extends ChannelAccessMessage
CA_PROTO_ERROR message. This message is sent
from a server to a client to signal an error condition.ChannelAccessCommand.CA_PROTO_ERROR| Modifier and Type | Field and Description |
|---|---|
static int |
UNKNOWN_CHANNEL_CID
Channel CID sent with an error message if the error is not associated
with a specific channel.
|
command, originalMessageHeader| Constructor and Description |
|---|
ChannelAccessErrorMessage(int channelCID,
ChannelAccessStatus status,
ChannelAccessMessage originalMessage,
java.lang.String messageString)
Constructor for creating a
CA_PROTO_ERROR message. |
| Modifier and Type | Method and Description |
|---|---|
protected static ChannelAccessErrorMessage |
deserialize(ChannelAccessMessageHeader messageHeader,
ByteSource byteSource,
java.nio.charset.Charset charset,
ChannelAccessVersion version,
boolean isTCP)
Constructs a message from a header and a byte source.
|
boolean |
equals(java.lang.Object obj)
Tells whether the specified object represents the same message.
|
int |
getChannelCID()
Returns the channel CID used by the client.
|
java.lang.String |
getMessageString()
Returns the string describing details about this error.
|
ChannelAccessMessage |
getOriginalMessage()
Returns the original message that is attached to this error message.
|
ChannelAccessStatus |
getStatus()
Returns the status associated with this error.
|
int |
hashCode()
Returns a hash code value for this message.
|
protected void |
serialize(ByteSink byteSink,
ChannelAccessVersion version,
int maxPayloadSize,
java.nio.charset.Charset charset)
Serializes this message to a byte sink.
|
java.lang.String |
toString()
Returns a string representation of this message.
|
protected void |
verify(ChannelAccessVersion version,
int maxPayloadSize,
java.nio.charset.Charset charset)
Verifies that this message can be serialized.
|
addByteArrayToStringBuilder, calculatePaddingSize, getCommand, getOriginalMessageHeader, hasOriginalMessageHeader, serializeHeader, verifyHeaderpublic static final int UNKNOWN_CHANNEL_CID
public ChannelAccessErrorMessage(int channelCID,
ChannelAccessStatus status,
ChannelAccessMessage originalMessage,
java.lang.String messageString)
CA_PROTO_ERROR message.channelCID - client-side channel identifier related to the error message.
If the error is not related to a specific channel or the
channel CID is unknown, the value should be set to
-1.status - Channel Access status code indicating the kind of error.originalMessage - message that caused this error. This parameter may be
null if no such message is available. However, if
it is null the messageString must
also be null.messageString - textual error message. This parameter may be null if no such
message is available. It must be null if
originalMessage is null.java.lang.IllegalArgumentException - if originalMessage is null and
messageString is not null and if
originalMessage does not have original headers
(has not been decoded but created through its public
constructor).public int getChannelCID()
UNKNOWN_CHANNEL_CID is returned.UNKNOWN_CHANNEL_CID if the channel CID is unknown.public ChannelAccessStatus getStatus()
ECA_NORMAL.null).public ChannelAccessMessage getOriginalMessage()
Returns the original message that is attached to this error message. This
typically is the message sent by the client that caused the error. If no
original message was attached to this error message, this method returns
null.
Please note: The message returned is incomplete because the offending message's payload is never included in an error message. Therefore, some of the messages original information might not be available and calling methods that need this information might have unexpected results. In particular, the original message cannot be serialized again.
null if no original message
header has been attached to this error message.public java.lang.String getMessageString()
null is returned.null.protected void serialize(ByteSink byteSink, ChannelAccessVersion version, int maxPayloadSize, java.nio.charset.Charset charset)
ChannelAccessMessageChannelAccessMessageCodec.serialize in class ChannelAccessMessagebyteSink - byte sink that is used for writing the serialized data.version - protocol version to stay compatible with. This is the protocol
version of the peer the message is sent to.maxPayloadSize - maximum size of the payload.charset - encoding to use for serializing the string data (e.g. channel
names, error strings, string data-values).protected void verify(ChannelAccessVersion version, int maxPayloadSize, java.nio.charset.Charset charset)
ChannelAccessMessageChannelAccessMessageCodec.verify in class ChannelAccessMessageversion - protocol version to stay compatible with. This is the protocol
version of the peer the message is sent to.maxPayloadSize - maximum size of the payload.charset - encoding to use for serializing the string data (e.g. channel
names, error strings, string data-values).public boolean equals(java.lang.Object obj)
ChannelAccessMessageTells whether the specified object represents the same message.
Two messages are considered equal if they are of the same type and have the same headers and payload. For comparing the types, the actual Java type and not just the Channel Access command is compared.
equals in class ChannelAccessMessageobj - reference object with which this object is compared.true if obj is a message that is of the
same type and has the same headers and payload as this message.
false if obj is null or of
a different type than this message or differs in the headers or
payload.public int hashCode()
ChannelAccessMessageReturns a hash code value for this message. This method is supported for the benefit of hash tables. The hash code is calculated as a combination of the hash codes of this messages headers (including the Channel Access command) and its payload (if present).
If two messages are equal (as indicated by the return value of
ChannelAccessMessage.equals(Object)), they also have the same hash code. However, the
fact that two messages have the same hash code does not imply that they
are equal.
hashCode in class ChannelAccessMessagepublic java.lang.String toString()
ChannelAccessMessagetoString in class ChannelAccessMessageprotected static ChannelAccessErrorMessage deserialize(ChannelAccessMessageHeader messageHeader, ByteSource byteSource, java.nio.charset.Charset charset, ChannelAccessVersion version, boolean isTCP)
ChannelAccessMessageCodec.messageHeader - CA message header.byteSource - byte source for reading the message's payload (if any).charset - encoding to use for deserializing the error message (if
present).version - protocol version in use. This can determine the meaning of
some header fields.isTCP - true if the message to be deserialized has been
received over TCP, false if it has been received
via UDP.java.nio.BufferUnderflowException - if there is not enough data in the byte source to read the
complete payload.Copyright © 2014–2018 aquenos GmbH. All rights reserved.