Skip to content

Commit

Permalink
fix cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Ansj committed Jun 7, 2018
1 parent 1082d75 commit 4378e73
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions src/main/java/org/nlpcn/jcoder/run/mvc/cache/CacheEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,13 @@ public Object load(Args args) {
} else {
cache = CacheBuilder.newBuilder().maximumSize(this.size).refreshAfterWrite(time, TimeUnit.SECONDS).build(new CacheLoader<Args, Object>() {

private ListeningExecutorService executorService = MoreExecutors.listeningDecorator(Executors.newCachedThreadPool());

public Object load(Args args) {
return executeNoCache(args);
}

@Override
public ListenableFuture<Object> reload(final Args args, Object oldValue) {
ListenableFuture<Object> result = ListenableFutureTask.create(new Callable<Object>() {
public Object call() {
return executeNoCache(args);
}
});

result = executorService.submit(new Callable<Object>() {
@Override
public Object call() {
return executeNoCache(args);
}
});
return result;
return ListenableFutureTask.create(() -> executeNoCache(args));
}

});
Expand Down

0 comments on commit 4378e73

Please sign in to comment.