Skip to content

Commit

Permalink
Refactor MetaDataContextHolder (#34245)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu authored Jan 4, 2025
1 parent 51bbcd2 commit 52a599d
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@

package org.apache.shardingsphere.mode.metadata;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;

/**
* Meta data context holder.
*/
@AllArgsConstructor
@RequiredArgsConstructor
@Slf4j
public final class MetaDataContextHolder {

Expand All @@ -44,8 +46,8 @@ public final class MetaDataContextHolder {
*/
public MetaDataContexts getMetaDataContextsAsync() {
try {
return future.get(5, TimeUnit.SECONDS);
} catch (final InterruptedException | java.util.concurrent.ExecutionException | java.util.concurrent.TimeoutException ex) {
return future.get(5L, TimeUnit.SECONDS);
} catch (final InterruptedException | ExecutionException | TimeoutException ex) {
return metaDataContexts.get();
}
}
Expand Down

0 comments on commit 52a599d

Please sign in to comment.