dispatchgittest.java

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

JAVA
52
字号
/*
 * DispatchGITTest.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: DispatchGITTest.java,v 1.2 2004/07/18 15:12:35 arosii_moa Exp $ */

package org.jawin;

import org.jawin.win32.COINIT;

/**
 * Dispatch GIT test.
 *
 * @version     $Revision: 1.2 $
 * @author      Stuart Halloway, http://www.relevancellc.com/halloway/weblog/
 */
public class DispatchGITTest extends DispatchTestBase {
	
	private IDualTestGITThread constructorThread;
	
	protected IDualTestItf initDisp() throws COMException {
		// create the direct reference in another thread
		constructorThread = new IDualTestGITThread();		
		constructorThread.start();
		while (constructorThread.getGitDisp() == null) {
			try {
				Thread.sleep(10); // wait for the other thread to create the references before returning it - 
									// very primitive "sync" mechanism
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}

		return constructorThread.getGitDisp();
	}

	protected void closeDisp(IDualTestItf itf) throws COMException {
		synchronized(constructorThread) {
			constructorThread.notify();
		}
	}
	
	protected COINIT getThreadModel() {
		return COINIT.MULTITHREADED;
	}
}

⌨️ 快捷键说明

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