?????????????????????????????????????????????
???????????

public interface CallBack {
/**
* ??л??????
* @param objects   ?????????????????????????????
*/
public void execute(Object... objects );
}
???????????
/**
* ??????????????
*/
public class Local implements CallBack??Runnable{
private Remote remote;
/**
* ???????????
*/
private String message;
public Local(Remote remote?? String message) {
super();
this.remote = remote;
this.message = message;
}
/**
* ???????
*/
public void sendMessage()
{
/**???????????**/
System.out.println(Thread.currentThread().getName());
/**????????μ??????????**/
Thread thread = new Thread(this);
thread.start();
/**????????????**/
System.out.println("Message has been sent by Local~!");
}
/**
* ????????????????
*/
public void execute(Object... objects ) {
/**???????????**/
System.out.println(objects[0]);
/**???????????????????**/
System.out.println(Thread.currentThread().getName());
/**?ж????????????**/
Thread.interrupted();
}
public static void main(String[] args)
{
Local local = new Local(new Remote()??"Hello");
local.sendMessage();
}
public void run() {
remote.executeMessage(message?? this);  //???????????綽??????綽??????????????????????????????????????????綽??????????????????
}
}
???????????????
/**
* ??????????????
*/
public class Remote {
/**
* ???????
* @param msg   ????????
* @param callBack  ?????????????
*/
public void executeMessage(String msg??CallBack callBack)
{
/**??????????????????????飬?????????????????**/
for(int i=0;i<1000000000;i++)
{
}
/**?????????????飬?????????????**/
System.out.println(msg);
System.out.println("I hava executed the message by Local");
/**??л??**/
callBack.execute(new String[]{"Nice to meet you~!"});  //?????????????????綽????
}
}
???????????????????????????????????????????????????á?