<repo_name>hjl12/DDup<file_sep>/src/cn/mumu/architecture/model/future/success/MyFutureData.java
package cn.mumu.architecture.model.future.success;

import java.util.concurrent.locks.LockSupport;

public class MyFutureData implements MyData {

	private MyRealData realData;

	private boolean isRealData = false;

//	@Override
//	public synchronized int getResult() {
//		if (!isRealData) {
//			try {
//				System.out.println("线程还没有计算好,wait()");
//				wait();
//			} catch (InterruptedException e) {
//				// TODO Auto-generated catch block
//				e.printStackTrace();
//			}
//		}
//		return realData.getResult();
//	}
//
//	public synchronized void setRequest(MyRealData my) {
//		if (!isRealData) {
//			System.out.println("计算完成设置realdata到futuredata");
//			this.realData = my;
//			isRealData = true;
//			notifyAll();
//		} else {
//			return;
//		}
//
//	}
	
	
	@Override
	public  int getResult() {
		if (!isRealData) {
				System.out.println("线程还没有计算好,wait()");
		}
		LockSupport.park();
		return realData.getResult();
	}
	
	public  void setRequest(MyRealData my,Thread t ) {
		if (!isRealData) {
			System.out.println("计算完成设置realdata到futuredata");
			this.realData = my;
			isRealData = true;
			LockSupport.unpark(t);
		} else {
			return;
		}
	}

}
<file_sep>/src/cn/mumu/architecture/model/future/UserF.java
package cn.mumu.architecture.model.future;

public class UserF {
	
	private String name;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		return "UserF [name=" + name + "]";
	}
	
	

}
<file_sep>/src/cn/mumu/architecture/model/MumuTest.java
package cn.mumu.architecture.model;

import cn.mumu.architecture.model.singleton.InnerClassSingleton;

public class MumuTest {
	
	
	public static void main(String[] args) {
		InnerClassSingleton instance = InnerClassSingleton.getInstance();
		System.out.println(instance.hashCode());
	}

}
