diff options
Diffstat (limited to 'java/demo/Ice/swing/Client.java')
-rw-r--r-- | java/demo/Ice/swing/Client.java | 78 |
1 files changed, 42 insertions, 36 deletions
diff --git a/java/demo/Ice/swing/Client.java b/java/demo/Ice/swing/Client.java index 0333548d285..be30eba5629 100644 --- a/java/demo/Ice/swing/Client.java +++ b/java/demo/Ice/swing/Client.java @@ -29,7 +29,7 @@ public class Client extends JFrame } catch(Ice.LocalException e) { - JOptionPane.showMessageDialog(null, e.toString(), "Initialization failed", + JOptionPane.showMessageDialog(null, e.toString(), "Initialization failed", JOptionPane.ERROR_MESSAGE); } } @@ -392,9 +392,24 @@ public class Client extends JFrame return Demo.HelloPrxHelper.uncheckedCast(prx); } - class SayHelloI extends Demo.AMI_Hello_sayHello implements Ice.AMISentCallback + class SayHelloI extends Demo.Callback_Hello_sayHello { - synchronized public void ice_exception(final Ice.LocalException ex) + @Override + synchronized public void response() + { + assert (!_response); + _response = true; + SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + _status.setText("Ready"); + } + }); + } + + @Override + synchronized public void exception(final Ice.LocalException ex) { assert (!_response); _response = true; @@ -408,7 +423,8 @@ public class Client extends JFrame }); } - synchronized public void ice_sent() + @Override + synchronized public void sent() { if(_response) { @@ -431,19 +447,6 @@ public class Client extends JFrame }); } - synchronized public void ice_response() - { - assert (!_response); - _response = true; - SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - _status.setText("Ready"); - } - }); - } - private boolean _response = false; } @@ -460,7 +463,8 @@ public class Client extends JFrame { if(!_deliveryMode.isBatch()) { - if(hello.sayHello_async(new SayHelloI(), delay)) + Ice.AsyncResult r = hello.begin_sayHello(delay, new SayHelloI()); + if(r.sentSynchronously()) { if(_deliveryMode == DeliveryMode.TWOWAY || _deliveryMode == DeliveryMode.TWOWAY_SECURE) { @@ -497,30 +501,32 @@ public class Client extends JFrame { if(!_deliveryMode.isBatch()) { - hello.shutdown_async(new Demo.AMI_Hello_shutdown() + hello.begin_shutdown(new Demo.Callback_Hello_shutdown() + { + @Override + public void response() { - public void ice_exception(final Ice.LocalException ex) + SwingUtilities.invokeLater(new Runnable() { - SwingUtilities.invokeLater(new Runnable() + public void run() { - public void run() - { - handleException(ex); - } - }); - } + _status.setText("Ready"); + } + }); + } - public void ice_response() + @Override + public void exception(final Ice.LocalException ex) + { + SwingUtilities.invokeLater(new Runnable() { - SwingUtilities.invokeLater(new Runnable() + public void run() { - public void run() - { - _status.setText("Ready"); - } - }); - } - }); + handleException(ex); + } + }); + } + }); if(_deliveryMode == DeliveryMode.TWOWAY || _deliveryMode == DeliveryMode.TWOWAY_SECURE) { _status.setText("Waiting for response"); |