[ 
https://issues.apache.org/jira/browse/IVY-1572?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16357900#comment-16357900
 ] 

ASF GitHub Bot commented on IVY-1572:
-------------------------------------

Github user jaikiran commented on a diff in the pull request:

    https://github.com/apache/ant-ivy/pull/62#discussion_r167136873
  
    --- Diff: 
src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java ---
    @@ -91,6 +91,9 @@ protected ResolvedResource 
findResourceUsingPatterns(ModuleRevisionId moduleRevi
             Set<String> foundRevisions = new HashSet<>();
             boolean dynamic = 
getSettings().getVersionMatcher().isDynamic(moduleRevision);
             for (String pattern : patternList) {
    +            if (Thread.currentThread().isInterrupted()) {
    +                return null;
    --- End diff --
    
    @apupier I originally intended it to be `InterruptedException` but given 
that it's a checked exception you would end up changing the method signature of 
this method which then causes issues with callers of this API. Hence I 
suggested a runtime exception.  Returning null  could have other (side) effects 
than what you intend here - i.e. to abort the execution, so throwing the 
exception would be the right thing.
    
    I might have some time tonight, I'll see if this check can be moved to a 
better location or handle in a better way. 


> Look for Thread interruption on potentially long-running operation 
> org.apache.ivy.plugins.resolver.AbstractPatternsBasedResolver.findResourceUsingPatterns(ModuleRevisionId,
>  List, Artifact, ResourceMDParser, Date)
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IVY-1572
>                 URL: https://issues.apache.org/jira/browse/IVY-1572
>             Project: Ivy
>          Issue Type: Improvement
>    Affects Versions: 2.4.0
>            Reporter: Aurelien Pupier
>            Priority: Major
>
> While searching for an unavailable artifact and a lot of repositories are 
> defined (and especially when some of them are not very responsive), the 
> search can take several minutes.
> For this reason, it would be nice to be able to look for interruption during 
> a search.
> example of stack
> {noformat}
> Thread [Camel Version Checker - 
> org.fusesource.ide.projecttemplates.util.CamelVersionChecker@576f3c03] 
> (Suspended)    
>       owns: BufferedInputStream  (id=195)     
>       owns: CamelVersionChecker  (id=196)     
>       SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int) 
> line: not available [native method]        
>       SocketInputStream.socketRead(FileDescriptor, byte[], int, int, int) 
> line: 116   
>       SocketInputStream.read(byte[], int, int, int) line: 170 
>       SocketInputStream.read(byte[], int, int) line: 141      
>       BufferedInputStream.fill() line: 246    
>       BufferedInputStream.read() line: 265    
>       HttpParser.readRawLine(InputStream) line: 78    
>       HttpParser.readLine(InputStream, String) line: 106      
>       
> MultiThreadedHttpConnectionManager$HttpConnectionWithReference(HttpConnection).readLine(String)
>  line: 1116      
>       
> MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(String) 
> line: 1413    
>       HeadMethod(HttpMethodBase).readStatusLine(HttpState, HttpConnection) 
> line: 1973 
>       HeadMethod(HttpMethodBase).readResponse(HttpState, HttpConnection) 
> line: 1735   
>       HeadMethod(HttpMethodBase).execute(HttpState, HttpConnection) line: 
> 1098        
>       HttpMethodDirector.executeWithRetry(HttpMethod) line: 398       
>       HttpMethodDirector.executeMethod(HttpMethod) line: 171  
>       HttpClient.executeMethod(HostConfiguration, HttpMethod, HttpState) 
> line: 397    
>       HttpClient.executeMethod(HttpMethod) line: 323  
>       TimeoutHttpClientHandler(HttpClientHandler).doHead(URL, int) line: 266  
>       TimeoutHttpClientHandler(HttpClientHandler).getURLInfo(URL, int) line: 
> 152      
>       TimeoutHttpClientHandler.getURLInfo(URL) line: 55       
>       URLResource.init() line: 68     
>       URLResource.exists() line: 84   
>       
> IBiblioResolver(RepositoryResolver).findResourceUsingPattern(ModuleRevisionId,
>  String, Artifact, ResourceMDParser, Date) line: 97       
>       
> IBiblioResolver(AbstractPatternsBasedResolver).findResourceUsingPatterns(ModuleRevisionId,
>  List, Artifact, ResourceMDParser, Date) line: 100    
>       IBiblioResolver.findIvyFileRef(DependencyDescriptor, ResolveData) line: 
> 103     
>       IBiblioResolver(BasicResolver).getDependency(DependencyDescriptor, 
> ResolveData) line: 230       
>       IBiblioResolver.getDependency(DependencyDescriptor, ResolveData) line: 
> 506      
>       ChainResolver.getDependency(DependencyDescriptor, ResolveData) line: 
> 104        
>       IvyNode.loadData(String, IvyNode, String, String, boolean, 
> IvyNodeUsage) line: 170      
>       VisitNode.loadData(String, boolean) line: 292   
>       ResolveEngine.fetchDependencies(VisitNode, String, boolean) line: 718   
>       ResolveEngine.doFetchDependencies(VisitNode, String) line: 803  
>       ResolveEngine.fetchDependencies(VisitNode, String, boolean) line: 726   
>       ResolveEngine.getDependencies(ModuleDescriptor, ResolveOptions, 
> ResolveReport) line: 599        
>       ResolveEngine.resolve(ModuleDescriptor, ResolveOptions) line: 236       
>       Ivy.resolve(ModuleDescriptor, ResolveOptions) line: 523 
>       Ivy$resolve$0.call(Object, Object, Object) line: not available  
>       GrapeIvy.getDependencies(Map, IvyGrabRecord...) line: 410       
>       NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not 
> available [native method]  
>       NativeMethodAccessorImpl.invoke(Object, Object[]) line: 62      
>       DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43  
>       Method.invoke(Object, Object...) line: 498      
>       PogoMetaMethodSite$PogoCachedMethodSite.invoke(Object, Object[]) line: 
> 169      
>       
> PogoMetaMethodSite$PogoCachedMethodSite(PogoMetaMethodSite).callCurrent(GroovyObject,
>  Object[]) line: 59        
>       GrapeIvy.resolve(ClassLoader, Map, List, Map...) line: 571      
>       GrapeIvy$resolve$1.callCurrent(GroovyObject, Object, Object, Object, 
> Object) line: not available        
>       GrapeIvy.resolve(ClassLoader, Map, Map...) line: 538    
>       GrapeIvy$resolve$0.callCurrent(GroovyObject, Object, Object, Object) 
> line: not available        
>       GrapeIvy.grab(Map, Map...) line: 256    
>       NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not 
> available [native method]  
>       NativeMethodAccessorImpl.invoke(Object, Object[]) line: 62      
>       DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43  
>       Method.invoke(Object, Object...) line: 498      
>       PogoMetaMethodSite$PogoCachedMethodSite.invoke(Object, Object[]) line: 
> 169      
>       
> PogoMetaMethodSite$PogoCachedMethodSite(PogoMetaMethodSite).callCurrent(GroovyObject,
>  Object[]) line: 59        
>       
> PogoMetaMethodSite$PogoCachedMethodSite(AbstractCallSite).callCurrent(GroovyObject,
>  Object, Object) line: 174   
>       GrapeIvy.grab(Map) line: 237    
>       Grape.grab(Map<String,Object>) line: 152        
>       MavenVersionManager.loadVersion(String) line: 109       
>       CamelService.isCamelVersionExisting(String) line: 326   
>       CamelManagerServiceProxy.isCamelVersionExisting(String) line: 171       
>       CamelVersionChecker.isCamelVersionValid(String) line: 79        
>       CamelVersionChecker.lambda$0() line: 60 
>       1017131809.run() line: not available    
>       Thread.run() line: 745  
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to