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服务器.计时器等可以实 ...
随机推荐
- Spring AOP(5)-- 注解
applicationContext.xml <?xml version="1.0" encoding="UTF-8"?><beans xml ...
- oracle between、 all、 in 和 exists的区别,模糊查询、4个正则表达式
--条件比较 /* =,!=,<>,<,>,<=,>=, any,some,all is null,is not null between x and y in(l ...
- SpringCloud之eureka服务注册和服务发现
服务注册中心 :eureka-server 作用:服务注册中心提供服务注册功能 服务提供方:eureka-client 作用:注册服务到服务注册中心 服务注册中心 :eureka-server 创建 ...
- Ubuntu 16 下面的文件比较工具 Meld
安装 sudo apt-get install meld 使用 很好用,很方便.支持文件比较,文件夹比较.
- ZC_异常
1. “Exception in thread "main" java.lang.UnsatisfiedLinkError: no JniVC6 in java.library.p ...
- PHP服务器变量$_SERVER
常用的就几个,自己print_r($_SERVER); 看看. $_SERVER['PHP_SELF'] #当前正在执行脚本的文件名,与 document root相关. $_SERVER['argv ...
- 【C#基本功】1》panel的C#用法 panel
上面截图是panel在labview中的用法,在labview中panel加动态调用技术可以解决很多难题. 对于刚刚接触C#的我来说,如何实现pannel动态加载界面,也是一个必须首要克服的难点. 经 ...
- java开发工具idea,在install时候报错The packaging for this project did not assign a file to the build artifact
intellij中install报错:The packaging for this project did not assign a file to the build artifact 原因是run ...
- 009——VUE中watch监听属性变化实现类百度搜索栏功能
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- react antd form多组表单数据处理
import React from 'react'; import {Form, InputNumber, Input, DatePicker, Button, Select, Icon} from ...