Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replaced could not parse exception with timeout or connection failure…

… exception.
  • Loading branch information...
commit bcadabd7ac28240bf0544d5c09ff125931e8ae41 1 parent 958f8cb
Chinmay Soman authored
View
16 src/java/voldemort/store/routed/action/AbstractAction.java
@@ -22,11 +22,12 @@
import voldemort.VoldemortApplicationException;
import voldemort.cluster.Node;
import voldemort.cluster.failuredetector.FailureDetector;
+import voldemort.store.StoreTimeoutException;
import voldemort.store.UnreachableStoreException;
import voldemort.store.routed.Pipeline;
+import voldemort.store.routed.Pipeline.Event;
import voldemort.store.routed.PipelineData;
import voldemort.store.routed.Response;
-import voldemort.store.routed.Pipeline.Event;
import voldemort.utils.Utils;
public abstract class AbstractAction<K, V, PD extends PipelineData<K, V>> implements Action {
@@ -57,10 +58,15 @@ protected boolean handleResponseError(Exception e,
long requestTime,
Pipeline pipeline,
FailureDetector failureDetector) {
- if(logger.isEnabledFor(Level.WARN))
- logger.warn("Error in " + pipeline.getOperation().getSimpleName() + " on node "
- + node.getId() + "(" + node.getHost() + ")", e);
-
+ if(logger.isEnabledFor(Level.WARN)) {
+ if(e instanceof StoreTimeoutException)
+ logger.warn("Error in " + pipeline.getOperation().getSimpleName() + " on node "
+ + node.getId() + "(" + node.getHost() + ") : " + e.getMessage());
+ else
+ logger.warn("Error in " + pipeline.getOperation().getSimpleName() + " on node "
+ + node.getId() + "(" + node.getHost() + ")", e);
+ }
+
if(e instanceof UnreachableStoreException) {
pipelineData.addFailedNode(node);
pipelineData.recordFailure(e);
View
3  src/java/voldemort/store/socket/SocketStore.java
@@ -33,6 +33,7 @@
import voldemort.store.NoSuchCapabilityException;
import voldemort.store.Store;
import voldemort.store.StoreCapabilityType;
+import voldemort.store.StoreTimeoutException;
import voldemort.store.StoreUtils;
import voldemort.store.UnreachableStoreException;
import voldemort.store.nonblockingstore.NonblockingStore;
@@ -375,7 +376,7 @@ public void parseResponse(DataInputStream inputStream) {
public void timeOut() {
clientRequest.timeOut();
- invokeCallback(new UnreachableStoreException("ClientRequestExecutor timed out. Cannot complete request."),
+ invokeCallback(new StoreTimeoutException("ClientRequestExecutor timed out. Cannot complete request."),
(System.nanoTime() - startNs) / Time.NS_PER_MS);
pool.checkin(destination, clientRequestExecutor);
}
View
7 src/java/voldemort/store/socket/clientrequest/AbstractClientRequest.java
@@ -21,6 +21,7 @@
import java.io.IOException;
import voldemort.VoldemortException;
+import voldemort.store.StoreTimeoutException;
import voldemort.store.UnreachableStoreException;
/**
@@ -73,9 +74,15 @@ public void parseResponse(DataInputStream inputStream) {
}
public T getResult() throws VoldemortException, IOException {
+ if(isTimedOut)
+ throw new StoreTimeoutException("Request timed out");
+
if(!isComplete)
throw new IllegalStateException("Client response not complete, cannot determine result");
+ if(result == null)
+ throw new StoreTimeoutException("Error in connecting to server.");
+
if(!isParsed)
throw new UnreachableStoreException("Client response not read/parsed, cannot determine result");
Please sign in to comment.
Something went wrong with that request. Please try again.