In the following code, two synchronization locks are used. One synchronization lock is sufficient. @Override public synchronized SSLSession getHandshakeSession() { if (conContext.handshakeContext != null) { synchronized (this) { if (conContext.handshakeContext != null) { return conContext.handshakeContext.handshakeSession; } } } return null; }
|