src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/common/SSLFlowDelegate.java
branchhttp-client-branch
changeset 56044 a8423a38386e
parent 56035 2f3f5da13c4c
equal deleted inserted replaced
56043:08e8e41841cf 56044:a8423a38386e
   576                 }
   576                 }
   577                 if (writeList.isEmpty() && needWrap()) {
   577                 if (writeList.isEmpty() && needWrap()) {
   578                     writer.addData(HS_TRIGGER);
   578                     writer.addData(HS_TRIGGER);
   579                 }
   579                 }
   580             } catch (Throwable ex) {
   580             } catch (Throwable ex) {
       
   581                 errorCommon(ex);
   581                 handleError(ex);
   582                 handleError(ex);
   582             }
   583             }
   583         }
   584         }
   584 
   585 
   585         private boolean needWrap() {
   586         private boolean needWrap() {
   705         return l;
   706         return l;
   706     }
   707     }
   707 
   708 
   708     private void executeTasks(List<Runnable> tasks) {
   709     private void executeTasks(List<Runnable> tasks) {
   709         exec.execute(() -> {
   710         exec.execute(() -> {
   710             handshakeState.getAndUpdate((current) -> current | DOING_TASKS);
   711             try {
   711             List<Runnable> nextTasks = tasks;
   712                 handshakeState.getAndUpdate((current) -> current | DOING_TASKS);
   712             do {
   713                 List<Runnable> nextTasks = tasks;
   713                 try {
   714                 do {
   714                     nextTasks.forEach((r) -> {
   715                     nextTasks.forEach(Runnable::run);
   715                         r.run();
       
   716                     });
       
   717                     if (engine.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
   716                     if (engine.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
   718                         nextTasks = obtainTasks();
   717                         nextTasks = obtainTasks();
   719                     } else break;
   718                     } else {
   720                 } catch (Throwable t) {
   719                         break;
   721                     handleError(t);
   720                     }
   722                 }
   721                 } while (true);
   723             } while(true);
   722                 handshakeState.getAndUpdate((current) -> current & ~DOING_TASKS);
   724             handshakeState.getAndUpdate((current) -> current & ~DOING_TASKS);
   723                 writer.addData(HS_TRIGGER);
   725             writer.addData(HS_TRIGGER);
   724                 resumeActivity();
   726             resumeActivity();
   725             } catch (Throwable t) {
       
   726                 handleError(t);
       
   727             }
   727         });
   728         });
   728     }
   729     }
   729 
   730 
   730 
   731 
   731     EngineResult unwrapBuffer(ByteBuffer src) throws IOException {
   732     EngineResult unwrapBuffer(ByteBuffer src) throws IOException {