mirror of https://github.com/apache/druid.git
add url logging to DirectDruidClient for debugging purposes
This commit is contained in:
parent
98cd83071a
commit
6fb3e61a98
|
@ -34,6 +34,7 @@ import com.google.common.util.concurrent.Futures;
|
|||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.metamx.common.IAE;
|
||||
import com.metamx.common.Pair;
|
||||
import com.metamx.common.RE;
|
||||
import com.metamx.common.guava.BaseSequence;
|
||||
import com.metamx.common.guava.Sequence;
|
||||
import com.metamx.common.guava.Sequences;
|
||||
|
@ -203,7 +204,7 @@ public class DirectDruidClient<T> implements QueryRunner<T>
|
|||
@Override
|
||||
public JsonParserIterator<T> make()
|
||||
{
|
||||
return new JsonParserIterator<T>(typeRef, future);
|
||||
return new JsonParserIterator<T>(typeRef, future, url);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -239,11 +240,13 @@ public class DirectDruidClient<T> implements QueryRunner<T>
|
|||
private ObjectCodec objectCodec;
|
||||
private final JavaType typeRef;
|
||||
private final Future<InputStream> future;
|
||||
private final String url;
|
||||
|
||||
public JsonParserIterator(JavaType typeRef, Future<InputStream> future)
|
||||
public JsonParserIterator(JavaType typeRef, Future<InputStream> future, String url)
|
||||
{
|
||||
this.typeRef = typeRef;
|
||||
this.future = future;
|
||||
this.url = url;
|
||||
jp = null;
|
||||
}
|
||||
|
||||
|
@ -289,20 +292,20 @@ public class DirectDruidClient<T> implements QueryRunner<T>
|
|||
try {
|
||||
jp = objectMapper.getFactory().createParser(future.get());
|
||||
if (jp.nextToken() != JsonToken.START_ARRAY) {
|
||||
throw new IAE("Next token wasn't a START_ARRAY, was[%s]", jp.getCurrentToken());
|
||||
throw new IAE("Next token wasn't a START_ARRAY, was[%s] in url [%s]", jp.getCurrentToken(), url);
|
||||
} else {
|
||||
jp.nextToken();
|
||||
objectCodec = jp.getCodec();
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw Throwables.propagate(e);
|
||||
throw Throwables.propagate(new RE(e, "Failure getting results from[%s]", url));
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
throw Throwables.propagate(e);
|
||||
throw Throwables.propagate(new RE(e, "Failure getting results from[%s]", url));
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
throw Throwables.propagate(e);
|
||||
throw Throwables.propagate(new RE(e, "Failure getting results from[%s]", url));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue