remove TagsToFile

Remove one layer of abstraction by moving the code into the DataStore.
This commit is contained in:
2019-02-16 16:06:46 +01:00
parent 117ef4ea34
commit 92a47d9b56
9 changed files with 181 additions and 285 deletions

View File

@@ -0,0 +1,18 @@
package org.lucares.utils;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
public class DateUtils {
public static OffsetDateTime getDate(final int year, final int month, final int day, final int hour,
final int minute, final int second) {
final OffsetDateTime result = OffsetDateTime.of(year, month, day, hour, minute, second, 0, ZoneOffset.UTC);
return result;
}
public static OffsetDateTime nowInUtc() {
return OffsetDateTime.now(ZoneOffset.UTC);
}
}

View File

@@ -77,11 +77,16 @@ public class HotEntryCache<K, V> {
* inserted
* @return the newly inserted or existing value, or null if
* {@code mappingFunction} returned {@code null}
* @throws ExecutionException
* @throws RuntimeExcecutionException re-throws any exception thrown during the
* execution of {@code supplier} wrapped in a
* {@link RuntimeExcecutionException}
*/
public V putIfAbsent(final K key, final Callable<V> mappingFunction) throws ExecutionException {
return cache.get(key, mappingFunction);
public V putIfAbsent(final K key, final Callable<V> supplier) {
try {
return cache.get(key, supplier);
} catch (final ExecutionException e) {
throw new RuntimeExcecutionException(e);
}
}
public void remove(final K key) {

View File

@@ -0,0 +1,13 @@
package org.lucares.utils.cache;
import java.util.concurrent.ExecutionException;
public class RuntimeExcecutionException extends RuntimeException {
private static final long serialVersionUID = -3626851728980513527L;
public RuntimeExcecutionException(final ExecutionException e) {
super(e);
}
}