Version 1.3: bugfix, add shutdown for SyncTarget threads.
* SyncTarget now persists the remote timeline after pushing to it. * Added SyncTarget.shutdown() to allow callers to signal the sync timer thread to stop. * Fixed a bug where a SyncTarget was added instanciated times.
This commit is contained in:
parent
6e6d799dee
commit
68ce5bb272
Binary file not shown.
BIN
lib/compile/jar/jdb-util-2.0.jar
Normal file
BIN
lib/compile/jar/jdb-util-2.0.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
lib/runtime/jar/jdb-util-2.0.jar
Normal file
BIN
lib/runtime/jar/jdb-util-2.0.jar
Normal file
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
#Fri, 09 Aug 2013 11:36:19 -0500
|
#Fri, 13 Sep 2013 08:25:17 -0500
|
||||||
name=timestamper-lib
|
name=timestamper-lib
|
||||||
version=1.2
|
version=1.3
|
||||||
lib.local=true
|
lib.local=true
|
||||||
build.number=1
|
build.number=10
|
||||||
|
Binary file not shown.
BIN
release/timestamper-lib-1.3.jar
Normal file
BIN
release/timestamper-lib-1.3.jar
Normal file
Binary file not shown.
@ -153,7 +153,7 @@ public class JDBLabsWebTimelineSource extends TimelineSource {
|
|||||||
requestContentType = JSON
|
requestContentType = JSON
|
||||||
body = entryBody
|
body = entryBody
|
||||||
|
|
||||||
response.success = { entryHashes.put(fullHash(entry), entry.id) }
|
response.success = { entryHashes.put(fullHash(entry), entry.id ?: 0) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,11 +91,19 @@ public class SyncTarget {
|
|||||||
remoteTimeline.addAll(diffFromLocal);
|
remoteTimeline.addAll(diffFromLocal);
|
||||||
syncPerformed = true;
|
syncPerformed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// try to persist the updated remote timeline
|
||||||
|
SyncTarget.this.source.persist(remoteTimeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
return syncPerformed;
|
return syncPerformed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void shutdown() {
|
||||||
|
syncTimer.cancel();
|
||||||
|
syncTimer.purge();
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() { return name; }
|
public String getName() { return name; }
|
||||||
|
|
||||||
public TimelineSource getSource() { return source; }
|
public TimelineSource getSource() { return source; }
|
||||||
|
@ -123,9 +123,6 @@ public class TimelineProperties {
|
|||||||
timeline = timelineSource.read();
|
timeline = timelineSource.read();
|
||||||
|
|
||||||
// search keys for remote timeline entries
|
// search keys for remote timeline entries
|
||||||
// TODO: this code will add a new sync object for every remote target
|
|
||||||
// property, regardless of whether the SyncTarget for that remote URI
|
|
||||||
// already exists
|
|
||||||
for (Object keyObj : config.keySet()) {
|
for (Object keyObj : config.keySet()) {
|
||||||
if (!(keyObj instanceof String)) continue;
|
if (!(keyObj instanceof String)) continue;
|
||||||
|
|
||||||
@ -138,6 +135,14 @@ public class TimelineProperties {
|
|||||||
if (!m.matches()) continue;
|
if (!m.matches()) continue;
|
||||||
|
|
||||||
stName = m.group(1);
|
stName = m.group(1);
|
||||||
|
|
||||||
|
// skip if we have already setup this remote sync
|
||||||
|
boolean stExists = false;
|
||||||
|
for (SyncTarget target : syncTargets)
|
||||||
|
if (target.getName().equals(stName))
|
||||||
|
stExists = true;
|
||||||
|
if (stExists) continue;
|
||||||
|
|
||||||
remoteBase = REMOTE_TIMELINE_BASE + stName;
|
remoteBase = REMOTE_TIMELINE_BASE + stName;
|
||||||
|
|
||||||
strURI = (String) config.getProperty(remoteBase + ".uri", "");
|
strURI = (String) config.getProperty(remoteBase + ".uri", "");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user