AbstractIdleService
该类有一个startup和shutdown方法,启动此服务或者结束此服务的时候可以调用。
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
if (gameServer.isRunning()) {
gameServer.stopAsync();
gameServer.awaitTerminated();
}
}
});
AbstractIdleService的更多相关文章
- Guava文档翻译之 Service
概览 Guava的接口代表了一个有运行状态的对象,有启动和停止的方法.比如网络服务器,RPC服务器,以及计时器等,都可以实现Service接口.掌管像这样的服务的状态,需要正确地管理启动和关闭,因此会 ...
- Goolge-Guava Concurrent中的Service
最近在学习了下Google的Guava包,发现这真是一个好东西啊..由于平时也会写一些基于多线程的东西,所以特意了解了下这个Service框架.这里Guava包里的Service接口用于封装一个服务对 ...
- dubbo学习之Hello world
现在企业中使用dubbo的越来越多,今天就简单的学习一下dubbo,写了一个hello world,教程仅供入门,如要深入学习请上官网 服务提供方: 首先将提供方和消费方都引入jar包,如果使用的是m ...
- 关于Eclipse导入maven项目报空指针异常
今天新建了一个maven项目,因为是通过公司的工具新建的,代码拉下来就有src.pom.xml文件. 导入Eclipse却报空指针异常.具体如下: An error has occurred. See ...
- Google-Guava Concurrent包里的Service框架浅析
原文地址 译文地址 译者:何一昕 校对:方腾飞 概述 Guava包里的Service接口用于封装一个服务对象的运行状态.包括start和stop等方法.例如web服务器,RPC服务器.计时器等可以实 ...
随机推荐
- Valid Number,判断是否为合法数字
问题描述: Validate if a given string is numeric. Some examples:"0" => true" 0.1 " ...
- cn_03_r2_enterprise_sp2_x86_vl_X13_46432
1. 使用的 ISO为:cn_win_srv_2003_r2_enterprise_with_sp2_vl_cd1_X13-46432.iso 2.序列号 用的序列号是“DF74D-TWR86-D3F ...
- scala学习手记17 - 容器和类型推断
关于scala的类型推断前面已经提到过多次.再来看一下下面这个例子: import java.util._ var list1: List[Int] = new ArrayList[Int] var ...
- Linux文件的默认权限:umask
1. 文件的默认权限 Linux下当我们新建一个文件和目录时,该文件和目录的默认权限是什么? 通过umask命令来查看: $ umask0002 $ umask -Su=rwx,g=rwx,o=rx ...
- sql语言分类与整理:DQL\DML\DDL
整体分为三类: 数据库查询语言(DQL,data QUERY LANGUAGE):对表的查询语句,select 数据库定义语言(DDL,data defined LANGUAGE):create da ...
- 使用PorterDuffXfermode画出刮刮奖效果p146-p148
package com.zzw.Qunyinzghuan3; import android.content.Context; import android.graphics.Bitmap; impor ...
- LeetCode OJ:Combination Sum (组合之和)
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C wher ...
- 【机器学习基石笔记】七、vc Dimension
vc demension定义: breakPoint - 1 N > vc dimension, 任意的N个,就不能任意划分 N <= vc dimension,存在N个,可以任意划分 只 ...
- python 魔法方法补充(__setattr__,__getattr__,__getattribute__)
python 魔法方法补充 1 getattribute (print(ob.name) -- obj.func())当访问对象的属性或者是方法的时候触发 class F(object): def _ ...
- Https与SSL介绍
参考资料: http://www.ruanyifeng.com/blog/2014/02/ssl_tls.html http://www.ruanyifeng.com/blog/2014/09/ill ...