SSLEngine (Java SE 9 & JDK 9 ) (original) (raw)

Concurrency Notes: There are two concurrency issues to be aware of:

  1. The wrap() and unwrap() methods may execute concurrently of each other.
  2. The SSL/TLS/DTLS protocols employ ordered packets. Applications must take care to ensure that generated packets are delivered in sequence. If packets arrive out-of-order, unexpected or fatal results may occur.
    For example:
    synchronized (outboundLock) {
    sslEngine.wrap(src, dst);
    outboundQueue.put(dst);
    }
As a corollary, two threads must not attempt to call the same method (either `wrap()` or `unwrap()`) concurrently, because there is no way to guarantee the eventual packet ordering.  

Since:
1.5
See Also:
SSLContext, SSLSocket, SSLServerSocket, SSLSession, Socket