I have an application consisting of two processes, one client process with a SWT based GUI and one server. The client process is very easy, which means that many operations with the graphical interface will have to request the server process or request it for something, for example, in response to a user clicking a button or selecting a menu item. This means that there will be many event handlers that look like this:
void execute(Event event) {
server.execute(new RemoteRequest() {
public void run() {
final Result result = doSomeProcessing();
client.execute(new RemoteRequest() {
public void run() {
updateUi(result);
}
}
}
});
}
, server.execute ( ), ( RemoteRequest ( : , Request , ).
, (, ) , .
- , , .
, , . , Future , ( ), .
, : (, , , )
String personName = nameField.getText();
async exec on server {
String personAddress = database.find(personName);
async exec on client {
addressField.setText(personAddress);
}
Order[] orders = database.searchOrderHistory(personName);
async exec on client {
orderListViewer.setInput(orders);
}
}
, , , , . , , , , . , , ...