Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2009-10-13 19:44:33 -0400
committerspingel2009-10-13 19:44:33 -0400
commit230b062edeec3e68086ab88ec0c36cd24f7772c1 (patch)
tree77e36887c191217332f77b6e8a3ffd3aade407b0
parent43b376d2801aac2b8688464982618aa434c6372e (diff)
downloadorg.eclipse.mylyn.tasks-230b062edeec3e68086ab88ec0c36cd24f7772c1.tar.gz
org.eclipse.mylyn.tasks-230b062edeec3e68086ab88ec0c36cd24f7772c1.tar.xz
org.eclipse.mylyn.tasks-230b062edeec3e68086ab88ec0c36cd24f7772c1.zip
NEW - bug 221939: [releng] manage branches
https://bugs.eclipse.org/bugs/show_bug.cgi?id=221939
-rw-r--r--org.eclipse.mylyn.tasks.core/.options1
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeRepositoriesJob.java24
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListSynchronizationScheduler.java12
3 files changed, 33 insertions, 4 deletions
diff --git a/org.eclipse.mylyn.tasks.core/.options b/org.eclipse.mylyn.tasks.core/.options
new file mode 100644
index 000000000..d0f398222
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core/.options
@@ -0,0 +1 @@
+org.eclipse.mylyn.tasks.core/debug/synchronization=true
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeRepositoriesJob.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeRepositoriesJob.java
index 15a13f6e4..2b1b74f6e 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeRepositoriesJob.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeRepositoriesJob.java
@@ -22,6 +22,7 @@ import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
@@ -45,6 +46,8 @@ import org.eclipse.osgi.util.NLS;
*/
public class SynchronizeRepositoriesJob extends SynchronizationJob {
+ private static final boolean TRACE_ENABLED = Boolean.valueOf(Platform.getDebugOption("org.eclipse.mylyn.tasks.core/debug/synchronization")); //$NON-NLS-1$
+
private final TaskList taskList;
private final TaskDataManager taskDataManager;
@@ -87,12 +90,18 @@ public class SynchronizeRepositoriesJob extends SynchronizationJob {
try {
monitor.beginTask(Messages.SynchronizeRepositoriesJob_Processing, repositories.size() * 100);
+ if (TRACE_ENABLED) {
+ trace("Starting repository synchronization");
+ }
for (TaskRepository repository : repositories) {
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
if (repository.isOffline()) {
+ if (TRACE_ENABLED) {
+ trace("Skipping synchronization for " + repository.getRepositoryLabel());
+ }
monitor.worked(100);
continue;
}
@@ -115,13 +124,21 @@ public class SynchronizeRepositoriesJob extends SynchronizationJob {
if (isUser() || queries.isEmpty()) {
monitor.worked(20);
} else {
+ if (TRACE_ENABLED) {
+ trace("Updating configurarion for " + repository.getRepositoryLabel());
+ }
// occasionally request update of repository configuration attributes as part of background synchronizations
updateRepositoryConfiguration(repository, connector, new SubProgressMonitor(monitor, 20));
}
+ if (TRACE_ENABLED) {
+ trace("Synchronizing queries for " + repository.getRepositoryLabel());
+ }
updateQueries(repository, connector, queries, monitor);
}
-
+ if (TRACE_ENABLED) {
+ trace("Completed repository synchronization");
+ }
// it's better to remove the job from the progress view instead of having it blocked until all child jobs finish
// if (isUser()) {
// Job.getJobManager().join(family, monitor);
@@ -190,4 +207,9 @@ public class SynchronizeRepositoriesJob extends SynchronizationJob {
monitor.done();
}
}
+
+ private void trace(String message) {
+ System.err.println("[" + new Date() + "] " + message); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListSynchronizationScheduler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListSynchronizationScheduler.java
index dbb23a1b9..519bb0b98 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListSynchronizationScheduler.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListSynchronizationScheduler.java
@@ -11,6 +11,8 @@
package org.eclipse.mylyn.internal.tasks.ui;
+import java.util.Date;
+
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
@@ -100,7 +102,7 @@ public class TaskListSynchronizationScheduler implements IUserAttentionListener
private synchronized void cancel() {
// prevent listener from rescheduling due to cancel
if (TRACE_ENABLED) {
- System.err.println("Canceling synchronization in " + DateUtil.getFormattedDurationShort(this.scheduledTime - System.currentTimeMillis())); //$NON-NLS-1$
+ System.err.println("Canceling synchronization scheduled to run in " + DateUtil.getFormattedDurationShort(this.scheduledTime - System.currentTimeMillis())); //$NON-NLS-1$
}
refreshJob.removeJobChangeListener(jobListener);
refreshJob.cancel();
@@ -126,8 +128,8 @@ public class TaskListSynchronizationScheduler implements IUserAttentionListener
this.scheduledTime = 0;
if (refreshJob != null) {
- refreshJob.removeJobChangeListener(jobListener);
cancel();
+ refreshJob.removeJobChangeListener(jobListener);
refreshJob = null;
}
@@ -143,7 +145,7 @@ public class TaskListSynchronizationScheduler implements IUserAttentionListener
synchronized (this) {
if (!userActive) {
if (TRACE_ENABLED) {
- System.err.println("User activity detected"); //$NON-NLS-1$
+ trace("User activity detected"); //$NON-NLS-1$
}
this.userActive = true;
// reset inactive interval each time the user becomes active
@@ -159,6 +161,10 @@ public class TaskListSynchronizationScheduler implements IUserAttentionListener
}
}
+ private void trace(String message) {
+ System.err.println("[" + new Date() + "] " + message); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
public void userAttentionLost() {
synchronized (this) {
this.userActive = false;

Back to the top