oops forgot to attach the TimeScheduler implementation that worked for me.
Harmeet
----- Original Message -----
From: "Harmeet Bedi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, March 21, 2001 1:58 AM
Subject: possible problem with scheduler.
> Test Done.
> ========
> 1.
> Hit refresh repeatedly in Outlook express Email Client. This exercised the
> POP3 Server. The mail client indicated error in a random mannner but
> frequently.
> 2. Wrote automated test to stess and relibly reproduce POP Server problem.
> Here is the test.
> --------------------------------------
> from poplib import POP3
> import thread
> from java.lang import Thread
> def multipop(thread_count=1,seq=3):
> if thread_count == 1:
> for i in range(seq):
> print Thread.currentThread().getName(),i
> pop()
> else:
> for i in range(thread_count):
> thread.start_new_thread(mpop,(1,seq))
>
> def pop(server='localhost',userid='harmeet',password='harmeet'):
> a = POP3(server)
> print a.getwelcome()
> a.user(userid)
> a.pass_(password)
> a.list()
> (numMsgs, totalSize) = a.stat()
> for i in range(1, numMsgs + 1):
> (header, msg, octets) = a.retr(i)
> print "Message ", `i`, ':'
> for line in msg:
> print ' ' + line
> print '-----------------------'
> a.quit()
> --------------------------------------------------------
>
> ran this test as
> // hit pop server with 1 thread, each thread making 3 requests
> pop()
> // hit pop server with 5 threads, each thread making 5 requests
> pop(5,5)
> // hit pop server with 10 threads, each thread making 10 requests
> pop(10,10)
>
> Test Result
> ========
> Got error response back. Modified code to dump stack trace.
> Here are the interesting stack traces.
> -----------------------------------------
> java.lang.ArrayIndexOutOfBoundsException
> at
org.apache.avalon.util.BinaryHeap.percolateUpMinHeap(BinaryHeap.java:209)
> at org.apache.avalon.util.BinaryHeap.insert(BinaryHeap.java:88)
> at
>
org.apache.cornerstone.blocks.scheduler.DefaultTimeScheduler.rescheduleEntry
> (DefaultTimeScheduler.java:130)
> at
>
org.apache.cornerstone.blocks.scheduler.DefaultTimeScheduler.resetTrigger(De
> faultTimeScheduler.java:101)
> at
>
org.apache.james.pop3server.POP3Handler.handleConnection(POP3Handler.java:15
> 0)
> at
>
org.apache.cornerstone.blocks.connection.ConnectionRunner.run(Connection.jav
> a:128)
> at org.apache.avalon.util.thread.WorkerThread.run(WorkerThread.java:76)
>
> not as frequently, but this was another stack trace
> java.lang.NullPointerException
> at
>
org.apache.cornerstone.blocks.scheduler.TimeScheduledEntry.compareTo(TimeSch
> eduledEntry.java:106)
> at
org.apache.avalon.util.BinaryHeap.percolateUpMinHeap(BinaryHeap.java:212)
> at org.apache.avalon.util.BinaryHeap.insert(BinaryHeap.java:88)
> at
>
org.apache.cornerstone.blocks.scheduler.DefaultTimeScheduler.rescheduleEntry
> (DefaultTimeScheduler.java:130)
> at
>
org.apache.cornerstone.blocks.scheduler.DefaultTimeScheduler.addTrigger(Defa
> ultTimeScheduler.java:69)
> at
>
org.apache.james.pop3server.POP3Handler.handleConnection(POP3Handler.java:14
> 5)
> at
>
org.apache.cornerstone.blocks.connection.ConnectionRunner.run(Connection.jav
> a:128)
> at org.apache.avalon.util.thread.WorkerThread.run(WorkerThread.java:76)
> ----------------------------
>
> These stack traces don't occur if there is a gap in client requests or in
a
> single client request. To me this indicates potential problems with
> DefaultTimeScheduler. Has anyone seen such traces.
>
> My code is a few days old, but I did get the latest code and compare the
> changes. Did not upgrade. There seem to be inconsistency between Avalon
and
> James codebase.
>
>
> What Worked
> ==========
> Wrote a new implementation of scheduler service. This implementation
seemed
> to work. The tests above worked. :-)
> I am attaching the service for your review.
> There are some issues with it.
> 1. It is based on JDK 1.3 java.util.Timer class. I think the server side
> code should be able to choose the environment, but this argument may not
> work for all. The JDK Timer based mechanism is similar(maybe derived) to
> TimeDaemon class from Doug Lea's util.concurrent package. So it would be
> easy to make this backward compatible.
> 2. The service assumes that TimerTrigger is of type PeriodicTimeTrigger. I
> found that this is the only trigger usedin the current Avalon and James
> codebase, except in tests.Needed to add these methods to PeriodicTimer to
> covert to JDK/Doug Lea type schedule manager.
> public long getStartTime()
> {
> return m_startTime;
> }
>
> public long getPeriod()
> {
> return m_period;
> }
>
> What are your thoughts. Have you seen simialar problems with scheduler.
The
> JDK/Doug Lea Trigger mechanism is very different from Avalon. Should
Avalon
> move and potentially reuse their model ?
>
> Harmeet
> P.S: Request - I would appreciate if someone adds the modifications to
> PeriodicTimer. This solves a relibility problem for me. The changes to
> PeriodicTimer would allow me to plugin into the current codebase cleanly.
> - thanks.
>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
TimeSchedulerImpl.java
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]