Skip to content

Commit

Permalink
apply comments (5th)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-horikawa committed May 10, 2024
1 parent cc4aa4b commit 9e798f9
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,11 @@ public synchronized void close() throws IOException, ServerException, Interrupte
try {
if (!gotton.getAndSet(true)) {
if (closeTimeout != null) {
try {
var obj = get(closeTimeout.value(), closeTimeout.unit());
if (obj instanceof ServerResource) {
var sr = (ServerResource) obj;
sr.setCloseTimeout(closeTimeout);
sr.close();
}
} catch (TimeoutException e) {
exception = new ResponseTimeoutException(e);
throw (ResponseTimeoutException) exception;
var obj = get(closeTimeout.value(), closeTimeout.unit());
if (obj instanceof ServerResource) {
var sr = (ServerResource) obj;
sr.setCloseTimeout(closeTimeout);
sr.close();
}
} else {
var obj = get();
Expand All @@ -170,34 +165,39 @@ public synchronized void close() throws IOException, ServerException, Interrupte
sr.close();
}
}
}
}
} catch (TimeoutException e) {
exception = new ResponseTimeoutException(e);
} catch (Exception e) {
exception = e;
} finally {
try {
var up = unprocessed.getAndSet(null);
if (closeTimeout != null && up != null) {
up.setCloseTimeout(closeTimeout);
}
Owner.close(up);
} catch (IOException | ServerException | InterruptedException e) {
} catch (Exception e) {
if (exception == null) {
exception = e;
} else {
exception.addSuppressed(e);
}
throwException(exception);
} finally {
try {
if (closeTimeout != null) {
delegate.setCloseTimeout(closeTimeout);
}
delegate.close();
closed.set(true);
} catch (IOException | ServerException | InterruptedException e) {
} catch (Exception e) {
if (exception == null) {
exception = e;
} else {
exception.addSuppressed(e);
}
}
if (exception != null) {
throwException(exception);
}
}
Expand Down

0 comments on commit 9e798f9

Please sign in to comment.