Target Addressing in Ant
Hello List, I have added a feature to Ant that I call Target Addressing, to help us make releases of our open source project (greenstone). I want to know if it's worth tidying up my changes and checking them back into Ant itself. Having this feature has made my life a lot easier in developing and running huge Ant projects, and I want others to benefit too. Target Addressing is a feature which gives each target in a target tree an address like 1 or 1.3.2 . These addresses can be specified on the command line to gain better control over exactly which targets are executed. You can give Ant an address to start execution from, an address to stop execution at, and/or an address of a target to descend down. A project like: Would get a target tree like: 1 compile 1.1 checkout-code 1.2 set-version-number-property 2 create-distribution 2.1 delete-unneeded code And you could run things like: ant -from 1.2 (runs 1.2, 2, 2.1) ant -to 2.1 (runs 1, 1.1, 1.2, 2) ant -descend 1 (runs 1, 1.1, 1.2) ant -from 1.1 -to 1.2 (runs 1.1) And if you ever need to see the addresses of each target in the tree, you can use a simulation flag, which walks the tree and prints out the addresses and target names without actually executing anything: ant -sim - The addresses are computed at runtime, with the main target (the the project default or the one specified on the command line) getting a null address. - Any combination of the options outlined can be used, including none at all (in which case Ant just behaves as normal). - The -from argument is inclusive in nature, while the -to argument is exclusive - I have an explanation as to why I think this is the most appropriate and intuitive implementation which I can present if needed. - Another flag to Ant to explicitly turn Target Addressing on (something like -ta), might be a good idea too. - If needed, addresses could be hidden from the user and target names could be used instead with the number addresses used in the background. This would be a bit more computationally expensive though. So before I start figuring out how to check in the changes, I just want to make sure that there is nothing like this in Ant already, and also that people actually want this feature. If there are any questions, please ask. Kind Regards, Oran Fry. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Still not able to unsubscribe
FWIW, Rob, I've been trying to catch somebody from ASF infra on IRC to help with this, but have been unsuccessful as yet. Sorry you're having so much trouble. -Matt --- "Anderson, Rob (Global Trade)" <[EMAIL PROTECTED]> wrote: > Still no response? I am have tried and tried again > with no success. Can > the list admin please help? > > > > > > -Rob A > > > > > > From: Anderson, Rob (Global Trade) > Sent: Wednesday, July 23, 2008 10:06 AM > To: 'Ant Users List'; 'Ant Developers List' > Subject: Still not able to unsubscribe > > > > Can the email list admin please help? > > > > I have tried to unsubscribe by sending email to > [EMAIL PROTECTED] and > [EMAIL PROTECTED] I > have also tried > [EMAIL PROTECTED] > and > [EMAIL PROTECTED] > > > > None of my attempts to unsubscribe have worked. > Please unsubscribe me > from both the user and dev list. > > > > Thanks, > > > > Rob Anderson > > Senior System Engineer > > Nike Global Trade IT > > 503.532.6803 > > > > I wish I was in Tijuana, eating barbecued iguana. > -Stan Ridgway > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Still not able to unsubscribe
Still no response? I am have tried and tried again with no success. Can the list admin please help? -Rob A From: Anderson, Rob (Global Trade) Sent: Wednesday, July 23, 2008 10:06 AM To: 'Ant Users List'; 'Ant Developers List' Subject: Still not able to unsubscribe Can the email list admin please help? I have tried to unsubscribe by sending email to [EMAIL PROTECTED] and [EMAIL PROTECTED] I have also tried [EMAIL PROTECTED] and [EMAIL PROTECTED] None of my attempts to unsubscribe have worked. Please unsubscribe me from both the user and dev list. Thanks, Rob Anderson Senior System Engineer Nike Global Trade IT 503.532.6803 I wish I was in Tijuana, eating barbecued iguana. -Stan Ridgway
Re: Ivy, IvyDE and thread safety?
Le jeudi 24 juillet 2008, Gilles Scokart a écrit : > Up to now, I think Ivy has mostly be used in a single thread. When > used from ant, even if it is possible to have multiple tasks running > in parallel, I doubdt it has ever been extensively used. > > There is thus a risk that some part of the code are not thread safe. > > I'm wondering what is actually the risk when Ivy is used from IvyDE? > Does IvyDE will likely invoke Ivy from multiple thread in parallel? The IvyResolveJob of IvyDE is synchronized to be run only one at a time, ensured by Eclipse. So when computing the classpath of the java projects, there won't be any thread issue. But Ivy is also used for ivy file completion and ivy file parsing. I don't know how far the code in Eclipse can use them with multiple thread. But whatever, the synchronization point here will be the end user that won't be able to edit files threadedly. :p So I don't think Ivy is used in a threaded way in IvyDE. Nicolas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Ivy, IvyDE and thread safety?
Up to now, I think Ivy has mostly be used in a single thread. When used from ant, even if it is possible to have multiple tasks running in parallel, I doubdt it has ever been extensively used. There is thus a risk that some part of the code are not thread safe. I'm wondering what is actually the risk when Ivy is used from IvyDE? Does IvyDE will likely invoke Ivy from multiple thread in parallel? -- Gilles Scokart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: svn commit: r679119 - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse: ./ src/java/org/apache/ivyde/eclipse/cpcontainer/ src/java/org/apache/ivyde/eclipse/ui/preferences/
On Thu, Jul 24, 2008 at 9:42 AM, Nicolas Lalevée <[EMAIL PROTECTED]> wrote: > Le jeudi 24 juillet 2008, Xavier Hanin a écrit : > > On Wed, Jul 23, 2008 at 6:03 PM, <[EMAIL PROTECTED]> wrote: > > > Author: hibou > > > Date: Wed Jul 23 09:03:45 2008 > > > New Revision: 679119 > > > > > > URL: http://svn.apache.org/viewvc?rev=679119&view=rev > > > Log: > > > IVYDE-105 : Retrieve after resolve feature does not clean target > > > directory first > > > - added a button in the UI to "synchronize" the retrieve > > > > [...] > > > > > --- > > > > ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/ec > > >lipse/ui/preferences/IvyPreferencePage.java (original) > > > +++ > > > > ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/ec > > >lipse/ui/preferences/IvyPreferencePage.java Wed Jul 23 09:03:45 2008 > > > @@ -56,6 +56,8 @@ > > > > > > private StringFieldEditor _pattern; > > > > > > +private BooleanFieldEditor _retreiveSync; > > > > There's a typo here, it should be _retrieveSync > > arg, this is the second time I did that spell mistake. There used to be several such same typo, so you're not the only (french) guy to make this mistake :-) > > > > > > > + > > > public IvyPreferencePage() { > > > super(GRID); > > > > setPreferenceStore(IvyPlugin.getDefault().getPreferenceStore()); > > > @@ -123,6 +125,7 @@ > > > b.addSelectionListener(new SelectionAdapter() { > > > public void widgetSelected(SelectionEvent e) { > > > _pattern.setEnabled(b.getSelection(), parent); > > > +_retreiveSync.setEnabled(b.getSelection(), > > > parent); > > > } > > > }); > > > } > > > @@ -131,8 +134,11 @@ > > > fieldParent); > > > > > > > _pattern.setEnabled(getPreferenceStore().getBoolean(PreferenceConstants.D > > >O_RETRIEVE), fieldParent); > > > +_retreiveSync = new > > > BooleanFieldEditor(PreferenceConstants.RETRIEVE_SYNC, > > > +"Delete old retrieved artifacts", fieldParent); > > > addField(doR); > > > addField(_pattern); > > > +addField(_retreiveSync); > > > > > > new Label(fieldParent, SWT.NONE); // space > > > explanation = new Label(fieldParent, SWT.NONE); > > > > > > Modified: > > > > ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/ec > > >lipse/ui/preferences/PreferenceConstants.java URL: > > > > http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse > > > >/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java > > >?rev=679119&r1=679118&r2=679119&view=diff > > > > > > > = > > >= --- > > > > ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/ec > > >lipse/ui/preferences/PreferenceConstants.java (original) > > > +++ > > > > ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/ec > > >lipse/ui/preferences/PreferenceConstants.java Wed Jul 23 09:03:45 2008 > > > @@ -48,6 +48,8 @@ > > > > > > public static final String RETRIEVE_PATTERN = "retreive.pattern"; > > > > > > +public static final String RETRIEVE_SYNC = "retreive.sync"; > > > + > > > > Same typo as above for the constant value. But I also realize we have the > > same typo for the retrieve pattern value. I'd prefer fixing it, but it > > would be a backward incompatible change with alpha1. But alpha1 is only > an > > alpha, so I'd still prefer fixing it, unless you have another opinion. > > Actually I think we can fix and keep it backward compatible: write the > property with the fixed spell, but read both form. > I will fix it. Great! Xavier > > > cheers, > Nicolas > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Xavier Hanin - Independent Java Consultant http://xhab.blogspot.com/ http://ant.apache.org/ivy/ http://www.xoocode.org/
Re: svn commit: r679208 - /ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java
On Thu, Jul 24, 2008 at 9:25 AM, Maarten Coene <[EMAIL PROTECTED]> wrote: > I agree, > > The goal is to have one single instance of HttpClient here to be able to > reuse the connections. > At the moment, the HttpClientHandler isn't a singleton, so the easiest way > for me was to make it static. > > But maybe we can wait to see if the change solves the problem. If it > doesn't, we can revert it, but if it solves to problem, we can refactor it > to some cleaner solution. It sounds like a good approach! Xavier > > > Maarten > > > > > - Original Message > From: Xavier Hanin <[EMAIL PROTECTED]> > To: dev@ant.apache.org > Sent: Thursday, July 24, 2008 9:08:32 AM > Subject: Re: svn commit: r679208 - > /ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java > > On Thu, Jul 24, 2008 at 12:06 AM, <[EMAIL PROTECTED]> wrote: > > > Author: maartenc > > Date: Wed Jul 23 15:06:48 2008 > > New Revision: 679208 > > > > URL: http://svn.apache.org/viewvc?rev=679208&view=rev > > Log: > > Attempt to fix connection leak reported in IVY-854 by caching the > > HttpClient instance. > > > > Modified: > > > > > ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java > > > > Modified: > > > ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java > > URL: > > > http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java?rev=679208&r1=679207&r2=679208&view=diff > > > > > == > > --- > > > ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java > > (original) > > +++ > > > ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java > > Wed Jul 23 15:06:48 2008 > > @@ -33,6 +33,7 @@ > > import org.apache.commons.httpclient.HttpException; > > import org.apache.commons.httpclient.HttpMethodBase; > > import org.apache.commons.httpclient.HttpStatus; > > +import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; > > import org.apache.commons.httpclient.UsernamePasswordCredentials; > > import org.apache.commons.httpclient.auth.AuthPolicy; > > import org.apache.commons.httpclient.methods.GetMethod; > > @@ -61,6 +62,8 @@ > > private String proxyPasswd = null; > > > > private HttpClientHelper httpClientHelper; > > + > > +private static HttpClient httpClient; > > > I'm not sure reusing always the same (static) instance of httpClient is > safe. In the context of IvyDE, we will have the same instance of httpClient > whatever the number of settings we use. I know we have other similar > problems about using static stuff which shouldn't be, but I dislike > introducing new ones. > > WDYT? > > Xavier > > > > > > public HttpClientHandler() { > > configureProxy(); > > @@ -204,28 +207,39 @@ > > } > > > > private HttpClient getClient(URL url) { > > -HttpClient client = new HttpClient(); > > - > > -List authPrefs = new ArrayList(2); > > -authPrefs.add(AuthPolicy.DIGEST); > > -authPrefs.add(AuthPolicy.BASIC); > > -// Exclude the NTLM authentication scheme because it is not > > supported by this class > > -client.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, > > authPrefs); > > - > > -if (useProxy()) { > > -client.getHostConfiguration().setProxy(proxyHost, > proxyPort); > > -if (useProxyAuthentication()) { > > -client.getState().setProxyCredentials(proxyRealm, > > proxyHost, > > -new UsernamePasswordCredentials(proxyUserName, > > proxyPasswd)); > > +if (httpClient == null) { > > +final MultiThreadedHttpConnectionManager connManager = new > > MultiThreadedHttpConnectionManager(); > > +httpClient = new HttpClient(connManager); > > + > > +Runtime.getRuntime().addShutdownHook(new Thread(new > Runnable() > > { > > +public void run() { > > +connManager.shutdown(); > > +} > > +})); > > + > > +List authPrefs = new ArrayList(2); > > +authPrefs.add(AuthPolicy.DIGEST); > > +authPrefs.add(AuthPolicy.BASIC); > > +// Exclude the NTLM authentication scheme because it is not > > supported by this class > > + > > httpClient.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, > > authPrefs); > > + > > +if (useProxy()) { > > +httpClient.getHostConfiguration().setProxy(proxyHost, > > proxyPort); > > +if (useProxyAuthentication()) { > > + > httpClient.getState().setProxyCredentials(proxyRealm, > > proxyHost, > > +new UsernamePasswordCredentials(proxyUserName, > > proxyPasswd)); > > +} > > } > > } > > + > > Credentials c = getCredentials(url); > > if (c != null) { > > Message.debug("found cre
Re: Extracting common ide features from IvyDE
Le jeudi 24 juillet 2008, Xavier Hanin a écrit : > On Thu, Jul 24, 2008 at 8:13 AM, Nicolas Lalevée > <[EMAIL PROTECTED]> > > wrote: > > [...] > > > > > > The main problem IMO > > > >> is that it would then have the same release cycles, whilst the evolution > >> needs may be very different. > > > > I don't now really what would be the new features of common.ide. But as > > you are wondering about it, it probably means that you expect some new > > features brought by IvyBeans ;). > > For IvyBeans it's not the problem since I'm a committer on IvyDE too, I can > do pretty much what I want (and yes I have some new feature, well, at least > one, settings code completion). But if in the future people want to use > IvyDE commons in another plugin (let's say IDEA) and want to improve > something they will need to go through the "provide patch" line. Not that > much a problem but I think in the case of a small library reused by several > plugins it can slow down development. > > >>> So I am in favor in integrating that common.ide in Ivy. Then I would > >>> prefer > >>> keeping it in IvyDE. And last have a new project with its own release > >>> cycle. > >> > >> I think I prefer to either put it in IvyDE, or really split it as a > >> separate > >> project. Maybe even a project hosted somewhere else. After all ASF is > >> not against having dependencies on Apache licensed libraries which are > >> not from > >> the ASF. The advantage I see with hosting it elsewhere is that it would > >> be much easier to have people using the library in any plugin become a > >> committer on the library. > > > > I have to admit that I don't "like" having some new external > > dependencies. But I have no strong argument to show :p > > > > So my order of preferences is kept inside IvyDE, then having it in > > another project. > > > > And what about common.ide included in IvyDE's release cycle, and having > > an independent build ? > > It would be an new project org.apache.ivy.common.ide under the trunk > > directory of IvyDE. Used by IvyDE it would be just another plugin it > > depends on. But it would have a standalone build.xml that you can build > > yourself the jar, and then import that jar into IvyBeans, just like Solr > > does with Lucene > > (http://svn.apache.org/repos/asf/lucene/solr/tags/release-1.2.0/lib/). > > And that component would have it own Change.txt, as it could have somehow > > independent features. > > That sounds like the easiest thing to setup for now, so I'm ok to go this > way, then later we may decide to move the project out if we see that > there's a real need from the community. sounds good > > So I'll proceed with thesee changes in the coming days, unless you (or > someone else) object before. please do. cheers, Nicolas > > Xavier > > > NIcolas > > > >>> Just my feelings, I won't put any veto there. > >>> > >>> Nicolas > >>> > Xavier > > I'd move this code to a > > >> org.apache.ivyde.common package, which could be used by any IDE > > > > plugin > > developer. The next step would be to move this package in a separate > > >> module, so that other plugin developers can use it without embedding > >> the whole eclipse plugin. Then I could add new features to this > > > > common > > > > > > package, > > > > which would ease the reuse of work I do for Netbeans plugin in > > > > eclipse > > plugin. > > >> So, do you think it makes sense to do that? Any objection? > > > > No objection on the idea of sharing common code. The question is then > > how. > > > > Nicolas > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > >>> > >>> - > >>> To unsubscribe, e-mail: [EMAIL PROTECTED] > >>> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> -- > >> Xavier Hanin - Independent Java Consultant > >> http://xhab.blogspot.com/ > >> http://ant.apache.org/ivy/ > >> http://www.xoocode.org/ > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: svn commit: r679119 - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse: ./ src/java/org/apache/ivyde/eclipse/cpcontainer/ src/java/org/apache/ivyde/eclipse/ui/preferences/
Le jeudi 24 juillet 2008, Xavier Hanin a écrit : > On Wed, Jul 23, 2008 at 6:03 PM, <[EMAIL PROTECTED]> wrote: > > Author: hibou > > Date: Wed Jul 23 09:03:45 2008 > > New Revision: 679119 > > > > URL: http://svn.apache.org/viewvc?rev=679119&view=rev > > Log: > > IVYDE-105 : Retrieve after resolve feature does not clean target > > directory first > > - added a button in the UI to "synchronize" the retrieve > > [...] > > > --- > > ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/ec > >lipse/ui/preferences/IvyPreferencePage.java (original) > > +++ > > ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/ec > >lipse/ui/preferences/IvyPreferencePage.java Wed Jul 23 09:03:45 2008 > > @@ -56,6 +56,8 @@ > > > > private StringFieldEditor _pattern; > > > > +private BooleanFieldEditor _retreiveSync; > > There's a typo here, it should be _retrieveSync arg, this is the second time I did that spell mistake. > > > + > > public IvyPreferencePage() { > > super(GRID); > > setPreferenceStore(IvyPlugin.getDefault().getPreferenceStore()); > > @@ -123,6 +125,7 @@ > > b.addSelectionListener(new SelectionAdapter() { > > public void widgetSelected(SelectionEvent e) { > > _pattern.setEnabled(b.getSelection(), parent); > > +_retreiveSync.setEnabled(b.getSelection(), > > parent); > > } > > }); > > } > > @@ -131,8 +134,11 @@ > > fieldParent); > > > > _pattern.setEnabled(getPreferenceStore().getBoolean(PreferenceConstants.D > >O_RETRIEVE), fieldParent); > > +_retreiveSync = new > > BooleanFieldEditor(PreferenceConstants.RETRIEVE_SYNC, > > +"Delete old retrieved artifacts", fieldParent); > > addField(doR); > > addField(_pattern); > > +addField(_retreiveSync); > > > > new Label(fieldParent, SWT.NONE); // space > > explanation = new Label(fieldParent, SWT.NONE); > > > > Modified: > > ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/ec > >lipse/ui/preferences/PreferenceConstants.java URL: > > http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse > >/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java > >?rev=679119&r1=679118&r2=679119&view=diff > > > > = > >= --- > > ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/ec > >lipse/ui/preferences/PreferenceConstants.java (original) > > +++ > > ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/ec > >lipse/ui/preferences/PreferenceConstants.java Wed Jul 23 09:03:45 2008 > > @@ -48,6 +48,8 @@ > > > > public static final String RETRIEVE_PATTERN = "retreive.pattern"; > > > > +public static final String RETRIEVE_SYNC = "retreive.sync"; > > + > > Same typo as above for the constant value. But I also realize we have the > same typo for the retrieve pattern value. I'd prefer fixing it, but it > would be a backward incompatible change with alpha1. But alpha1 is only an > alpha, so I'd still prefer fixing it, unless you have another opinion. Actually I think we can fix and keep it backward compatible: write the property with the fixed spell, but read both form. I will fix it. cheers, Nicolas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: svn commit: r679208 - /ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java
I agree, The goal is to have one single instance of HttpClient here to be able to reuse the connections. At the moment, the HttpClientHandler isn't a singleton, so the easiest way for me was to make it static. But maybe we can wait to see if the change solves the problem. If it doesn't, we can revert it, but if it solves to problem, we can refactor it to some cleaner solution. Maarten - Original Message From: Xavier Hanin <[EMAIL PROTECTED]> To: dev@ant.apache.org Sent: Thursday, July 24, 2008 9:08:32 AM Subject: Re: svn commit: r679208 - /ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java On Thu, Jul 24, 2008 at 12:06 AM, <[EMAIL PROTECTED]> wrote: > Author: maartenc > Date: Wed Jul 23 15:06:48 2008 > New Revision: 679208 > > URL: http://svn.apache.org/viewvc?rev=679208&view=rev > Log: > Attempt to fix connection leak reported in IVY-854 by caching the > HttpClient instance. > > Modified: > > ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java > > Modified: > ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java > URL: > http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java?rev=679208&r1=679207&r2=679208&view=diff > > == > --- > ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java > (original) > +++ > ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java > Wed Jul 23 15:06:48 2008 > @@ -33,6 +33,7 @@ > import org.apache.commons.httpclient.HttpException; > import org.apache.commons.httpclient.HttpMethodBase; > import org.apache.commons.httpclient.HttpStatus; > +import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; > import org.apache.commons.httpclient.UsernamePasswordCredentials; > import org.apache.commons.httpclient.auth.AuthPolicy; > import org.apache.commons.httpclient.methods.GetMethod; > @@ -61,6 +62,8 @@ > private String proxyPasswd = null; > > private HttpClientHelper httpClientHelper; > + > +private static HttpClient httpClient; I'm not sure reusing always the same (static) instance of httpClient is safe. In the context of IvyDE, we will have the same instance of httpClient whatever the number of settings we use. I know we have other similar problems about using static stuff which shouldn't be, but I dislike introducing new ones. WDYT? Xavier > > public HttpClientHandler() { > configureProxy(); > @@ -204,28 +207,39 @@ > } > > private HttpClient getClient(URL url) { > -HttpClient client = new HttpClient(); > - > -List authPrefs = new ArrayList(2); > -authPrefs.add(AuthPolicy.DIGEST); > -authPrefs.add(AuthPolicy.BASIC); > -// Exclude the NTLM authentication scheme because it is not > supported by this class > -client.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, > authPrefs); > - > -if (useProxy()) { > -client.getHostConfiguration().setProxy(proxyHost, proxyPort); > -if (useProxyAuthentication()) { > -client.getState().setProxyCredentials(proxyRealm, > proxyHost, > -new UsernamePasswordCredentials(proxyUserName, > proxyPasswd)); > +if (httpClient == null) { > +final MultiThreadedHttpConnectionManager connManager = new > MultiThreadedHttpConnectionManager(); > +httpClient = new HttpClient(connManager); > + > +Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() > { > +public void run() { > +connManager.shutdown(); > +} > +})); > + > +List authPrefs = new ArrayList(2); > +authPrefs.add(AuthPolicy.DIGEST); > +authPrefs.add(AuthPolicy.BASIC); > +// Exclude the NTLM authentication scheme because it is not > supported by this class > + > httpClient.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, > authPrefs); > + > +if (useProxy()) { > +httpClient.getHostConfiguration().setProxy(proxyHost, > proxyPort); > +if (useProxyAuthentication()) { > +httpClient.getState().setProxyCredentials(proxyRealm, > proxyHost, > +new UsernamePasswordCredentials(proxyUserName, > proxyPasswd)); > +} > } > } > + > Credentials c = getCredentials(url); > if (c != null) { > Message.debug("found credentials for " + url + ": " + c); > -client.getState().setCredentials(c.getRealm(), c.getHost(), > +httpClient.getState().setCredentials(c.getRealm(), > c.getHost(), > new UsernamePasswordCredentials(c.getUserName(), > c.getPasswd())); > } > -return client; > + > +return httpClient; > } > > private bo
Re: svn commit: r679208 - /ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java
On Thu, Jul 24, 2008 at 12:06 AM, <[EMAIL PROTECTED]> wrote: > Author: maartenc > Date: Wed Jul 23 15:06:48 2008 > New Revision: 679208 > > URL: http://svn.apache.org/viewvc?rev=679208&view=rev > Log: > Attempt to fix connection leak reported in IVY-854 by caching the > HttpClient instance. > > Modified: > > ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java > > Modified: > ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java > URL: > http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java?rev=679208&r1=679207&r2=679208&view=diff > > == > --- > ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java > (original) > +++ > ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java > Wed Jul 23 15:06:48 2008 > @@ -33,6 +33,7 @@ > import org.apache.commons.httpclient.HttpException; > import org.apache.commons.httpclient.HttpMethodBase; > import org.apache.commons.httpclient.HttpStatus; > +import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; > import org.apache.commons.httpclient.UsernamePasswordCredentials; > import org.apache.commons.httpclient.auth.AuthPolicy; > import org.apache.commons.httpclient.methods.GetMethod; > @@ -61,6 +62,8 @@ > private String proxyPasswd = null; > > private HttpClientHelper httpClientHelper; > + > +private static HttpClient httpClient; I'm not sure reusing always the same (static) instance of httpClient is safe. In the context of IvyDE, we will have the same instance of httpClient whatever the number of settings we use. I know we have other similar problems about using static stuff which shouldn't be, but I dislike introducing new ones. WDYT? Xavier > > public HttpClientHandler() { > configureProxy(); > @@ -204,28 +207,39 @@ > } > > private HttpClient getClient(URL url) { > -HttpClient client = new HttpClient(); > - > -List authPrefs = new ArrayList(2); > -authPrefs.add(AuthPolicy.DIGEST); > -authPrefs.add(AuthPolicy.BASIC); > -// Exclude the NTLM authentication scheme because it is not > supported by this class > -client.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, > authPrefs); > - > -if (useProxy()) { > -client.getHostConfiguration().setProxy(proxyHost, proxyPort); > -if (useProxyAuthentication()) { > -client.getState().setProxyCredentials(proxyRealm, > proxyHost, > -new UsernamePasswordCredentials(proxyUserName, > proxyPasswd)); > +if (httpClient == null) { > +final MultiThreadedHttpConnectionManager connManager = new > MultiThreadedHttpConnectionManager(); > +httpClient = new HttpClient(connManager); > + > +Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() > { > +public void run() { > +connManager.shutdown(); > +} > +})); > + > +List authPrefs = new ArrayList(2); > +authPrefs.add(AuthPolicy.DIGEST); > +authPrefs.add(AuthPolicy.BASIC); > +// Exclude the NTLM authentication scheme because it is not > supported by this class > + > httpClient.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, > authPrefs); > + > +if (useProxy()) { > +httpClient.getHostConfiguration().setProxy(proxyHost, > proxyPort); > +if (useProxyAuthentication()) { > +httpClient.getState().setProxyCredentials(proxyRealm, > proxyHost, > +new UsernamePasswordCredentials(proxyUserName, > proxyPasswd)); > +} > } > } > + > Credentials c = getCredentials(url); > if (c != null) { > Message.debug("found credentials for " + url + ": " + c); > -client.getState().setCredentials(c.getRealm(), c.getHost(), > +httpClient.getState().setCredentials(c.getRealm(), > c.getHost(), > new UsernamePasswordCredentials(c.getUserName(), > c.getPasswd())); > } > -return client; > + > +return httpClient; > } > > private boolean useProxy() { > @@ -243,7 +257,7 @@ > private boolean useProxyAuthentication() { > return (proxyUserName != null && proxyUserName.trim().length() > > 0); > } > - > + > private static final class GETInputStream extends InputStream { > private InputStream is; > > > > -- Xavier Hanin - Independent Java Consultant http://xhab.blogspot.com/ http://ant.apache.org/ivy/ http://www.xoocode.org/
Re: svn commit: r679119 - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse: ./ src/java/org/apache/ivyde/eclipse/cpcontainer/ src/java/org/apache/ivyde/eclipse/ui/preferences/
On Wed, Jul 23, 2008 at 6:03 PM, <[EMAIL PROTECTED]> wrote: > Author: hibou > Date: Wed Jul 23 09:03:45 2008 > New Revision: 679119 > > URL: http://svn.apache.org/viewvc?rev=679119&view=rev > Log: > IVYDE-105 : Retrieve after resolve feature does not clean target directory > first > - added a button in the UI to "synchronize" the retrieve > [...] > > --- > ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java > (original) > +++ > ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java > Wed Jul 23 09:03:45 2008 > @@ -56,6 +56,8 @@ > > private StringFieldEditor _pattern; > > +private BooleanFieldEditor _retreiveSync; There's a typo here, it should be _retrieveSync > > + > public IvyPreferencePage() { > super(GRID); > setPreferenceStore(IvyPlugin.getDefault().getPreferenceStore()); > @@ -123,6 +125,7 @@ > b.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > _pattern.setEnabled(b.getSelection(), parent); > +_retreiveSync.setEnabled(b.getSelection(), > parent); > } > }); > } > @@ -131,8 +134,11 @@ > fieldParent); > > _pattern.setEnabled(getPreferenceStore().getBoolean(PreferenceConstants.DO_RETRIEVE), > fieldParent); > +_retreiveSync = new > BooleanFieldEditor(PreferenceConstants.RETRIEVE_SYNC, > +"Delete old retrieved artifacts", fieldParent); > addField(doR); > addField(_pattern); > +addField(_retreiveSync); > > new Label(fieldParent, SWT.NONE); // space > explanation = new Label(fieldParent, SWT.NONE); > > Modified: > ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java > URL: > http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java?rev=679119&r1=679118&r2=679119&view=diff > > == > --- > ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java > (original) > +++ > ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java > Wed Jul 23 09:03:45 2008 > @@ -48,6 +48,8 @@ > > public static final String RETRIEVE_PATTERN = "retreive.pattern"; > > +public static final String RETRIEVE_SYNC = "retreive.sync"; > + Same typo as above for the constant value. But I also realize we have the same typo for the retrieve pattern value. I'd prefer fixing it, but it would be a backward incompatible change with alpha1. But alpha1 is only an alpha, so I'd still prefer fixing it, unless you have another opinion. Xavier