Skip to content

Commit

Permalink
Changed the logging on push and pull to note the node being pushed to…
Browse files Browse the repository at this point in the history
… or pulled
  • Loading branch information
chenson42 committed Apr 23, 2008
1 parent 5fca130 commit 675402a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
Expand Up @@ -25,6 +25,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ConnectException;
import java.net.MalformedURLException;
import java.net.UnknownHostException;
import java.sql.SQLException;
import java.util.ArrayList;
Expand Down Expand Up @@ -105,6 +106,8 @@ public boolean loadData(Node remote, Node local) throws IOException {
logger.warn("Registration was lost, attempting to re-register");
loadData(transportManager.getRegisterTransport(local));
wasWorkDone = true;
} catch (MalformedURLException e) {
logger.error("Could not connect to the " + remote + " node's transport because of a bad URL: " + e.getMessage());
}
return wasWorkDone;
}
Expand Down
Expand Up @@ -48,13 +48,14 @@ public void pullData() {
List<Node> nodes = nodeService.findNodesToPull();
if (nodes != null && nodes.size() > 0) {
for (Node node : nodes) {
String nodeName = " for " + node.getNodeGroupId() + "." + node.getNodeId();
String nodeName = " for " + node;
try {
logger.info("Pull requested" + nodeName);
if (dataLoaderService.loadData(node, nodeService.findIdentity())) {
logger.info("Pull data received" + nodeName);
}
logger.info("Pull completed" + nodeName);
} else {
logger.info("Pull no data received for " + nodeName);
}
} catch (ConnectException ex) {
logger.warn(ErrorConstants.COULD_NOT_CONNECT_TO_TRANSPORT + " url=" + node.getSyncURL());
} catch (ConnectionRejectedException ex) {
Expand Down
Expand Up @@ -55,13 +55,13 @@ public class PushService implements IPushService {
public void pushData() {
List<Node> nodes = nodeService.findNodesToPushTo();
if (nodes != null && nodes.size() > 0) {
logger.info("Push requested");
boolean success = false;
for (Node node : nodes) {
success = pushToNode(node);
}
if (success) {
logger.info("Push completed");
logger.info("Push requested for " + node);
if (pushToNode(node)) {
logger.info("Push completed for " + node);
} else {
logger.info("Push unsuccessful for " + node);
}
}
}
}
Expand All @@ -73,8 +73,7 @@ private boolean pushToNode(Node remote) {
transport = transportManager.getPushTransport(remote, nodeService.findIdentity());

if (extractor.extract(remote, transport)) {
logger.info("Push data sent");

logger.info("Push data sent to " + remote);
BufferedReader reader = transport.readResponse();
String ackString = reader.readLine();
String ackExtendedString = reader.readLine();
Expand Down
Expand Up @@ -31,8 +31,6 @@ public class IncomingManagementService {

IStatisticManager statisticManager;

// INCOMING_TRANSPORT_ERROR_COUNT,
// INCOMING_TRANSPORT_CONNECT_ERROR_COUNT,
// INCOMING_TRANSPORT_REJECTED_COUNT,
// INCOMING_DATABASE_ERROR_COUNT,
// INCOMING_OTHER_ERROR_COUNT,
Expand Down Expand Up @@ -65,5 +63,17 @@ public BigDecimal getTransportErrorCountForServerLifetime() {
return this.statisticManager.getStatistic(StatisticName.INCOMING_TRANSPORT_ERROR_COUNT)
.getLifetimeTotal();
}

@ManagedAttribute(description = "Get the number of errors that occurred while attempting to connect to transport since the last flush")
public BigDecimal getTransportConnectErrorCountSinceLastFlush() {
return this.statisticManager.getStatistic(StatisticName.INCOMING_TRANSPORT_CONNECT_ERROR_COUNT).getTotal();
}

@ManagedAttribute(description = "Get the number of errors that occurred while attempting to connect to transport for the lifetime of the server")
public BigDecimal getTransportConnectErrorCountForServerLifetime() {
return this.statisticManager.getStatistic(StatisticName.INCOMING_TRANSPORT_CONNECT_ERROR_COUNT)
.getLifetimeTotal();
}


}

0 comments on commit 675402a

Please sign in to comment.