GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — :white_check_mark: Adding tests. · heangping/Java-Interview@89afa05

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/main/java/com/crossoverjie/guava
    • CacheLoaderTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/main/java/com/crossoverjie/guava/CacheLoaderTest.java‎

Copy file name to clipboardExpand all lines: src/main/java/com/crossoverjie/guava/CacheLoaderTest.java
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public class CacheLoaderTest {
3131
private void init() throws InterruptedException {
3232
loadingCache = CacheBuilder.newBuilder()
3333
.expireAfterWrite(2, TimeUnit.SECONDS)
34-
.maximumSize(3)
3534

3635
.build(new CacheLoader<Integer, AtomicLong>() {
3736
@Override
@@ -49,9 +48,9 @@ public AtomicLong load(Integer key) throws Exception {
4948
private void checkAlert(Integer integer) {
5049
try {
5150

52-
loadingCache.put(integer,new AtomicLong(integer));
51+
//loadingCache.put(integer,new AtomicLong(integer));
5352

54-
//TimeUnit.SECONDS.sleep(5);
53+
TimeUnit.SECONDS.sleep(5);
5554

5655

5756
LOGGER.info("当前缓存值={},缓存大小={}", loadingCache.get(KEY),loadingCache.size());
@@ -60,6 +59,8 @@ private void checkAlert(Integer integer) {
6059

6160
} catch (ExecutionException e ) {
6261
LOGGER.error("Exception", e);
62+
} catch (InterruptedException e) {
63+
e.printStackTrace();
6364
}
6465
}
6566
public static void main(String[] args) throws InterruptedException {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.