Skip to content

Commit

Permalink
#3952: Dubbo 2.7.1 delay export function doesn't work, a follow up for
Browse files Browse the repository at this point in the history
  • Loading branch information
beiwei30 authored and ralf0131 committed Apr 30, 2019
1 parent e2f3346 commit 78c7509
Showing 1 changed file with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,35 +335,33 @@ public synchronized void export() {
}

if (shouldDelay()) {
delayExportExecutor.schedule(this::doExport, delay, TimeUnit.MILLISECONDS);
delayExportExecutor.schedule(this::doExport, getDelay(), TimeUnit.MILLISECONDS);
} else {
doExport();
}
}

private boolean shouldExport() {
Boolean shouldExport = getExport();
if (shouldExport == null && provider != null) {
shouldExport = provider.getExport();
}

Boolean export = getExport();
// default value is true
if (shouldExport == null) {
return true;
}
return export == null ? true : export;
}

return shouldExport;
@Override
public Boolean getExport() {
return (export == null && provider != null) ? provider.getExport() : export;
}

private boolean shouldDelay() {
Integer delay = getDelay();
if (delay == null && provider != null) {
delay = provider.getDelay();
}
this.delay = delay;
return delay != null && delay > 0;
}

@Override
public Integer getDelay() {
return (delay == null && provider != null) ? provider.getDelay() : delay;
}

protected synchronized void doExport() {
if (unexported) {
throw new IllegalStateException("The service " + interfaceClass.getName() + " has already unexported!");
Expand Down

0 comments on commit 78c7509

Please sign in to comment.