Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2010-05-25 17:08:33 -0400
committerrelves2010-05-25 17:08:33 -0400
commit59230af2cab7f285ff5d2e74484f0e48fe4ae64b (patch)
tree59a34d6f98e0147df7f93fa7e6e2c73811e5872d /org.eclipse.mylyn.tasks.core
parentfb465fd26be2b505c2c2ffda3fe12af4d8f323be (diff)
downloadorg.eclipse.mylyn.tasks-59230af2cab7f285ff5d2e74484f0e48fe4ae64b.tar.gz
org.eclipse.mylyn.tasks-59230af2cab7f285ff5d2e74484f0e48fe4ae64b.tar.xz
org.eclipse.mylyn.tasks-59230af2cab7f285ff5d2e74484f0e48fe4ae64b.zip
NEW - bug 263528: display a repository service message to warn users of problems, updates, and other relevant information
https://bugs.eclipse.org/bugs/show_bug.cgi?id=263528
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/notifications/ServiceMessageManager.java25
1 files changed, 22 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/notifications/ServiceMessageManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/notifications/ServiceMessageManager.java
index 1f7247f6c..c436736c5 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/notifications/ServiceMessageManager.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/notifications/ServiceMessageManager.java
@@ -11,6 +11,7 @@ package org.eclipse.mylyn.internal.tasks.core.notifications;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Date;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -60,9 +61,12 @@ public class ServiceMessageManager {
private boolean statusLogged;
- public ServiceMessageManager(String serviceMessageUrl, String lastModified, String eTag) {
+ private final long checktime;
+
+ public ServiceMessageManager(String serviceMessageUrl, String lastModified, String eTag, long checktime) {
this.serviceMessageUrl = serviceMessageUrl;
this.lastModified = lastModified;
+ this.checktime = checktime;
this.eTag = eTag;
}
@@ -87,7 +91,22 @@ public class ServiceMessageManager {
}
});
}
- messageCheckJob.schedule(START_DELAY);
+ if (checktime == 0) {
+ messageCheckJob.schedule(START_DELAY);
+ } else {
+ long nextCheckTime = checktime + RECHECK_DELAY;
+ long now = new Date().getTime();
+ if (nextCheckTime < now) {
+ messageCheckJob.schedule(START_DELAY);
+ } else if (nextCheckTime > now) {
+ if ((nextCheckTime - now) < START_DELAY) {
+ messageCheckJob.schedule(START_DELAY);
+ } else {
+ messageCheckJob.schedule(nextCheckTime - now);
+ }
+ }
+ }
+
}
public void stop() {
@@ -172,7 +191,7 @@ public class ServiceMessageManager {
try {
status = WebUtil.execute(httpClient, hostConfiguration, method, monitor);
- if (status == HttpStatus.SC_OK && messageCheckJob != null) {
+ if (status == HttpStatus.SC_OK) {
Header lastModifiedHeader = method.getResponseHeader("Last-Modified"); //$NON-NLS-1$
if (lastModifiedHeader != null) {
lastModified = lastModifiedHeader.getValue();

Back to the top