Skip to content

Commit 0f1bdd5

Browse files
committed
abstract runnable
1 parent acf6da4 commit 0f1bdd5

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

modules/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3PerProjectClientManager.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.elasticsearch.common.settings.ProjectSecrets;
1919
import org.elasticsearch.common.settings.Settings;
2020
import org.elasticsearch.common.util.Maps;
21+
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
2122
import org.elasticsearch.core.IOUtils;
2223
import org.elasticsearch.core.Nullable;
2324
import org.elasticsearch.logging.LogManager;
@@ -143,9 +144,18 @@ public void applyClusterState(ClusterChangedEvent event) {
143144
}
144145

145146
private void closeClientsAsync(List<ClientsHolder> clientsHoldersToClose, ActionListener<Void> listener) {
146-
executor.execute(() -> {
147-
IOUtils.closeWhileHandlingException(clientsHoldersToClose);
148-
listener.onResponse(null);
147+
executor.execute(new AbstractRunnable() {
148+
@Override
149+
protected void doRun() throws Exception {
150+
IOUtils.closeWhileHandlingException(clientsHoldersToClose);
151+
listener.onResponse(null);
152+
}
153+
154+
@Override
155+
public void onFailure(Exception e) {
156+
logger.warn("Failed to close s3 clients", e);
157+
listener.onFailure(e);
158+
}
149159
});
150160
}
151161

0 commit comments

Comments
 (0)