Skip to content

Commit

Permalink
Log first message timestamp at startup
Browse files Browse the repository at this point in the history
This gives an idea when reading the logs about the state of the loaded
data at startup.
  • Loading branch information
johnmartel committed Aug 28, 2017
1 parent fe1052f commit e347410
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
50 changes: 50 additions & 0 deletions coverage-sample.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<!-- Reads AIS messages from two different sources. Connecting via TCP. Coverage
data is saved memory only (the default). -->
<aisCoverageConfiguration>
<aisbus>
<transformer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="sourceTypeSatTransformerConfiguration">
<gh_region>802</gh_region>
<gh_region>804</gh_region>
<gh_region>810</gh_region>
<source>CanAISShore</source>
</transformer>
<provider xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="tcpClientProviderConfiguration">
<hostPort>205.193.156.26:9001</hostPort>
</provider>

<consumer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="distributerConsumerConfiguration">
<name>UNFILTERED</name>
</consumer>

<busQueueSize>10000</busQueueSize>
</aisbus>

<!--Sets the grid granularity; the latitude and longitude minimum degree -->
<latSize>0.0225225225</latSize>
<lonSize>0.0386812541</lonSize>

<databaseConfiguration>
<type>MongoDB</type>
<addr>localhost</addr>
<dbName>classB</dbName>
<port>27017</port>
<persistenceIntervalInMinutes>60</persistenceIntervalInMinutes>
</databaseConfiguration>

<!--<databaseConfiguration>-->
<!--<type>MemoryOnly</type>-->
<!--</databaseConfiguration>-->

<!-- Access the frontend via http://localhost:8090/coverage -->
<serverConfiguration>
<port>8090</port>
<webappPath>web</webappPath>
<contextPath>/coverage</contextPath>
</serverConfiguration>
<windowSize>1</windowSize>
</aisCoverageConfiguration>
5 changes: 5 additions & 0 deletions src/main/java/dk/dma/ais/coverage/AisCoverage.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
import dk.dma.ais.coverage.web.WebServer;
import dk.dma.ais.packet.AisPacket;
import dk.dma.ais.reader.AisReader;
import dk.dma.commons.util.DateTimeUtil;
import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;
import org.apache.commons.collections4.IterableUtils;
import org.joda.time.PeriodType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -106,6 +108,9 @@ private void loadCoverageDataFromDatabase() {
}
Instant end = Instant.now();
LOG.info("Loading coverage data and converting to memory structure took [{}] ms", Duration.between(start, end).toMillis());
if (Helper.firstMessage != null) {
LOG.info("First message timestamp: {}. Window size should be: {}", Helper.firstMessage, DateTimeUtil.toInterval(Helper.firstMessage, new Date()).toPeriod(PeriodType.hours()).getHours());
}
}

private void adjustSystemEarliestMessageFromCell(Cell cell) {
Expand Down

0 comments on commit e347410

Please sign in to comment.