log exceptions in cluster service
@@ -39,7 +39,6 @@ import org.springframework.beans.factory.annotation.Value;
import java.io.FileNotFoundException;
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -85,7 +84,6 @@ public class JGroupsClusterService extends ReceiverAdapter implements ClusterSer
private ClusterNodeSummary clusterNodeSummary;
-
/**
* Start a channel on the cluster
*/
@@ -189,8 +187,7 @@ public class JGroupsClusterService extends ReceiverAdapter implements ClusterSer
ensureMessageDeliveryMap.remove(ensureMessageDeliveryMessage.getMessageId());
log.debug("Successfully acknowledged message deliver of {}, type: {}", clusterMessage.getId(), clusterMessage.getType());
}
- }
- else {
+ } else {
sendAcknowledgementMessage(from, clusterMessage);
}
}
@@ -238,8 +235,7 @@ public class JGroupsClusterService extends ReceiverAdapter implements ClusterSer
ensureMessageDeliveryMap.put(clusterMessage.getId(), status);
channel.send(null, clusterMessage);
} catch (Exception e) {
- e.printStackTrace();
- //throw send exception
+ log.error("Unable to send message of type: {} to other nodes: {} ", type, e.getMessage(), e);
}
}
}
@@ -264,17 +260,16 @@ public class JGroupsClusterService extends ReceiverAdapter implements ClusterSer
throw new IllegalArgumentException("Cluster node does not exist: " + other);
}
} catch (final Exception e) {
- e.printStackTrace();
- //throw send exception
+ log.error("Unable to send message of type: {} to other node:{}, {} ", type, other, e.getMessage(), e);
}
}
}
+
private String newMessageId() {
return UUID.randomUUID().toString();
}
-
@Override
public void sendMessageToOthers(String type, Serializable message) {
if (isClustered()) {
@@ -291,8 +286,7 @@ public class JGroupsClusterService extends ReceiverAdapter implements ClusterSer
}
} catch (Exception e) {
- e.printStackTrace();
- //throw send exception
+ log.error("Unable to send message of type: {} to other nodes: {} ", type, e.getMessage(), e);
}
}
}
@@ -314,8 +308,7 @@ public class JGroupsClusterService extends ReceiverAdapter implements ClusterSer
throw new IllegalArgumentException("Cluster node does not exist: " + from);
}
} catch (final Exception e) {
- e.printStackTrace();
- //throw send exception
+ log.error("Unable to send acknowledgement of message: {} to {} ", message.getType(), from, e.getMessage(), e);
}
}
@@ -340,8 +333,7 @@ public class JGroupsClusterService extends ReceiverAdapter implements ClusterSer
throw new IllegalArgumentException("Cluster node does not exist: " + other);
}
} catch (final Exception e) {
- e.printStackTrace();
- //throw send exception
+ log.error("Unable to redeliver message of type: {} to: {}, ", clusterMessage.getType(), other, e.getMessage(), e);
}
}
}
@@ -375,8 +367,6 @@ public class JGroupsClusterService extends ReceiverAdapter implements ClusterSer
/**
* Find any Messages awaiting to be delivered longer than a certain time
- * @param longerThanMillis
- * @return
*/
public List<MessageDeliveryStatus> getMessagesAwaitingAcknowledgement(Long longerThanMillis) {
return ensureMessageDeliveryMap.values().stream().filter(m -> m.isTimeLongerThan(longerThanMillis)).collect(Collectors.toList());
@@ -389,5 +379,4 @@ public class JGroupsClusterService extends ReceiverAdapter implements ClusterSer
}
-
}
