@@ -144,14 +144,14 @@ public void asyncInvoke(Row input, ResultFuture<Row> resultFuture) throws Except
144144 List <String > value = async .keys (key + ":*" ).get ();
145145 String [] values = value .toArray (new String [value .size ()]);
146146 RedisFuture <List <KeyValue <String , String >>> future = async .mget (values );
147- while ( future .isDone ()) {
148- try {
149- List <KeyValue <String , String >> kvList = future . get ();
150- if (kvList .size () != 0 ){
151- for (int i =0 ; i <kvList .size (); i ++){
152- String [] splitKeys = kvList .get (i ).getKey ().split (":" );
147+ future .thenAccept ( new Consumer < List < KeyValue < String , String >>>() {
148+ @ Override
149+ public void accept ( List <KeyValue <String , String >> keyValues ) {
150+ if (keyValues .size () != 0 ){
151+ for (int i =0 ; i <keyValues .size (); i ++){
152+ String [] splitKeys = keyValues .get (i ).getKey ().split (":" );
153153 keyValue .put (splitKeys [1 ], splitKeys [2 ]);
154- keyValue .put (splitKeys [3 ], kvList .get (i ).getValue ());
154+ keyValue .put (splitKeys [3 ], keyValues .get (i ).getValue ());
155155 }
156156 Row row = fillData (input , keyValue );
157157 resultFuture .complete (Collections .singleton (row ));
@@ -164,13 +164,8 @@ public void asyncInvoke(Row input, ResultFuture<Row> resultFuture) throws Except
164164 putCache (key , CacheMissVal .getMissKeyObj ());
165165 }
166166 }
167- } catch (InterruptedException e1 ) {
168- e1 .printStackTrace ();
169- } catch (ExecutionException e1 ) {
170- e1 .printStackTrace ();
171167 }
172- }
173-
168+ });
174169 }
175170
176171 private String buildCacheKey (List <String > keyData ) {
0 commit comments