Hi Stefano, just to let you know.. The race condition / deadlock is still in the place.
bye Norman [EMAIL PROTECTED] schrieb: > Author: bago > Date: Tue Apr 24 16:47:30 2007 > New Revision: 532141 > > URL: http://svn.apache.org/viewvc?view=rev&rev=532141 > Log: > Change DNSServiceXBillImpl callback to use a callback thread because it > wasn't respecting the contract. > The callback of an asynch method should never be called by the original > caller thread. > A better solution could be to use a thread pool, but the dnsjnio > implementation will take care of this. > The DNSJava based Staged executor is simply a proof of concept. > > Modified: > > james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/impl/DNSServiceXBillImpl.java > > Modified: > james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/impl/DNSServiceXBillImpl.java > URL: > http://svn.apache.org/viewvc/james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/impl/DNSServiceXBillImpl.java?view=diff&rev=532141&r1=532140&r2=532141 > ============================================================================== > --- > james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/impl/DNSServiceXBillImpl.java > (original) > +++ > james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/impl/DNSServiceXBillImpl.java > Tue Apr 24 16:47:30 2007 > @@ -47,13 +47,13 @@ > public class DNSServiceXBillImpl implements DNSService { > > // Set seconds after which we return and TempError > - private int timeOut = 20; > + protected int timeOut = 20; > > // The logger > - private Logger log; > + protected Logger log; > > // The record limit for lookups > - private int recordLimit; > + protected int recordLimit; > > /** > * Default Constructor > @@ -195,12 +195,27 @@ > * @see > org.apache.james.jspf.core.DNSService#getRecordsAsynch(java.lang.String, int, > java.lang.Object, org.apache.james.jspf.core.IResponseQueue) > */ > public void getRecordsAsynch(String hostname, int recordType, Object id, > - IResponseQueue responsePool) { > + final IResponseQueue responsePool) { > + IResponseImpl response; > try { > - responsePool.insertResponse(new IResponseImpl(id, > getRecords(hostname, recordType))); > + response = new IResponseImpl(id, getRecords(hostname, > recordType)); > } catch (TimeoutException e) { > - responsePool.insertResponse(new IResponseImpl(id, e)); > + response = new IResponseImpl(id, e); > } > + new Thread() { > + > + private IResponseImpl response; > + > + public void run() { > + responsePool.insertResponse(response); > + } > + > + public Thread setResponse(IResponseImpl response) { > + this.response = response; > + return this; > + } > + > + }.setResponse(response).start(); > > } > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > !DSPAM:1,462e9750324325014519403! > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
