Skip to content

Commit 60b5108

Browse files
committed
1 parent 309a00e commit 60b5108

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

‎pom.xml‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<dependency>
7474
<groupId>com.sun.xml.bind</groupId>
7575
<artifactId>jaxb-core</artifactId>
76-
<version>2.2.11</version>
76+
<version>4.0.1</version>
7777
</dependency>
7878
<dependency>
7979
<groupId>com.sun.xml.bind</groupId>
@@ -195,16 +195,17 @@
195195
<reporting>
196196
<plugins>
197197
<plugin>
198+
<groupId>org.apache.maven.plugins</groupId>
198199
<artifactId>maven-project-info-reports-plugin</artifactId>
199-
<version>2.8.1</version>
200+
<version>3.0.0</version>
200201
<configuration>
201-
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
202202
<dependencyDetailsEnabled>false</dependencyDetailsEnabled>
203203
</configuration>
204204
</plugin>
205205
<plugin>
206+
<groupId>org.apache.maven.plugins</groupId>
206207
<artifactId>maven-javadoc-plugin</artifactId>
207-
<version>2.10.3</version>
208+
<version>3.4.1</version>
208209
</plugin>
209210
</plugins>
210211
</reporting>

‎src/main/java/com/redislabs/university/RU102J/dao/SiteStatsDaoRedisImpl.java‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,20 @@ private void updateBasic(Jedis jedis, String key, MeterReading reading) {
8181
// Challenge #3
8282
private void updateOptimized(Jedis jedis, String key, MeterReading reading) {
8383
// START Challenge #3
84+
try (Transaction t = jedis.multi()) {
85+
String reportingTime = ZonedDateTime.now(ZoneOffset.UTC).toString();
86+
t.hset(key, SiteStats.reportingTimeField, reportingTime);
87+
t.hincrBy(key, SiteStats.countField, 1);
88+
t.expire(key, weekSeconds);
89+
this.compareAndUpdateScript.updateIfGreater(t, key, SiteStats.maxWhField,
90+
reading.getWhGenerated());
91+
this.compareAndUpdateScript.updateIfLess(t, key, SiteStats.minWhField,
92+
reading.getWhGenerated());
93+
this.compareAndUpdateScript.updateIfGreater(t, key, SiteStats.maxCapacityField,
94+
getCurrentCapacity(reading));
95+
96+
t.exec();
97+
}
8498
// END Challenge #3
8599
}
86100

0 commit comments

Comments
 (0)