Skip to content

Commit d1f413b

Browse files
committed
ConnectionIsClosedException --> ConnectionClosedException.
1 parent 2dd1c7e commit d1f413b

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

s2a/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ java_library(
6666
java_library(
6767
name = "s2a_handshaker",
6868
srcs = [
69-
"src/main/java/io/grpc/s2a/handshaker/ConnectionIsClosedException.java",
69+
"src/main/java/io/grpc/s2a/handshaker/ConnectionClosedException.java",
7070
"src/main/java/io/grpc/s2a/handshaker/GetAuthenticationMechanisms.java",
7171
"src/main/java/io/grpc/s2a/handshaker/ProtoUtil.java",
7272
"src/main/java/io/grpc/s2a/handshaker/S2AConnectionException.java",

s2a/src/main/java/io/grpc/s2a/handshaker/ConnectionIsClosedException.java renamed to s2a/src/main/java/io/grpc/s2a/handshaker/ConnectionClosedException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
/** Indicates that a connection has been closed. */
2222
@SuppressWarnings("serial") // This class is never serialized.
23-
final class ConnectionIsClosedException extends IOException {
24-
public ConnectionIsClosedException(String errorMessage) {
23+
final class ConnectionClosedException extends IOException {
24+
public ConnectionClosedException(String errorMessage) {
2525
super(errorMessage);
2626
}
2727
}

s2a/src/main/java/io/grpc/s2a/handshaker/S2AStub.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,20 @@ BlockingQueue<Result> getResponses() {
7474

7575
/**
7676
* Sends a request and returns the response. Caller must wait until this method executes prior to
77-
* calling it again. If this method throws {@code ConnectionIsClosedException}, then it should not
77+
* calling it again. If this method throws {@code ConnectionClosedException}, then it should not
7878
* be called again, and both {@code reader} and {@code writer} are closed.
7979
*
8080
* @param req the {@code SessionReq} message to be sent to the S2A server.
8181
* @return the {@code SessionResp} message received from the S2A server.
82-
* @throws ConnectionIsClosedException if {@code reader} or {@code writer} calls their {@code
82+
* @throws ConnectionClosedException if {@code reader} or {@code writer} calls their {@code
8383
* onCompleted} method.
8484
* @throws IOException if an unexpected response is received, or if the {@code reader} or {@code
8585
* writer} calls their {@code onError} method.
8686
*/
8787
public SessionResp send(SessionReq req) throws IOException, InterruptedException {
8888
if (doneWriting && doneReading) {
8989
logger.log(Level.INFO, "Stream to the S2A is closed.");
90-
throw new ConnectionIsClosedException("Stream to the S2A is closed.");
90+
throw new ConnectionClosedException("Stream to the S2A is closed.");
9191
}
9292
createWriterIfNull();
9393
if (!responses.isEmpty()) {
@@ -121,10 +121,10 @@ public SessionResp send(SessionReq req) throws IOException, InterruptedException
121121
}
122122
try {
123123
return responses.take().getResultOrThrow();
124-
} catch (ConnectionIsClosedException e) {
125-
// A ConnectionIsClosedException is thrown by getResultOrThrow when reader calls its
124+
} catch (ConnectionClosedException e) {
125+
// A ConnectionClosedException is thrown by getResultOrThrow when reader calls its
126126
// onCompleted method. The close method is called to also close the writer, and then the
127-
// ConnectionIsClosedException is re-thrown in order to indicate to the caller that send
127+
// ConnectionClosedException is re-thrown in order to indicate to the caller that send
128128
// should not be called again.
129129
close();
130130
throw e;
@@ -177,7 +177,7 @@ public void onError(Throwable t) {
177177
}
178178

179179
/**
180-
* Sets {@code doneReading} to true, and places a {@code ConnectionIsClosedException} in the
180+
* Sets {@code doneReading} to true, and places a {@code ConnectionClosedException} in the
181181
* {@code responses} queue.
182182
*/
183183
@Override
@@ -186,7 +186,7 @@ public void onCompleted() {
186186
doneReading = true;
187187
responses.offer(
188188
Result.createWithThrowable(
189-
new ConnectionIsClosedException("Reading from the S2A is complete.")));
189+
new ConnectionClosedException("Reading from the S2A is complete.")));
190190
}
191191
}
192192

@@ -211,8 +211,8 @@ private Result(Optional<SessionResp> response, Optional<Throwable> throwable) {
211211
/** Throws {@code throwable} if present, and returns {@code response} otherwise. */
212212
SessionResp getResultOrThrow() throws IOException {
213213
if (throwable.isPresent()) {
214-
if (throwable.get() instanceof ConnectionIsClosedException) {
215-
ConnectionIsClosedException exception = (ConnectionIsClosedException) throwable.get();
214+
if (throwable.get() instanceof ConnectionClosedException) {
215+
ConnectionClosedException exception = (ConnectionClosedException) throwable.get();
216216
throw exception;
217217
} else {
218218
throw new IOException(throwable.get());

s2a/src/test/java/io/grpc/s2a/handshaker/S2AStubTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ public void send_receiveErrorResponse() throws InterruptedException {
147147
public void send_receiveCompleteStatus() throws Exception {
148148
writer.setBehavior(FakeWriter.Behavior.COMPLETE_STATUS);
149149

150-
ConnectionIsClosedException expected =
150+
ConnectionClosedException expected =
151151
assertThrows(
152-
ConnectionIsClosedException.class, () -> stub.send(SessionReq.getDefaultInstance()));
152+
ConnectionClosedException.class, () -> stub.send(SessionReq.getDefaultInstance()));
153153

154154
assertThat(expected).hasMessageThat().contains("Reading from the S2A is complete.");
155155
}
@@ -216,9 +216,9 @@ public void send_afterEarlyClose_receivesClosedException() throws InterruptedExc
216216
stub.close();
217217
expect.that(writer.isFakeWriterClosed()).isTrue();
218218

219-
ConnectionIsClosedException expected =
219+
ConnectionClosedException expected =
220220
assertThrows(
221-
ConnectionIsClosedException.class, () -> stub.send(SessionReq.getDefaultInstance()));
221+
ConnectionClosedException.class, () -> stub.send(SessionReq.getDefaultInstance()));
222222

223223
assertThat(expected).hasMessageThat().contains("Stream to the S2A is closed.");
224224
}

0 commit comments

Comments
 (0)