Skip to content

Instantly share code, notes, and snippets.

@seveniu
seveniu / MongoDB.dockerfile
Created August 4, 2016 11:47
MongoDB Dockerfile
#
# MongoDB Dockerfile
#
# https://github.com/dockerfile/mongodb
#
# Pull base image.
FROM ubuntu:14.04
# Install MongoDB.
@seveniu
seveniu / GuavaCacheTest.java
Last active August 23, 2018 05:58
guava cache test refresh
public static void testRefresh() throws ExecutionException, InterruptedException {
LogTime logTime = new LogTime();
AtomicInteger value = new AtomicInteger();
LoadingCache<String, String> cb = CacheBuilder.newBuilder()
.maximumSize(1000)
.refreshAfterWrite(6, TimeUnit.SECONDS)
.removalListener((RemovalListener<String, String>) notification -> {
logTime.log("remove key : " + notification.getKey() + ", value : " + notification.getValue() + ", cause " + notification.getCause());
})
.build(new CacheLoader<String, String>() {
@seveniu
seveniu / BoundedExecutor.java
Created January 15, 2018 12:47
java BoundedExecutor
package com.lavector.concurrency;
import java.util.concurrent.*;
/**
* @author seveniu
* @date 2017-01-09
* @Description
*/
public class BoundedExecutor {