私有构造函数捕获模式

《Java并发编程实践》的注解中有提到这一概念。 The private constructor exists to avoid the race condition that would occur if the copy constructor were implemented as this (p.x, p.y); this is an example of the private constructor capture idiom (Bloch and Gafter, 2005). 结合原文代码: @ThreadSafe public class

从零开始用docker运行spring boot应用

假设已经安装好Docker Springboot应用 pom添加依赖和构建插件 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.3.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> 应用代码 package com.atbug.spring.boot.test; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean;

GreenPlum JDBC和C3P0数据源

在网上搜索GreenPlum(GPDB)的数据源配置的时候,发现搜索结果都是用postgresql的配置。 import com.mchange.v2.c3p0.DataSources; import javax.sql.DataSource; import java.sql.*; import java.util.Properties; /** * Created by addo on 2017/4/10. */ public

Scala笔记:def VS val

先说原理: val修饰的在定义的时候执行 def修饰的在调用的时候执行 直观的例子: //注释的行为REPL输出 def test: () => Int = { println("def called") val r = util.Random.nextInt () => r } //test: