dxasyncclient.java
来自「用Java写的面相对象的数据库管理系统」· Java 代码 · 共 71 行
JAVA
71 行
// You can redistribute this software and/or modify it under the terms of// the Ozone Library License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-2000 by SMB GmbH. All rights reserved.//// $Id: DxAsyncClient.java,v 1.5 2000/10/28 16:55:15 daniela Exp $package org.ozoneDB.DxLib.net;import org.ozoneDB.DxLib.*;import java.io.*;import java.net.*;public abstract class DxAsyncClient extends DxClient implements Runnable { boolean cont; Thread _thread; private void init( boolean externalThread ) { cont = true; if (!externalThread) { _thread = new Thread( this ); _thread.setPriority( Thread.NORM_PRIORITY ); _thread.setDaemon( true ); _thread.start(); } } public DxAsyncClient( String host, int port, boolean externalThread ) throws IOException{ super( host, port ); init( externalThread ); } public DxAsyncClient( Socket s, boolean externalThread ) throws IOException{ super( s ); init( externalThread ); } public Thread thread() { return _thread; } public void run() { try { while (cont) { handleEvent( receive() ); } } catch (Exception e) { System.out.println( "DxAsyncClient: " + e ); } } public synchronized void close() throws IOException { cont = false; if (_thread != null) { _thread.stop(); } super.close(); } public abstract void handleEvent( Object event );}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?