Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix double-checked locking #3323

Merged
merged 1 commit into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix double-checked locking
  • Loading branch information
biyuhao committed Jan 23, 2019
commit d8413673f851a27e5d0f13e8ea39afdf9b715c51
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class MetadataReportService {

protected final Logger logger = LoggerFactory.getLogger(getClass());

private static MetadataReportService metadataReportService;
private static volatile MetadataReportService metadataReportService;
private static Object lock = new Object();

private MetadataReportFactory metadataReportFactory = ExtensionLoader.getExtensionLoader(MetadataReportFactory.class).getAdaptiveExtension();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class MetadataReportRetry {
protected final Logger logger = LoggerFactory.getLogger(getClass());

final ScheduledExecutorService retryExecutor = Executors.newScheduledThreadPool(0, new NamedThreadFactory("DubboRegistryFailedRetryTimer", true));
ScheduledFuture retryScheduledFuture;
volatile ScheduledFuture retryScheduledFuture;
AtomicInteger retryCounter = new AtomicInteger(0);
// retry task schedule period
long retryPeriod;
Expand Down