Thanks for the clarification, Ken. Changing from System.setProperty() to Security.setProperty() was all I needed. Some earlier testing misled me into thinking I had it all working previously. :)

Jon, the exact code I'm using in my application is:

//Disable permanent DNS caching.  Set the DNS caching timeout to be 1 minute
java.security.Security.setProperty("networkaddress.cache.ttl" , "60");

Thanks!
Aaron

Kenneth Wilcox wrote:
I guess what I am saying is that I believe System.setProperty will not work.
You need to set the property with the Security class because you are setting
a property that is specified in the security file

java.security.Security.setProperty("networkaddress.cache.ttl" , "10000");

And yes, Java by default caches DNS entries forever unless you override it
with the setting above.

Let me know if that helped, I believe this will solve your issue.

-Ken




-----Original Message-----
From: Aaron Braeckel [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 23, 2005 12:57 PM
To: HttpClient User Discussion
Subject: Re: DNS Cache Timeout

In my case I am deploying the application via Java Web Start, so I am
not guaranteed access to the java.security file on end user machines.  I
have to do it either via the -D command line option or programmatically
via System.setProperty().  Currently I am doing it programatically.

Aaron

Kenneth Wilcox wrote:

I think those properties need to be set in the security file, not as -D
parameters - agree?

Ken



-----Original Message-----
From: Aaron Braeckel [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 22, 2005 4:19 PM
To: [email protected]
Subject: DNS Cache Timeout

Hello,

I am using HttpClient 3.0RC2 with an application that runs constantly
and contacts a web server frequently.  I am switching DNS entries to
point to the backup server if problems occur with the primary server.
Currently I am not seeing any recognition of the change when I switch
the DNS entry, so it seems like a client-side DNS caching issue.  Is
there any way to specify DNS cache timeouts (or even whether or not to
use caching) with HttpClient?  I wasn't able to find any information on
this topic anywhere.

I am setting the appropriate properties to restrict DNS caching through
Java core methods (setting "sun.net.inetaddr.ttli" and
"networkaddress.cache.ttl¨) but so far I have not seen any effect.

Thanks,
Aaron

---------------------------------------------------------------------
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]


---------------------------------------------------------------------
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to