Fix some TODOs

This commit is contained in:
Dave Syer
2014-01-19 16:00:10 +00:00
parent 07da034571
commit 8db1d0e044
7 changed files with 40 additions and 11 deletions

View File

@@ -126,7 +126,13 @@ public class ErrorMvcAutoConfiguration implements EmbeddedServletContainerCustom
.noMatch("Thymeleaf template found for error view");
}
}
// FIXME: add matcher for JSP view if Jasper detected
if (ClassUtils.isPresent("org.apache.jasper.compiler.JspConfig",
context.getClassLoader())) {
if (WebMvcAutoConfiguration.templateExists(context.getEnvironment(),
context.getResourceLoader(), "error")) {
return ConditionOutcome.noMatch("JSP template found for error view");
}
}
return ConditionOutcome.match("no error template view detected");
};
}

View File

@@ -17,6 +17,7 @@
package org.springframework.boot.actuate.metrics.repository.redis;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -129,13 +130,15 @@ public class RedisMetricRepository implements MetricRepository {
}
}
// TODO: memorize timestamps as well?
private Metric<?> deserialize(String redisKey, String v) {
return new Metric<Double>(nameFor(redisKey), Double.valueOf(v));
String[] vals = v.split("@");
Double value = Double.valueOf(vals[0]);
Date timestamp = vals.length > 1 ? new Date(Long.valueOf(vals[1])) : new Date();
return new Metric<Double>(nameFor(redisKey), value, timestamp);
}
private String serialize(Metric<?> entity) {
return String.valueOf(entity.getValue());
return String.valueOf(entity.getValue()) + "@" + entity.getTimestamp().getTime();
}
private String keyFor(String name) {

View File

@@ -18,6 +18,7 @@ package org.springframework.boot.actuate.metrics.repository.redis;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -127,11 +128,14 @@ public class RedisMultiMetricRepository implements MultiMetricRepository {
}
private Metric<?> deserialize(String redisKey, String v) {
return new Metric<Double>(nameFor(redisKey), Double.valueOf(v));
String[] vals = v.split("@");
Double value = Double.valueOf(vals[0]);
Date timestamp = vals.length > 1 ? new Date(Long.valueOf(vals[1])) : new Date();
return new Metric<Double>(nameFor(redisKey), value, timestamp);
}
private String serialize(Metric<?> entity) {
return String.valueOf(entity.getValue());
return String.valueOf(entity.getValue() + "@" + entity.getTimestamp().getTime());
}
private String keyFor(String name) {