bug5741: backward compatibility for replication protocol, protocol versioning for new protocol

This commit is contained in:
Axel Uhl
2022-06-29 18:11:33 +02:00
parent 85781fb448
commit adc9bf77f9
5 changed files with 78 additions and 6 deletions
@@ -72,6 +72,8 @@ import com.sap.sse.util.ThreadLocalTransporter;
* {@code REPLICATE_ON_START} variable has its default value defined.</li>
* </ul>
*
* The {@link #getId() ID} must be different from {@link ReplicationReceiver#VERSION_INDICATOR}.<p>
*
* @param <S>
* the type of state to which the operations are applied; usually this will be set to the implementing
* subclass
@@ -3,6 +3,12 @@ package com.sap.sse.replication;
import java.util.Map;
public interface ReplicationReceiver {
/**
* A string that is sent for new replication protocol versions instead of the stringified {@link Replicable} ID.
* That replicable ID is usually a fully-qualified class name. It must not be equal to this version indicator string
* which has the value {@code "***"}.
*/
static String VERSION_INDICATOR = "***";
/**
* If the replicator is suspended, messages received are queued.
@@ -15,6 +15,7 @@ import com.sap.sse.replication.OperationsToMasterSender;
import com.sap.sse.replication.OperationsToMasterSendingQueue;
import com.sap.sse.replication.ReplicableWithObjectInputStream;
import com.sap.sse.replication.ReplicationMasterDescriptor;
import com.sap.sse.replication.ReplicationReceiver;
import com.sap.sse.replication.ReplicationService;
import com.sap.sse.util.ClearStateTestSupport;
import com.sap.sse.util.ObjectInputStreamResolvingAgainstCache;
@@ -92,7 +93,9 @@ public abstract class AbstractReplicableWithObjectInputStream<S, O extends Opera
@Override
public Serializable getId() {
return getClass().getName();
final String result = getClass().getName();
assert !result.equals(ReplicationReceiver.VERSION_INDICATOR);
return result;
}
@Override