On Wednesday 04 February 2009 20:06, Florent Daignière wrote:
> * Daniel Cheng <[email protected]> [2009-02-04 23:35:04]:
> 
> > On Wed, Feb 4, 2009 at 7:41 PM, Florent Daigniere
> > <[email protected]> wrote:
> > > Daniel Cheng wrote:
> > >> On Wed, Feb 4, 2009 at 12:45 AM,  <[email protected]> wrote:
> > >>> Author: nextgens
> > >>> Date: 2009-02-03 16:45:44 +0000 (Tue, 03 Feb 2009)
> > >>> New Revision: 25492
> > >>>
> > >>> Modified:
> > >>>   trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
> > >>> Log:
> > >>> Use the executor and not the ticker there
> > >>>
> > >>> Modified: 
trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
> > >>> ===================================================================
> > >>> --- trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java  
2009-02-03 16:24:45 UTC (rev 25491)
> > >>> +++ trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java  
2009-02-03 16:45:44 UTC (rev 25492)
> > >>> @@ -662,18 +662,18 @@
> > >>>                Runnable r = new Runnable() {
> > >>>                        public void run() {
> > >>>                                if(logMINOR) 
Logger.minor(this, "Running "+gets.length+" callbacks off-thread 
for "+block.getKey());
> > >>> -                               for(int i=0;i<gets.length;i++) {
> > >>> +                               for(SendableGet get : gets) {
> > >>>                                        try {
> > >>> -                                               if(logMINOR) 
Logger.minor(this, "Calling callback for "+gets[i]+" for "+key);
> > >>> -                                               gets[i].onGotKey(key, 
block, ClientRequestScheduler.this);
> > >>> +                                               if(logMINOR) 
Logger.minor(this, "Calling callback for "+get+" for "+key);
> > >>> +                                               get.onGotKey(key, 
block, ClientRequestScheduler.this);
> > >>>                                        } catch (Throwable t) {
> > >>> -                                               
Logger.error(this, "Caught "+t+" running callback "+gets[i]+" for "+key, t);
> > >>> +                                               
Logger.error(this, "Caught "+t+" running callback "+get+" for "+key, t);
> > >>>                                        }
> > >>>                                }
> > >>>                                if(logMINOR) 
Logger.minor(this, "Finished running callbacks");
> > >>>                        }
> > >>>                };
> > >>> -               node.getTicker().queueTimedJob(r, 0); // FIXME ideally 
these would be completed on a single thread; when we have 1.5, use a 
dedicated non-parallel Executor
> > >>> +               node.executor.execute(r, "Callbacks for "+name);
> > >>
> > >> The FIXME still applies:   node.executor spawn a new thread for every
> > >> request. the original comment call for a "non-parallel" executor.
> > >
> > > There is a patch in the pipes to make it happen; There is no reason why
> > > not to use Executor anymore... All we need is a NativeThread factory.
> > 
> > I tried to do this some time before but didn't commit it.
> > 
> > That's because the NativeThread priority must be specified on create.
> > That means we need one java.util.concurrent.Executor for each priority.
> > I can't find a (clean) way to keep the number of thread in thread limit.
> 
> We can keep the Ticker interface, don't expose the Executors... and add
> a counter.

I don't follow, what are you trying to achieve here? We don't have a hard 
limit, we can't have a hard limit ...
> 
> Btw, what's the reason why the callbacks have to be executed serially?

To reduce the load resulting from a key being found. Of course, persistent 
requests (on the database branch) do need to be called serially anyway.

Attachment: pgpQMJw5kS7M8.pgp
Description: PGP signature

_______________________________________________
Devl mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to