mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-04 03:13:49 +00:00
adjusted comments and added TODOs for bug 2465
Change-Id: I6c86eee9a4974c4cd22241ab246a3a690075dd78
This commit is contained in:
1 parent
286adfd3b6
commit
ce82f413d3
8 files changed
+38
-11
No files matched your search
+1
-2
@@ -268,9 +268,8 @@ public class ReplicationPanel extends FlowPanel {
|
||||
registeredMasters.insertRow(i);
|
||||
registeredMasters.setWidget(i, 0, new Label("Client UUID: " + replicas.getServerIdentifier()));
|
||||
i++;
|
||||
|
||||
final ReplicationMasterDTO replicatingFromMaster = replicas.getReplicatingFromMaster();
|
||||
if (replicatingFromMaster != null) {
|
||||
if (replicatingFromMaster != null) { // TODO bug 2465: replicating only the user service from a "domain controller master" shouldn't lead to a warning here...
|
||||
errorReporter.reportPersistentInformation(stringMessages.warningServerIsReplica());
|
||||
registeredMasters.insertRow(i);
|
||||
registeredMasters.setWidget(i, 0, new Label(stringMessages.replicatingFromMaster(replicatingFromMaster.getHostname(),
|
||||
|
||||
+12
-1
@@ -8,7 +8,13 @@ public class ReplicationMasterDTO implements IsSerializable {
|
||||
private int servletPort;
|
||||
private String messagingHostname;
|
||||
private String exchangeName;
|
||||
ReplicationMasterDTO() {}
|
||||
|
||||
// TODO bug 2465: capture the set of replicables that are replicated from this master; this may be a subset of the
|
||||
// replica's / master's Replicables
|
||||
|
||||
ReplicationMasterDTO() {
|
||||
}
|
||||
|
||||
public ReplicationMasterDTO(String hostname, int servletPort, String messagingHostname, int messagingPort, String exchangeName) {
|
||||
super();
|
||||
this.hostname = hostname;
|
||||
@@ -17,18 +23,23 @@ public class ReplicationMasterDTO implements IsSerializable {
|
||||
this.messagingPort = messagingPort;
|
||||
this.exchangeName = exchangeName;
|
||||
}
|
||||
|
||||
public String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
public int getMessagingPort() {
|
||||
return messagingPort;
|
||||
}
|
||||
|
||||
public int getServletPort() {
|
||||
return servletPort;
|
||||
}
|
||||
|
||||
public String getMessagingHostname() {
|
||||
return messagingHostname;
|
||||
}
|
||||
|
||||
public String getExchangeName() {
|
||||
return exchangeName;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ Require-Bundle: com.sap.sse.common,
|
||||
lz4-java;bundle-version="1.3.0",
|
||||
org.apache.commons.lang
|
||||
Bundle-ClassPath: .
|
||||
Comment: The Web-ContextPath is referred to by ReplicationMasterDescriptorImpl.REPLICATION_SERVLET
|
||||
Web-ContextPath: /replication
|
||||
Import-Package: com.rabbitmq.client;version="2.8.4",
|
||||
javax.servlet;version="2.6.0",
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>Replication</servlet-name>
|
||||
<!-- See ReplicationMasterDescriptorImpl.REPLICATION_SERVLET referring to this url-pattern -->
|
||||
<url-pattern>/replication</url-pattern>
|
||||
</servlet-mapping>
|
||||
</web-app>
|
||||
+4
@@ -14,6 +14,10 @@ import com.sap.sse.replication.impl.ReplicationServlet;
|
||||
/**
|
||||
* Identifies a master server instance from which a replica can obtain an initial load and continuous updates.
|
||||
*
|
||||
* TODO bug 2465: add the set of {@link Replicable}s that are replicated from the master represented by this descriptor,
|
||||
* considering that this may be a subset only of the replicables running on this instance or the master server. Example:
|
||||
* replicating only the SecurityService from some other server but being a master regarding all other Replicables.
|
||||
*
|
||||
* @author Frank Mittag, Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
|
||||
+4
@@ -44,6 +44,10 @@ public class ReplicationMasterDescriptorImpl implements ReplicationMasterDescrip
|
||||
|
||||
private QueueingConsumer consumer;
|
||||
|
||||
// TODO bug 2465: add the set of {@link Replicable}s that are replicated from the master represented by this descriptor,
|
||||
// considering that this may be a subset only of the replicables running on this instance or the master server. Example:
|
||||
//replicating only the SecurityService from some other server but being a master regarding all other Replicables.
|
||||
|
||||
/**
|
||||
* @param messagingHostname
|
||||
* name of the host on which the exchange is hosted to which this replica connects with a queue whose
|
||||
|
||||
+13
-7
@@ -66,7 +66,11 @@ public class ReplicationReceiver implements Runnable {
|
||||
private static final long CHECK_INTERVAL_MILLIS = 2000; // how long (milliseconds) to pause before checking connection again
|
||||
private static final int CHECK_COUNT = 150; // how long to check, value is CHECK_INTERVAL second steps
|
||||
|
||||
/**
|
||||
* descriptor of the master server from which this replicator receives messages
|
||||
*/
|
||||
private final ReplicationMasterDescriptor master;
|
||||
|
||||
private final ReplicablesProvider replicableProvider;
|
||||
|
||||
/**
|
||||
@@ -138,12 +142,14 @@ public class ReplicationReceiver implements Runnable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts fetching messages from the {@link #consumer}. After receiving a single message, assumes it's an
|
||||
* {@link Iterable} of serialized {@link RacingEventServiceOperation} objects, and applies it to the
|
||||
* {@link RacingEventService} which is obtained from the service tracker passed to this replicator at construction
|
||||
* time.
|
||||
* Starts fetching messages from the {@link #consumer}. After receiving a single message, assumes it's a
|
||||
* {@link ReplicationServiceImpl#createUncompressingInputStream(InputStream) compressed} stream that first
|
||||
* {@link DataInputStream#readUTF() encodes a UTF string} representing the {@link Replicable#getId() replicable ID},
|
||||
* followed by a sequence of serialized {@code byte[]} objects which each can be {@link Replicable#readOperation(InputStream) de-serialized}
|
||||
* by the receiving {@link Replicable} identified by the ID received as a prefix. This method then applies these operations to the
|
||||
* {@link Replicable} identified by the ID, retrieved through the {@link #replicableProvider}.
|
||||
*
|
||||
* @see ReplicationServiceImpl#executed(RacingEventServiceOperation)
|
||||
* @see ReplicationServiceExecutionListener#executed(OperationWithResult)
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -170,12 +176,12 @@ public class ReplicationReceiver implements Runnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
byte[] bytesFromMessage = delivery.getBody();
|
||||
final byte[] bytesFromMessage = delivery.getBody();
|
||||
checksPerformed = 0;
|
||||
// Set the replicable's class's class loader as context for deserialization so that all exported classes
|
||||
// of all required bundles/packages can be deserialized at least
|
||||
final InputStream uncompressingInputStream = ReplicationServiceImpl.createUncompressingInputStream(new ByteArrayInputStream(bytesFromMessage));
|
||||
String replicableIdAsString = new DataInputStream(uncompressingInputStream).readUTF();
|
||||
final String replicableIdAsString = new DataInputStream(uncompressingInputStream).readUTF();
|
||||
Replicable<?, ?> replicable = replicableProvider.getReplicable(replicableIdAsString, /* wait */ false);
|
||||
if (replicable != null) {
|
||||
ObjectInputStream ois = new ObjectInputStream(uncompressingInputStream); // no special stream required; only reading a generic byte[]
|
||||
|
||||
+2
-1
@@ -79,7 +79,8 @@ public class ReplicationServiceImpl implements ReplicationService {
|
||||
|
||||
/**
|
||||
* <code>null</code>, if this instance is not currently replicating from some master; the master's descriptor
|
||||
* otherwise
|
||||
* otherwise; note that partial replication is supported, meaning that only operations for a subset of the
|
||||
* {@link Replicable}s running on this server will be considered when received from the master.
|
||||
*/
|
||||
private ReplicationMasterDescriptor replicatingFromMaster;
|
||||
|
||||
|
||||
Reference in new issue
Block a user