@@ -166,21 +166,26 @@ public ManagedChannel getChannel() throws UnconfiguredException {
166166 if (localChannel == null || localChannel .isShutdown () || localChannel .isTerminated ()) {
167167
168168 long beforeLockAcquisition = System .currentTimeMillis ();
169- log .debug ("[LOCK-TIMING] getChannel attempting to acquire lock for tenant: {} at {}ms" ,
170- tenant , beforeLockAcquisition );
171-
169+ log .debug (
170+ "[LOCK-TIMING] getChannel attempting to acquire lock for tenant: {} at {}ms" ,
171+ tenant ,
172+ beforeLockAcquisition );
173+
172174 lock .lock ();
173-
175+
174176 long afterLockAcquisition = System .currentTimeMillis ();
175177 long lockWaitTime = afterLockAcquisition - beforeLockAcquisition ;
176178 if (lockWaitTime > 100 ) {
177- log .warn ("[LOCK-TIMING] getChannel lock acquired for tenant: {} after {}ms WAIT (potential contention!)" ,
178- tenant , lockWaitTime );
179+ log .warn (
180+ "[LOCK-TIMING] getChannel lock acquired for tenant: {} after {}ms WAIT (potential contention!)" ,
181+ tenant ,
182+ lockWaitTime );
179183 } else {
180- log .debug ("[LOCK-TIMING] getChannel lock acquired for tenant: {} after {}ms" ,
181- tenant , lockWaitTime );
184+ log .debug (
185+ "[LOCK-TIMING] getChannel lock acquired for tenant: {} after {}ms" ,
186+ tenant ,
187+ lockWaitTime );
182188 }
183-
184189 try {
185190 // Double-check condition inside synchronized block
186191 localChannel = sharedChannel ;
@@ -193,20 +198,25 @@ public ManagedChannel getChannel() throws UnconfiguredException {
193198 localChannel == null ,
194199 shutdown ,
195200 terminated );
196-
201+
197202 if (localChannel == null || localChannel .isShutdown () || localChannel .isTerminated ()) {
198203 long beforeCreateChannel = System .currentTimeMillis ();
199- log .debug ("[LOCK-TIMING] getChannel creating new channel for tenant: {} at {}ms (lock held for {}ms so far)" ,
200- tenant , beforeCreateChannel , beforeCreateChannel - afterLockAcquisition );
201-
204+ log .debug (
205+ "[LOCK-TIMING] getChannel creating new channel for tenant: {} at {}ms (lock held for {}ms so far)" ,
206+ tenant ,
207+ beforeCreateChannel ,
208+ beforeCreateChannel - afterLockAcquisition );
209+
202210 localChannel = createNewChannel ();
203-
211+
204212 long afterCreateChannel = System .currentTimeMillis ();
205- log .debug ("[LOCK-TIMING] getChannel channel created for tenant: {} at {}ms (createNewChannel took: {}ms, lock held total: {}ms)" ,
206- tenant , afterCreateChannel ,
213+ log .debug (
214+ "[LOCK-TIMING] getChannel channel created for tenant: {} at {}ms (createNewChannel took: {}ms, lock held total: {}ms)" ,
215+ tenant ,
216+ afterCreateChannel ,
207217 afterCreateChannel - beforeCreateChannel ,
208218 afterCreateChannel - afterLockAcquisition );
209-
219+
210220 sharedChannel = localChannel ;
211221 }
212222 } catch (Exception e ) {
@@ -221,8 +231,12 @@ public ManagedChannel getChannel() throws UnconfiguredException {
221231 lock .unlock ();
222232 long afterUnlock = System .currentTimeMillis ();
223233 long totalLockHeldTime = afterUnlock - afterLockAcquisition ;
224- log .debug ("[LOCK-TIMING] getChannel lock released for tenant: {} at {}ms (lock held for {}ms, total getChannel: {}ms)" ,
225- tenant , afterUnlock , totalLockHeldTime , afterUnlock - getChannelStartTime );
234+ log .debug (
235+ "[LOCK-TIMING] getChannel lock released for tenant: {} at {}ms (lock held for {}ms, total getChannel: {}ms)" ,
236+ tenant ,
237+ afterUnlock ,
238+ totalLockHeldTime ,
239+ afterUnlock - getChannelStartTime );
226240 }
227241 } else {
228242 log .debug (
0 commit comments