Permalink
Browse files

adding logging per-100 pa broadcasts processed

  • Loading branch information...
1 parent b29929d commit 41a1c6c57892feab3a7ea93a98e003a32296ae8e Ben Smith committed Feb 23, 2011
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/main/java/org/atlasapi/remotesite/pa/PaBaseProgrammeUpdater.java
@@ -3,6 +3,7 @@
import java.io.File;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -69,11 +70,13 @@ protected void processFiles(Iterable<File> files) {
for (File file : files) {
try {
- String filename = file.toURI().toString();
+ final String filename = file.toURI().toString();
Matcher matcher = FILEDATE.matcher(filename);
+
if (matcher.matches()) {
final DateTimeZone zone = getTimeZone(matcher.group(1));
log.record(new AdapterLogEntry(Severity.INFO).withSource(PaBaseProgrammeUpdater.class).withDescription("Processing file "+filename+" with timezone "+zone.toString()));
+ final AtomicInteger recordsProcessed = new AtomicInteger();
unmarshaller.setListener(new Unmarshaller.Listener() {
public void beforeUnmarshal(Object target, Object parent) {
@@ -86,7 +89,12 @@ public void afterUnmarshal(Object target, Object parent) {
} catch (InterruptedException e) {
log.record(new AdapterLogEntry(Severity.ERROR).withCause(e).withSource(PaBaseProgrammeUpdater.class));
}
- new ProcessProgrammeJob((ProgData) target, (ChannelData) parent, zone).run();
+ //new ProcessProgrammeJob((ProgData) target, (ChannelData) parent, zone).run();
+ int processed = recordsProcessed.incrementAndGet();
+
+ if (processed % 100 == 0) {
+ log.record(new AdapterLogEntry(Severity.INFO).withSource(PaBaseProgrammeUpdater.class).withDescription("Processed "+processed+" programmes from "+filename));
+ }
}
}
});

0 comments on commit 41a1c6c

Please sign in to comment.