Skip to content

Commit

Permalink
0002667: Use node identity cache
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Jul 2, 2016
1 parent 8bb05f5 commit 2a08830
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
Expand Up @@ -919,7 +919,7 @@ protected void pullFilesFromNode(NodeCommunication nodeCommunication, RemoteNode
protected RemoteNodeStatuses queueJob(boolean force, long minimumPeriodMs, String clusterLock,
CommunicationType type) {
final RemoteNodeStatuses statuses = new RemoteNodeStatuses(engine.getConfigurationService().getChannels(false));
Node identity = engine.getNodeService().findIdentity(false);
Node identity = engine.getNodeService().findIdentity();
if (identity != null && identity.isSyncEnabled()) {
if (force || !engine.getClusterService().isInfiniteLocked(clusterLock)) {

Expand Down
Expand Up @@ -73,7 +73,7 @@ public OfflinePullService(IParameterService parameterService, ISymmetricDialect

synchronized public RemoteNodeStatuses pullData(boolean force) {
RemoteNodeStatuses statuses = new RemoteNodeStatuses(configurationService.getChannels(false));
Node identity = nodeService.findIdentity(false);
Node identity = nodeService.findIdentity();
if (identity != null && identity.isSyncEnabled()) {
if (force || !clusterService.isInfiniteLocked(ClusterConstants.OFFLINE_PULL)) {
List<NodeCommunication> nodes = nodeCommunicationService.list(CommunicationType.OFFLN_PULL);
Expand Down
Expand Up @@ -88,7 +88,7 @@ public OfflinePushService(IParameterService parameterService, ISymmetricDialect

synchronized public RemoteNodeStatuses pushData(boolean force) {
RemoteNodeStatuses statuses = new RemoteNodeStatuses(configurationService.getChannels(false));
Node identity = nodeService.findIdentity(false);
Node identity = nodeService.findIdentity();
if (identity != null && identity.isSyncEnabled()) {
if (force || !clusterService.isInfiniteLocked(ClusterConstants.OFFLINE_PUSH)) {
List<NodeCommunication> nodes = nodeCommunicationService.list(CommunicationType.OFFLN_PUSH);
Expand Down Expand Up @@ -127,7 +127,7 @@ public void execute(NodeCommunication nodeCommunication, RemoteNodeStatus status
}

private void pushToNode(Node remote, RemoteNodeStatus status) {
Node identity = nodeService.findIdentity(false);
Node identity = nodeService.findIdentity();
FileOutgoingTransport transport = null;
ProcessInfo processInfo = statisticManager.newProcessInfo(new ProcessInfoKey(
identity.getNodeId(), status.getChannelId(), remote.getNodeId(), ProcessType.OFFLINE_PUSH));
Expand Down
Expand Up @@ -80,13 +80,13 @@ public PullService(IParameterService parameterService, ISymmetricDialect symmetr

synchronized public RemoteNodeStatuses pullData(boolean force) {
final RemoteNodeStatuses statuses = new RemoteNodeStatuses(configurationService.getChannels(false));
Node identity = nodeService.findIdentity(false);
Node identity = nodeService.findIdentity();
if (identity == null || identity.isSyncEnabled()) {
long minimumPeriodMs = parameterService.getLong(ParameterConstants.PULL_MINIMUM_PERIOD_MS, -1);
if (force || !clusterService.isInfiniteLocked(ClusterConstants.PULL)) {
// register if we haven't already been registered
registrationService.registerWithServer();
identity = nodeService.findIdentity(false);
identity = nodeService.findIdentity();
if (identity != null) {
List<NodeCommunication> nodes = nodeCommunicationService
.list(CommunicationType.PULL);
Expand Down
Expand Up @@ -103,7 +103,7 @@ public Map<String, Date> getStartTimesOfNodesBeingPushedTo() {
synchronized public RemoteNodeStatuses pushData(boolean force) {
RemoteNodeStatuses statuses = new RemoteNodeStatuses(configurationService.getChannels(false));

Node identity = nodeService.findIdentity(false);
Node identity = nodeService.findIdentity();
if (identity != null && identity.isSyncEnabled()) {
long minimumPeriodMs = parameterService.getLong(ParameterConstants.PUSH_MINIMUM_PERIOD_MS, -1);
if (force || !clusterService.isInfiniteLocked(ClusterConstants.PUSH)) {
Expand Down Expand Up @@ -186,7 +186,7 @@ public void execute(NodeCommunication nodeCommunication, RemoteNodeStatus status
}

private void pushToNode(Node remote, RemoteNodeStatus status) {
Node identity = nodeService.findIdentity(false);
Node identity = nodeService.findIdentity();
NodeSecurity identitySecurity = nodeService.findNodeSecurity(identity.getNodeId());
IOutgoingWithResponseTransport transport = null;
ProcessInfo processInfo = statisticManager.newProcessInfo(new ProcessInfoKey(identity
Expand Down
Expand Up @@ -1516,7 +1516,7 @@ private Node nodeImpl(ISymmetricEngine engine) {
Node xmlNode = new Node();
if (isRegistered(engine)) {
INodeService nodeService = engine.getNodeService();
org.jumpmind.symmetric.model.Node modelNode = nodeService.findIdentity(false);
org.jumpmind.symmetric.model.Node modelNode = nodeService.findIdentity();
List<NodeHost> nodeHosts = nodeService.findNodeHosts(modelNode.getNodeId());
NodeSecurity nodeSecurity = nodeService.findNodeSecurity(modelNode.getNodeId());
xmlNode.setNodeId(modelNode.getNodeId());
Expand Down Expand Up @@ -1559,7 +1559,7 @@ private boolean isRootNode(ISymmetricEngine engine, org.jumpmind.symmetric.model
private boolean isRegistered(ISymmetricEngine engine) {
boolean registered = true;
INodeService nodeService = engine.getNodeService();
org.jumpmind.symmetric.model.Node modelNode = nodeService.findIdentity(false);
org.jumpmind.symmetric.model.Node modelNode = nodeService.findIdentity();
if (modelNode == null) {
registered = false;
} else {
Expand All @@ -1576,7 +1576,7 @@ private NodeStatus nodeStatusImpl(ISymmetricEngine engine) {
NodeStatus status = new NodeStatus();
if (isRegistered(engine)) {
INodeService nodeService = engine.getNodeService();
org.jumpmind.symmetric.model.Node modelNode = nodeService.findIdentity(false);
org.jumpmind.symmetric.model.Node modelNode = nodeService.findIdentity();
NodeSecurity nodeSecurity = nodeService.findNodeSecurity(modelNode.getNodeId());
List<NodeHost> nodeHost = nodeService.findNodeHosts(modelNode.getNodeId());
status.setStarted(engine.isStarted());
Expand Down

0 comments on commit 2a08830

Please sign in to comment.