File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
src/main/java/com/openfin/desktop/demo Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 11package com .openfin .desktop .demo ;
22
33import java .util .Objects ;
4+ import java .util .concurrent .ExecutionException ;
5+ import java .util .concurrent .TimeUnit ;
6+ import java .util .concurrent .TimeoutException ;
47import java .util .concurrent .atomic .AtomicInteger ;
58import java .util .concurrent .locks .LockSupport ;
69
@@ -58,13 +61,12 @@ private void createChannelClient( ) {
5861 logger .info ("client got value \" {}\" from provider after invoking incrementBy" , ((JsonNumber )v2 ).intValue ());
5962 });
6063 }).thenAccept (v ->{
61- client .dispatch ("quitProvider" ); //probably won't get response
6264 try {
63- Thread .sleep (500 );
64- }
65- catch (InterruptedException e ) {
66- e .printStackTrace ();
65+ client .dispatch ("quitProvider" ).toCompletableFuture ().get (500 , TimeUnit .MILLISECONDS );
6766 }
67+ catch (InterruptedException | ExecutionException | TimeoutException e ) {
68+ //probably won't get response and don't care.
69+ }
6870 fin .disconnect ();
6971 });
7072 });
You can’t perform that action at this time.
0 commit comments