abstractgitthread.java

来自「java 调用windows的api」· Java 代码 · 共 43 行

JAVA
43
字号
/*
 * AbstractGITThread.java -
 *
 * This file is part of the Jawin Project: http://jawinproject.sourceforge.net/
 * 
 * Please consult the LICENSE file in the project root directory,
 * or at the project site before using this software.
 */

/* $Id: AbstractGITThread.java,v 1.1 2004/07/18 15:12:35 arosii_moa Exp $ */

package org.jawin;

/**
 * Abstract helper thread for creating, GIT-wrapping and closing a COM reference
 * on a seperate thread.
 *
 * @version     $Revision: 1.1 $
 * @author      Morten Andersen, arosii_moa (at) users.sourceforge.net
 */
public abstract class AbstractGITThread extends Thread {

	protected abstract void createReference() throws COMException;
	
	protected abstract void closeReference() throws COMException;
	
	public void run() {
		try {
			createReference();
			try {
				synchronized(this) {
					wait();
				}
			} catch (InterruptedException e) {
				throw new COMError("Unable to wait - " + e.toString());
			}
			closeReference();
		} catch (COMException e) {
			throw new COMError(e.hresult, e.toString());
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?