File tree Expand file tree Collapse file tree 3 files changed +24
-6
lines changed
zookeeper-server/src/main/java/org/apache/zookeeper/server Expand file tree Collapse file tree 3 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -242,15 +242,13 @@ ServerCnxnFactory getSecureCnxnFactory() {
242242 return secureCnxnFactory ;
243243 }
244244
245- // VisibleForTesting
246245 public int getClientPort () {
247246 if (cnxnFactory != null ) {
248247 return cnxnFactory .getLocalPort ();
249248 }
250249 return 0 ;
251250 }
252251
253- // VisibleForTesting
254252 public int getSecureClientPort () {
255253 if (secureCnxnFactory != null ) {
256254 return secureCnxnFactory .getLocalPort ();
Original file line number Diff line number Diff line change @@ -116,6 +116,16 @@ static ZookKeeperServerEmbeddedBuilder builder() {
116116 */
117117 void start (long startupTimeout ) throws Exception ;
118118
119+ /**
120+ * Get client port for no secure connection.
121+ */
122+ int getClientPort ();
123+
124+ /**
125+ * Get client port for secure connection.
126+ */
127+ int getSecureClientPort ();
128+
119129 /**
120130 * Get a connection string useful for the client.
121131 * @return the connection string
Original file line number Diff line number Diff line change @@ -107,8 +107,8 @@ protected QuorumPeer getQuorumPeer() throws SaslException {
107107 @ Override
108108 public void start () {
109109 super .start ();
110- boundClientPort = getClientPort ();
111- boundSecureClientPort = getSecureClientPort ();
110+ boundClientPort = super . getClientPort ();
111+ boundSecureClientPort = super . getSecureClientPort ();
112112 LOG .info ("ZK Server {} started" , this );
113113 started .complete (null );
114114 }
@@ -148,8 +148,8 @@ public void run() {
148148 @ Override
149149 public void serverStarted () {
150150 LOG .info ("ZK Server started" );
151- boundClientPort = getClientPort ();
152- boundSecureClientPort = getSecureClientPort ();
151+ boundClientPort = super . getClientPort ();
152+ boundSecureClientPort = super . getSecureClientPort ();
153153 started .complete (null );
154154 }
155155 };
@@ -190,6 +190,16 @@ public void run() {
190190 }
191191 }
192192
193+ @ Override
194+ public int getClientPort () {
195+ return boundClientPort ;
196+ }
197+
198+ @ Override
199+ public int getSecureClientPort () {
200+ return boundSecureClientPort ;
201+ }
202+
193203 @ Override
194204 public String getConnectionString () {
195205 return prettifyConnectionString (config .getClientPortAddress (), boundClientPort );
You can’t perform that action at this time.
0 commit comments