From 1d6f743a795511fe321eb1cb3b1d7930f8241dc2 Mon Sep 17 00:00:00 2001 From: Axel Uhl Date: Wed, 19 Feb 2020 11:40:13 +0100 Subject: [PATCH] bug5213: logging long-lasting connection attempts to RabbitMQ in ReplicationServiceImpl --- .../replication/impl/ReplicationServiceImpl.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/java/com.sap.sse.replication/src/com/sap/sse/replication/impl/ReplicationServiceImpl.java b/java/com.sap.sse.replication/src/com/sap/sse/replication/impl/ReplicationServiceImpl.java index d140fda244e..27f613c3796 100755 --- a/java/com.sap.sse.replication/src/com/sap/sse/replication/impl/ReplicationServiceImpl.java +++ b/java/com.sap.sse.replication/src/com/sap/sse/replication/impl/ReplicationServiceImpl.java @@ -657,13 +657,24 @@ public class ReplicationServiceImpl implements ReplicationService, OperationsToM QueueingConsumer consumer = null; // logging exception here because it will not propagate // thru the client with all details + final Timer timer = new Timer("RabbitMQ Connection Timeout Logger", /* isDaemon */ true); + final int LOGGING_TIMEOUT_IN_SECONDS = 10; + timer.scheduleAtFixedRate(new TimerTask() { + @Override + public void run() { + logger.warning("RabbitMQ connection to "+master+ + " was not obtained in "+LOGGING_TIMEOUT_IN_SECONDS+"s. Keeping trying..."); + } + }, LOGGING_TIMEOUT_IN_SECONDS*1000, LOGGING_TIMEOUT_IN_SECONDS*1000); + logger.info("Connecting to message queue " + master); try { - logger.info("Connecting to message queue " + master); consumer = master.getConsumer(); } catch (Exception ex) { logger.log(Level.SEVERE, "ERROR", ex); replicatingFromMaster = null; throw ex; + } finally { + timer.cancel(); } logger.info("Connection to exchange successful."); final URL initialLoadURL = master.getInitialLoadURL(replicables);