mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-11 06:40:53 +00:00
Now an error does no longer yield information about a master
This commit is contained in:
1 parent
91afa067ba
commit
af09da2d7f
3 files changed
+24
-10
No files matched your search
+4
@@ -91,4 +91,8 @@ public class ReplicationMasterDescriptorImpl implements ReplicationMasterDescrip
|
||||
return exchangeName;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return getHostname() + ":" + getServletPort() + "/" + getMessagingPort();
|
||||
}
|
||||
|
||||
}
|
||||
+19
-10
@@ -198,8 +198,13 @@ public class ReplicationServiceImpl implements ReplicationService, OperationExec
|
||||
@Override
|
||||
public void startToReplicateFrom(ReplicationMasterDescriptor master) throws IOException, ClassNotFoundException, InterruptedException {
|
||||
logger.info("Starting to replicate from "+master);
|
||||
try {
|
||||
registerReplicaWithMaster(master);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
throw ex;
|
||||
}
|
||||
replicatingFromMaster = master;
|
||||
registerReplicaWithMaster(master);
|
||||
logger.info("Registered replica with master");
|
||||
QueueingConsumer consumer = null;
|
||||
// logging exception here because it will not propagate
|
||||
@@ -208,6 +213,7 @@ public class ReplicationServiceImpl implements ReplicationService, OperationExec
|
||||
consumer = master.getConsumer();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
replicatingFromMaster = null;
|
||||
throw ex;
|
||||
}
|
||||
logger.info("Connection to exchange successful.");
|
||||
@@ -291,15 +297,18 @@ public class ReplicationServiceImpl implements ReplicationService, OperationExec
|
||||
ReplicationMasterDescriptor descriptor = isReplicatingFromMaster();
|
||||
if (descriptor != null) {
|
||||
synchronized(replicaUUIDs) {
|
||||
replicator.stop();
|
||||
deregisterReplicaWithMaster(descriptor);
|
||||
descriptor.getConsumer().getChannel().close();
|
||||
replicatingFromMaster = null;
|
||||
replicaUUIDs.clear();
|
||||
|
||||
// this is needed because QueuingConsumer.nextDelivery() wont unblock
|
||||
// if the connection is closed by application.
|
||||
replicatorThread.interrupt();
|
||||
if (replicator != null) {
|
||||
replicator.stop();
|
||||
deregisterReplicaWithMaster(descriptor);
|
||||
descriptor.getConsumer().getChannel().close();
|
||||
replicatingFromMaster = null;
|
||||
replicaUUIDs.clear();
|
||||
|
||||
// this is needed because QueuingConsumer.nextDelivery() wont unblock
|
||||
// if the connection is closed by application.
|
||||
replicatorThread.interrupt();
|
||||
replicator = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user