remove TagsToFile
Remove one layer of abstraction by moving the code into the DataStore.
This commit is contained in:
18
pdb-utils/src/main/java/org/lucares/utils/DateUtils.java
Normal file
18
pdb-utils/src/main/java/org/lucares/utils/DateUtils.java
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
13
pdb-utils/src/main/java/org/lucares/utils/cache/RuntimeExcecutionException.java
vendored
Normal file
13
pdb-utils/src/main/java/org/lucares/utils/cache/RuntimeExcecutionException.java
vendored
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user