📄 entry.java
字号:
/*
@author j.n.magee 20/11/96
*/
package concurrency.message;
import java.awt.*;
import java.util.*;
import java.applet.*;
/* ********************Entry**************************** */
// The definition of entry assumes that there can be many clients
// but only one server
class Entry extends Port {
private CallMsg cm;
public Object call(Object req) throws InterruptedException {
Channel clientChan = new Channel();
send(new CallMsg(req,clientChan));
return clientChan.receive();
}
public Object accept() throws InterruptedException {
cm = (CallMsg) receive();
return cm.request;
}
public void reply(Object res) throws InterruptedException {
cm.replychan.send(res);
}
private class CallMsg {
Object request;
Channel replychan;
CallMsg(Object m, Channel c)
{request=m; replychan=c;}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -