2017年2月28日星期二

scala convert int to long

参考http://stackoverflow.com/questions/19647525/how-to-convert-any-a-number-to-a-long

val number:AnyVal = 10
val l:Long = number.asInstanceOf[Number].longValue

直接用asInstanceOf[Long]会报错。

2017年2月27日星期一

spring boot data jpa: operations allowed after connection closed连接异常

参考http://www.jianshu.com/p/1626d41572f2

#以下为连接池的相关参数配置
spring.datasource.primary.max-idle=10
spring.datasource.primary.max-wait=10000
spring.datasource.primary.min-idle=5
spring.datasource.primary.initial-size=5
spring.datasource.primary.validation-query=SELECT 1
spring.datasource.primary.test-on-borrow=false
spring.datasource.primary.test-while-idle=true
spring.datasource.primary.time-between-eviction-runs-millis=18800

2017年2月26日星期日

spring boot打包错误Unable to find a single main class from the following candidates

因为spring发现了多个类似@SpringBootApplication的入口类,解决方法:
在pom.xml的<properties></properties>中增加:
<start-class>your/main/class</start-class>

参考:http://www.jianshu.com/p/b521f819b06a

2017年2月25日星期六

gitlab-ctl restart或stop时候postgresql timeout问题

ps -ef | grep postgresql
杀掉 runsv postgresql 这个进程和相关的其他进程

gitlab-ctl reconfigure

gitlab check检查

参考了http://g23988.blogspot.hk/2015/07/gitlabtimeout-down-postgresql-0s.html

gitlab-rake gitlab:check

可以根据该命令的输出按照说明fix一些问题。