PrevPrevious commit
Next Next commit
add stream=null
  • Loading branch information
@mayurkale22
mayurkale22 committedFeb 21, 2020
commit 5042cae19d985a0de9d397e1f83e77c60640d106
Original file line numberDiff line numberDiff line change
Expand Up@@ -922,6 +922,7 @@ public void close(@Nullable String message) {
if (stream != null) {
stream.close(message);
span.end(TraceUtil.END_SPAN_OPTIONS);
stream = null;
}
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -294,13 +294,14 @@ public <T> T run(TransactionCallable<T> callable) {
}
return runInternal(callable);
} catch (RuntimeException e) {
TraceUtil.endSpanWithFailure(span, e);
TraceUtil.setWithFailure(span, e);
throw e;
} finally {
// Remove threadLocal rather than set to FALSE to avoid a possible memory .
// We also do this unconditionally in case a user has modified the flag when the transaction
// was running.
SessionImpl.hasPendingTransaction.remove();
span.end(TraceUtil.END_SPAN_OPTIONS);
}
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -87,7 +87,7 @@ public void addLink(Link link) {}
public void end(EndSpanOptions options) {
synchronized (this) {
if (ended) {
throw new IllegalStateException("already ended");
throw new IllegalStateException(this.spanName + " already ended");
}
spans.put(this.spanName, true);
ended = true;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -194,7 +194,7 @@ public Void run(TransactionContext transaction) throws Exception {

Map<String, Boolean> spans = failOnOverkillTraceComponent.getSpans();
assertThat(spans.size()).isEqualTo(6);
assertThat(spans).containsEntry("CloudSpanner.ReadWriteTransaction", false);
assertThat(spans).containsEntry("CloudSpanner.ReadWriteTransaction", true);
assertThat(spans).containsEntry("CloudSpannerOperation.BatchCreateSessions", true);
assertThat(spans).containsEntry("SessionPool.WaitForSession", true);
assertThat(spans).containsEntry("CloudSpannerOperation.BatchCreateSessionsRequest", true);
Expand All@@ -216,7 +216,6 @@ public Void run(TransactionContext transaction) throws Exception {
});
fail("missing expected exception");
} catch (SpannerException e) {
System.out.println("herhe");
assertThat(e.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT);
}

Expand Down