📄 serversideproxy.java
字号:
package designPatterns.Proxy;import java.util.Iterator;import java.util.LinkedList;import javax.realtime.LTMemory;import designPatterns.Data;public class ServerSideProxy extends Proxy { public ServerSideProxy(Data data) { super(data); sNotify = new ScopedNotify(clientsList, this.data); } // Logic of notify method encapsulated into a scoped class ScopedNotify sNotify; private LTMemory mem = new LTMemory(1024*16); static class ScopedNotify implements Runnable { private LinkedList clients; private Data data; public ScopedNotify(LinkedList clients, Data data) { this.clients = clients; this.data = data; } public void run() { Iterator i = clients.iterator(); while (i.hasNext()) { ClientSideProxy cl = (ClientSideProxy)i.next(); cl.getCommBus().enqueue(data); } } } protected void notifyClients() { mem.enter(sNotify); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -