Browse Source

Merge pull request #480 in DESIGN/design from ~JU/design:feature/10.0 to feature/10.0

* commit 'ccaf797fd825664428b34735ff346fd63552be63':
  REPORT-11216 10.0远程设计问题解决 isRoot缓存下,不用每次都rpc
  REPORT-11216 10.0远程设计问题解决 isRoot缓存下,不用每次都rpc
research/10.0
ju 6 years ago
parent
commit
1f0ac6d5c3
  1. 16
      designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java

16
designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java vendored

@ -21,6 +21,8 @@ public class RemoteWorkspace implements Workspace {
private final WorkspaceConnectionInfo connection; private final WorkspaceConnectionInfo connection;
private volatile Boolean isRoot = null;
RemoteWorkspace(WorkspaceClient client, WorkspaceConnectionInfo connection) { RemoteWorkspace(WorkspaceClient client, WorkspaceConnectionInfo connection) {
this.client = client; this.client = client;
@ -54,11 +56,15 @@ public class RemoteWorkspace implements Workspace {
@Override @Override
public boolean isRoot() { public boolean isRoot() {
try {
return WorkContext.getCurrent().get(DecisionOperator.class).isRoot(getConnection().getUserName()); if (isRoot == null) {
} catch (Exception e) { synchronized (this) {
return false; if (isRoot == null) {
isRoot = WorkContext.getCurrent().get(DecisionOperator.class).isRoot(getConnection().getUserName());
}
}
} }
return isRoot;
} }
@Override @Override
@ -88,6 +94,6 @@ public class RemoteWorkspace implements Workspace {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return obj != null && obj instanceof RemoteWorkspace && AssistUtils.equals(((RemoteWorkspace) obj).connection, this.connection); return obj instanceof RemoteWorkspace && AssistUtils.equals(((RemoteWorkspace) obj).connection, this.connection);
} }
} }

Loading…
Cancel
Save