use of se.trixon.jota.shared.ClientCallbacks in project java-jotasync by trixon.
the class Server method intiListeners.
private void intiListeners() {
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
notifyClientsShutdown();
}));
mOptions.getPreferences().addPreferenceChangeListener((PreferenceChangeEvent evt) -> {
HashSet<ClientCallbacks> invalidClientCallbacks = new HashSet<>();
for (ClientCallbacks clientCallback : mClientCallbacks) {
switch(evt.getKey()) {
case ServerOptions.KEY_CRON_ACTIVE:
{
try {
clientCallback.onServerEvent(ServerEvent.CRON_CHANGED);
} catch (RemoteException ex) {
// Add invalid reference for removal
invalidClientCallbacks.add(clientCallback);
}
}
break;
}
}
invalidClientCallbacks.stream().forEach((invalidClientCallback) -> {
// Remove invalid reference
mClientCallbacks.remove(invalidClientCallback);
});
});
}
use of se.trixon.jota.shared.ClientCallbacks in project java-jotasync by trixon.
the class Server method startJob.
@Override
public void startJob(Job job, boolean dryRun) throws RemoteException {
Xlog.timedOut(String.format("Job started: %s", job.getName()));
for (ClientCallbacks clientCallback : mClientCallbacks) {
clientCallback.onProcessEvent(ProcessEvent.STARTED, job, null, null);
}
JobExecutor jobExecutor = new JobExecutor(this, job, dryRun);
mJobExecutors.put(job.getId(), jobExecutor);
jobExecutor.start();
}
Aggregations