3 Commits
1.2 ... 1.5

Author SHA1 Message Date
4c8d8a9f2d Version 1.5: Fixed an issue with JDBLabsWebTimeline persist. 2013-09-22 15:19:44 -05:00
4992d7cac9 Version 1.4: SyncTarget syncOnExit property is meaningful now. 2013-09-13 09:24:44 -05:00
68ce5bb272 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.
2013-09-13 08:48:50 -05:00
10 changed files with 23 additions and 6 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
#Fri, 09 Aug 2013 11:36:19 -0500
#Sun, 22 Sep 2013 14:58:43 -0500
name=timestamper-lib
version=1.2
version=1.5
lib.local=true
build.number=1

Binary file not shown.

Binary file not shown.

View File

@ -153,7 +153,8 @@ public class JDBLabsWebTimelineSource extends TimelineSource {
requestContentType = JSON
body = entryBody
response.success = { entryHashes.put(fullHash(entry), entry.id) }
response.success = { resp, json ->
entryHashes.put(fullHash(entry), json?.id ?: 0) }
}
}
}

View File

@ -91,11 +91,22 @@ public class SyncTarget {
remoteTimeline.addAll(diffFromLocal);
syncPerformed = true;
}
// try to persist the updated remote timeline
SyncTarget.this.source.persist(remoteTimeline);
}
return syncPerformed;
}
public void shutdown() throws IOException {
// TODO: move this onto the timer thread?
if (syncOnExit) sync();
syncTimer.cancel();
syncTimer.purge();
}
public String getName() { return name; }
public TimelineSource getSource() { return source; }

View File

@ -123,9 +123,6 @@ public class TimelineProperties {
timeline = timelineSource.read();
// 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()) {
if (!(keyObj instanceof String)) continue;
@ -138,6 +135,14 @@ public class TimelineProperties {
if (!m.matches()) continue;
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;
strURI = (String) config.getProperty(remoteBase + ".uri", "");