| | |
| | |
|
| | | protected abstract void doStart();
|
| | | protected abstract void initConnect();
|
| | | protected abstract void disconnect();
|
| | |
|
| | |
|
| | | @Override
|
| | |
| | | sleep(5L * SLEEP_TIME_MILLI_SECONDS);
|
| | | initConnect();
|
| | | while (isRunning() && !Thread.currentThread().isInterrupted()) doStart();
|
| | | disconnect(); // 线程被终止或者容器已经停止
|
| | | }).start();
|
| | | setRunning(true);
|
| | | }
|
| | |
| | |
|
| | | }
|
| | |
|
| | | public void disconnect(){
|
| | | // 关闭连接
|
| | | connector.disconnect();
|
| | | }
|
| | |
|
| | |
|
| | | public void doStart() {
|
| | | Message message = null;
|
| | |
| | | "thread interrupt , current connector host: {} , port: {} ",
|
| | | endpointInstance.getHost(), endpointInstance.getPort());
|
| | | Thread.currentThread().interrupt();
|
| | | connector.disconnect();
|
| | | disconnect();
|
| | | } else {
|
| | | sleep(endpointInstance.getAcquireInterval());
|
| | | }
|