File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed 
core/src/main/scala/org/apache/spark/rpc/netty Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -332,18 +332,14 @@ private[netty] class NettyRpcEnv(
332332
333333    val  pipe  =  Pipe .open()
334334    val  source  =  new  FileDownloadChannel (pipe.source())
335-     var  exceptionThrown  =  true 
336-     try  {
335+     Utils .tryWithSafeFinallyAndFailureCallbacks(block =  {
337336      val  client  =  downloadClient(parsedUri.getHost(), parsedUri.getPort())
338337      val  callback  =  new  FileDownloadCallback (pipe.sink(), source, client)
339338      client.stream(parsedUri.getPath(), callback)
340-       exceptionThrown =  false 
341-     } finally  {
342-       if  (exceptionThrown) {
343-         pipe.sink().close()
344-         source.close()
345-       }
346-     }
339+     })(catchBlock =  {
340+       pipe.sink().close()
341+       source.close()
342+     })
347343
348344    source
349345  }
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments