< prev index next >

src/java.base/share/classes/sun/security/ssl/TransportContext.java

Print this page

620             inputRecord.tc = this;
621             cipherSuite = handshakeContext.negotiatedCipherSuite;
622             inputRecord.readCipher.baseSecret =
623                     handshakeContext.baseReadSecret;
624             outputRecord.writeCipher.baseSecret =
625                     handshakeContext.baseWriteSecret;
626         }
627 
628         handshakeContext = null;
629         outputRecord.handshakeHash.finish();
630         inputRecord.finishHandshake();
631         outputRecord.finishHandshake();
632         isNegotiated = true;
633 
634         // Tell folk about handshake completion, but do it in a separate thread.
635         if (transport instanceof SSLSocket &&
636                 sslConfig.handshakeListeners != null &&
637                 !sslConfig.handshakeListeners.isEmpty()) {
638             HandshakeCompletedEvent hce =
639                 new HandshakeCompletedEvent((SSLSocket)transport, conSession);
640             Thread thread = new Thread(
641                 null,
642                 new NotifyHandshake(sslConfig.handshakeListeners, hce),
643                 "HandshakeCompletedNotify-Thread",
644                 0,
645                 false);
646             thread.start();
647         }
648 
649         return HandshakeStatus.FINISHED;
650     }
651 
652     HandshakeStatus finishPostHandshake() {
653         handshakeContext = null;
654 
655         // Note: May need trigger handshake completion even for post-handshake
656         // authentication in the future.
657 
658         return HandshakeStatus.FINISHED;
659     }
660 
661     // A separate thread is allocated to deliver handshake completion
662     // events.
663     private static class NotifyHandshake implements Runnable {
664         @SuppressWarnings("removal")
665         private final Set<Map.Entry<HandshakeCompletedListener,
666                 AccessControlContext>> targets;         // who gets notified

620             inputRecord.tc = this;
621             cipherSuite = handshakeContext.negotiatedCipherSuite;
622             inputRecord.readCipher.baseSecret =
623                     handshakeContext.baseReadSecret;
624             outputRecord.writeCipher.baseSecret =
625                     handshakeContext.baseWriteSecret;
626         }
627 
628         handshakeContext = null;
629         outputRecord.handshakeHash.finish();
630         inputRecord.finishHandshake();
631         outputRecord.finishHandshake();
632         isNegotiated = true;
633 
634         // Tell folk about handshake completion, but do it in a separate thread.
635         if (transport instanceof SSLSocket &&
636                 sslConfig.handshakeListeners != null &&
637                 !sslConfig.handshakeListeners.isEmpty()) {
638             HandshakeCompletedEvent hce =
639                 new HandshakeCompletedEvent((SSLSocket)transport, conSession);
640             Thread.ofVirtual()
641                     .name("HandshakeCompletedNotify-Thread")
642                     .inheritInheritableThreadLocals(false)
643                     .start(new NotifyHandshake(sslConfig.handshakeListeners, hce));



644         }
645 
646         return HandshakeStatus.FINISHED;
647     }
648 
649     HandshakeStatus finishPostHandshake() {
650         handshakeContext = null;
651 
652         // Note: May need trigger handshake completion even for post-handshake
653         // authentication in the future.
654 
655         return HandshakeStatus.FINISHED;
656     }
657 
658     // A separate thread is allocated to deliver handshake completion
659     // events.
660     private static class NotifyHandshake implements Runnable {
661         @SuppressWarnings("removal")
662         private final Set<Map.Entry<HandshakeCompletedListener,
663                 AccessControlContext>> targets;         // who gets notified
< prev index next >