Make sure successful SslHandshakeCompletionEvent is a singleton
- Related: #1373
- This commit is an amendment to 2a7bea2ad3
This commit is contained in:
parent
620c3e025a
commit
50433f7b9a
@ -189,8 +189,6 @@ public class SslHandler
|
||||
private volatile long handshakeTimeoutMillis = 10000;
|
||||
private volatile long closeNotifyTimeoutMillis = 3000;
|
||||
|
||||
private static final SslHandshakeCompletionEvent HANDSHAKE_SUCCESS_EVENT = new SslHandshakeCompletionEvent(null);
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
*
|
||||
@ -908,7 +906,7 @@ public class SslHandler
|
||||
*/
|
||||
private void setHandshakeSuccess() {
|
||||
if (handshakePromise.trySuccess(ctx.channel())) {
|
||||
ctx.fireUserEventTriggered(HANDSHAKE_SUCCESS_EVENT);
|
||||
ctx.fireUserEventTriggered(SslHandshakeCompletionEvent.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,9 +22,25 @@ package io.netty.handler.ssl;
|
||||
*/
|
||||
public final class SslHandshakeCompletionEvent {
|
||||
|
||||
public static final SslHandshakeCompletionEvent SUCCESS = new SslHandshakeCompletionEvent();
|
||||
|
||||
private final Throwable cause;
|
||||
|
||||
/**
|
||||
* Creates a new event that indicates a successful handshake.
|
||||
*/
|
||||
private SslHandshakeCompletionEvent() {
|
||||
cause = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new event that indicates an unsuccessful handshake.
|
||||
* Use {@link #SUCCESS} to indicate a successful handshake.
|
||||
*/
|
||||
public SslHandshakeCompletionEvent(Throwable cause) {
|
||||
if (cause == null) {
|
||||
throw new NullPointerException("cause");
|
||||
}
|
||||
this.cause = cause;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user