public class ReplicationMessage
extends java.lang.Object
implements java.io.Externalizable
Modifier and Type | Field and Description |
---|---|
private java.lang.Object |
message
This is the content of the replication message.
|
static long |
serialVersionUID
The version number is determined based on the database version
of the current database.
|
private int |
type
The valid values for the type of the content of the message
are listed below.
|
static int |
TYPE_ACK
This flag is used to send an acknowledgment of successful completion
of a requested operation.
|
static int |
TYPE_ERROR
Indicates that the requested operation was not able to be
completed successfully.
|
static int |
TYPE_FAILOVER
Used to signal the slave that it must failover.
|
static int |
TYPE_INITIATE_INSTANT
Used during the intial handshake between the master and
the slave.
|
static int |
TYPE_INITIATE_VERSION
used during the intial handshake between the master and
the slave.
|
static int |
TYPE_LOG
This flag will be used for all messages that carry log records.
|
static int |
TYPE_PING
A message used to check if the replication network is working.
|
static int |
TYPE_PONG
A message sent as a response to a TYPE_PING message.
|
static int |
TYPE_STOP
Used to send a stop replication signal to the slave.
|
Constructor and Description |
---|
ReplicationMessage()
public No args constructor required with Externalizable.
|
ReplicationMessage(int type,
java.lang.Object message)
Constructor used to set the
type and message . |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getMessage()
Used to get the actual message that is wrapped inside the
ReplicationMessage object.
|
int |
getType()
Used to get the type of this
ReplicationMessage . |
void |
readExternal(java.io.ObjectInput in)
Used to restore the contents of this object.
|
void |
writeExternal(java.io.ObjectOutput out)
Used to save the contents of this Object.
|
public static final long serialVersionUID
private java.lang.Object message
private int type
public static final int TYPE_INITIATE_VERSION
Long
.
IMPORTANT: This constant must not be changed in future versions since
we need it to decide slave/master version mismatchpublic static final int TYPE_INITIATE_INSTANT
Long
.public static final int TYPE_LOG
byte
array. The content of the byte array is the log records in the
binary form.public static final int TYPE_ACK
String
. The SQLState of the
error message can be used here.public static final int TYPE_ERROR
String[]
where the first length-1 fields
are used as arguments to create the exception and the last
field contains the SQLState. The SQLState is the last element
in the Array, because this means that the whole Array can be
used as input to the StandardException creator. The SQLState
will be ignored by the exception creator because there is one
argument too many. This way we don't have to make a copy of the
received Array, containing all elements except the SQLState
element.public static final int TYPE_PING
public static final int TYPE_PONG
public static final int TYPE_STOP
public static final int TYPE_FAILOVER
public ReplicationMessage()
public ReplicationMessage(int type, java.lang.Object message)
type
and message
.
This is used while creating messages for sending while readExternal is
used on the receiving end.type
- The type of this message. Must be one of the message
type constants of this class (TYPE_LOG, TYPE_ACK,
TYPE_ERROR, TYPE_INITIATE).message
- The message to be transmitted.public java.lang.Object getMessage()
public int getType()
ReplicationMessage
.public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
in
- the stream to read data from in order to restore the object.java.io.IOException
- If an exception occurs while reading from the
InputStream
.java.lang.ClassNotFoundException
- Class of a serialized object cannot
be found.public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
out
- the stream to write the object to.java.io.IOException
- if an exception occurs while writing to the
OutputStream
.Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.