Skip to content

Commit

Permalink
Cleaned up logger statements
Browse files Browse the repository at this point in the history
  • Loading branch information
abh1nay committed Apr 24, 2013
1 parent 29da9ef commit aefddee
Showing 1 changed file with 48 additions and 13 deletions.
61 changes: 48 additions & 13 deletions src/java/voldemort/client/protocol/admin/StreamingClient.java
Expand Up @@ -499,13 +499,11 @@ public synchronized void streamingPut(ByteArray key, Versioned<byte[]> value, St

} catch(InterruptedException e1) {
MARKED_BAD = true;
logger.error("Recovery Callback failed");
e1.printStackTrace();
logger.error("Recovery Callback failed", e1);
throw new VoldemortException("Recovery Callback failed");
} catch(ExecutionException e1) {
MARKED_BAD = true;
logger.error("Recovery Callback failed");
e1.printStackTrace();
logger.error("Recovery Callback failed", e1);
throw new VoldemortException("Recovery Callback failed");
}

Expand Down Expand Up @@ -534,6 +532,45 @@ public synchronized void commitToVoldemort() {
commitToVoldemort(storeNames);
}

/**
* Reset streaming session by unmarking it as bad
*/
public void unmarkBad() {
MARKED_BAD = false;
}

/**
* mark a node as blacklisted
*
* @param NodeId Integer node id of the node to be balcklisted
*/

@SuppressWarnings({ "rawtypes", "unchecked" })
public void blacklistNode(int nodeId) {
Collection<Node> nodesInCluster = adminClient.getAdminClientCluster().getNodes();

if(blackListedNodes == null) {
blackListedNodes = new ArrayList();
}
blackListedNodes.add(nodeId);

for(Node node: nodesInCluster) {

if(node.getId() == nodeId) {
nodesToStream.remove(node);
break;
}

}

for(String store: storeNames) {
SocketAndStreams sands = nodeIdStoreToSocketAndStreams.get(new Pair(store, nodeId));
close(sands.getSocket());
SocketDestination destination = nodeIdStoreToSocketRequest.get(new Pair(store, nodeId));
streamingSocketPool.checkin(destination, sands);
}
}

/**
* Flush the network buffer and write all entries to the serve. then wait
* for an ack from the server. This is a blocking call. It is invoked on
Expand Down Expand Up @@ -574,7 +611,7 @@ private void commitToVoldemort(List<String> storeNamesToCommit) {
}

} catch(IOException e) {
e.printStackTrace();
logger.error("Exception during commit", e);
hasError = true;
}
}
Expand All @@ -591,13 +628,11 @@ private void commitToVoldemort(List<String> storeNamesToCommit) {

} catch(InterruptedException e1) {
MARKED_BAD = true;
logger.error("Recovery Callback failed");
e1.printStackTrace();
logger.error("Recovery Callback failed", e1);
throw new VoldemortException("Recovery Callback failed");
} catch(ExecutionException e1) {
MARKED_BAD = true;
logger.error("Recovery Callback failed");
e1.printStackTrace();
logger.error("Recovery Callback failed", e1);
throw new VoldemortException("Recovery Callback failed");
}
} else {
Expand All @@ -611,11 +646,11 @@ private void commitToVoldemort(List<String> storeNamesToCommit) {

} catch(InterruptedException e1) {

logger.warn("Checkpoint callback failed!");
e1.printStackTrace();
logger.warn("Checkpoint callback failed!", e1);

} catch(ExecutionException e1) {
logger.warn("Checkpoint callback failed!");
e1.printStackTrace();
logger.warn("Checkpoint callback failed!", e1);

}
}

Expand Down

0 comments on commit aefddee

Please sign in to comment.