use of org.jumpmind.symmetric.model.RemoteNodeStatuses in project symmetric-ds by JumpMind.
the class AbstractIntegrationTest method clientPull.
protected boolean clientPull() {
int tries = 0;
boolean pulled = false;
while (!pulled && tries < 10) {
RemoteNodeStatuses statuses = getClient().pull();
try {
statuses.waitForComplete(20000);
} catch (InterruptedException ex) {
}
pulled = statuses.wasDataProcessed();
AppUtils.sleep(100);
tries++;
}
return pulled;
}
use of org.jumpmind.symmetric.model.RemoteNodeStatuses in project symmetric-ds by JumpMind.
the class AbstractIntegrationTest method clientPush.
protected boolean clientPush() {
int tries = 0;
boolean pushed = false;
while (!pushed && tries < 10) {
RemoteNodeStatuses statuses = getClient().push();
statuses.waitForComplete(15000);
pushed = statuses.wasDataProcessed();
AppUtils.sleep(100);
tries++;
}
return pushed;
}
use of org.jumpmind.symmetric.model.RemoteNodeStatuses in project symmetric-ds by JumpMind.
the class AbstractTest method push.
protected boolean push(String name) {
int tries = 0;
boolean push = false;
boolean lastPush = false;
boolean errorOccurred = false;
while (!errorOccurred && (lastPush || (!push && tries < 10))) {
RemoteNodeStatuses statuses = getWebServer(name).getEngine().push();
try {
statuses.waitForComplete(60000);
} catch (InterruptedException ex) {
log.warn(ex.getMessage());
}
lastPush = statuses.wasDataProcessed();
errorOccurred = statuses.errorOccurred();
push |= lastPush;
AppUtils.sleep(100);
tries++;
}
return push;
}
use of org.jumpmind.symmetric.model.RemoteNodeStatuses in project symmetric-ds by JumpMind.
the class OfflinePullService method pullData.
public synchronized RemoteNodeStatuses pullData(boolean force) {
RemoteNodeStatuses statuses = new RemoteNodeStatuses(configurationService.getChannels(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);
int availableThreads = nodeCommunicationService.getAvailableThreads(CommunicationType.OFFLN_PULL);
for (NodeCommunication nodeCommunication : nodes) {
if (availableThreads > 0) {
if (nodeCommunicationService.execute(nodeCommunication, statuses, this)) {
availableThreads--;
}
}
}
} else {
log.debug("Did not run the offline pull process because it has been stopped");
}
}
return statuses;
}
use of org.jumpmind.symmetric.model.RemoteNodeStatuses in project symmetric-ds by JumpMind.
the class FileSyncService method queueJob.
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();
if (identity != null && identity.isSyncEnabled()) {
if (force || !engine.getClusterService().isInfiniteLocked(clusterLock)) {
INodeCommunicationService nodeCommunicationService = engine.getNodeCommunicationService();
List<NodeCommunication> nodes = nodeCommunicationService.list(type);
int availableThreads = nodeCommunicationService.getAvailableThreads(type);
for (NodeCommunication nodeCommunication : nodes) {
if (StringUtils.isNotBlank(nodeCommunication.getNode().getSyncUrl()) || !parameterService.isRegistrationServer()) {
boolean meetsMinimumTime = true;
if (minimumPeriodMs > 0 && nodeCommunication.getLastLockTime() != null && (System.currentTimeMillis() - nodeCommunication.getLastLockTime().getTime()) < minimumPeriodMs) {
meetsMinimumTime = false;
}
if (availableThreads > 0 && meetsMinimumTime) {
if (nodeCommunicationService.execute(nodeCommunication, statuses, this)) {
availableThreads--;
}
}
} else {
log.warn("File sync cannot communicate with node '{}' in the group '{}'. The sync url is blank", nodeCommunication.getNode().getNodeId(), nodeCommunication.getNode().getNodeGroupId());
}
}
} else {
log.debug("Did not run the {} process because it has been stopped", type.name().toLowerCase());
}
}
return statuses;
}
Aggregations