Guest User

Untitled

a guest
Jan 17th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. @Singleton
  2. public class SystemDateProvider implements Provider<LocalDate> {
  3.  
  4.  private final Supplier<LocalDate> supplier =
  5.    Suppliers.memoizeWithExpiration(this::loadSystemDate, 1, MINUTES);
  6.  
  7.  private LocalDate loadSystemDate() {
  8.    // Load from database
  9.  }
  10.  
  11.  @Override
  12.  public LocalDate get() {
  13.    return supplier.get();
  14.  }
  15.  
  16. }
Add Comment
Please, Sign In to add comment