Skip to content

Commit 6ce9a70

Browse files
author
Daniil Zulin
committed
Formatting fix
1 parent cfc000c commit 6ce9a70

File tree

2 files changed

+29
-33
lines changed

2 files changed

+29
-33
lines changed

core/src/main/java/tech/ydb/core/impl/call/ReadStreamCall.java

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,28 +60,26 @@ public CompletableFuture<Status> start(Observer<RespT> observer) {
6060
}
6161

6262
callLock.lock();
63-
63+
try {
64+
call.start(this, headers);
65+
if (logger.isTraceEnabled()) {
66+
logger.trace("ReadStreamCall[{}] --> {}", traceId, TextFormat.shortDebugString((Message) request));
67+
}
68+
call.sendMessage(request);
69+
// close stream by client side
70+
call.halfClose();
71+
call.request(1);
72+
} catch (Throwable t) {
6473
try {
65-
call.start(this, headers);
66-
if (logger.isTraceEnabled()) {
67-
logger.trace("ReadStreamCall[{}] --> {}", traceId, TextFormat.shortDebugString((Message) request));
68-
}
69-
call.sendMessage(request);
70-
// close stream by client side
71-
call.halfClose();
72-
call.request(1);
73-
} catch (Throwable t) {
74-
try {
75-
call.cancel(null, t);
76-
} catch (Throwable ex) {
77-
logger.error("ReadStreamCall[{}] got exception while canceling", traceId, ex);
78-
}
79-
80-
statusFuture.completeExceptionally(t);
81-
} finally {
82-
callLock.unlock();
74+
call.cancel(null, t);
75+
} catch (Throwable ex) {
76+
logger.error("ReadStreamCall[{}] got exception while canceling", traceId, ex);
8377
}
8478

79+
statusFuture.completeExceptionally(t);
80+
} finally {
81+
callLock.unlock();
82+
}
8583

8684
return statusFuture;
8785
}

core/src/main/java/tech/ydb/core/impl/call/ReadWriteStreamCall.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,21 @@ public CompletableFuture<Status> start(Observer<R> observer) {
7070
}
7171

7272
callLock.lock();
73-
73+
try {
74+
call.start(this, headers);
75+
call.request(1);
76+
} catch (Throwable t) {
7477
try {
75-
call.start(this, headers);
76-
call.request(1);
77-
} catch (Throwable t) {
78-
try {
79-
call.cancel(null, t);
80-
} catch (Throwable ex) {
81-
logger.error("Exception encountered while closing the unary call", ex);
82-
}
83-
84-
statusFuture.completeExceptionally(t);
85-
} finally {
86-
87-
callLock.unlock();
78+
call.cancel(null, t);
79+
} catch (Throwable ex) {
80+
logger.error("Exception encountered while closing the unary call", ex);
8881
}
8982

83+
statusFuture.completeExceptionally(t);
84+
} finally {
85+
callLock.unlock();
86+
}
87+
9088
return statusFuture;
9189
}
9290

0 commit comments

Comments
 (0)