O.K. thx Meeraj. I commented out the test cases so whenever you get a chance, it would be much appreciated.

Jim


On Jul 24, 2006, at 8:47 AM, Meeraj Kunnumpurath wrote:

Jim,

I think it is an implementation issue in the ThreadPoolWorkManager
itself. With the current implementation, it is likely for workStarted to
be called before the workAccepted event.

01    public WorkItem schedule(Work work, WorkListener workListener)
throws WorkRejectedException {
02
03        DefaultWorkItem workItem = new DefaultWorkItem(new
UID().toString(), work);
04        if (scheduleWork(work, workItem)) {
05          if (workListener != null) {
06              workItems.put(workItem, workListener);
07          }
08          workAccepted(workItem, work);
09          return workItem;
10        } else {
11            workItem.setStatus(WorkEvent.WORK_REJECTED);
12            if (workListener != null) {
13                workListener.workRejected(new
DefaultWorkEvent(workItem));
14            }
15            throw new WorkRejectedException("Unable to schedule
work");
16      }
17    }
18
19    private boolean scheduleWork(final Work work, final
DefaultWorkItem workItem) {
20        try {
21          executor.execute(new DecoratingWork(workItem, work));
22          return true;
23        } catch (RejectedExecutionException ex) {
24            return false;
25        }
26    }

In the snippet above the executor may start executing the runnable
before line 8 is executed. A fix could be to call workAccepted in the
decorated work just before workStarted in the same thread.

I am checking out the latest source. I will have a closer look and
submit a patch by tonight or tomorrow morning.

Ta
Meeraj



-----Original Message-----
From: Jim Marino [mailto:[EMAIL PROTECTED]
Sent: 24 July 2006 16:21
To: [email protected]
Subject: Re: Java core test case failures?

O.K. the easiest thing I think to do is what Jeremy mentioned and stub
out the Executor since this is going to cause issues on different
machines. I've commented out the test cases for now and I'll go back in
later and stub out the Executor.

Jim



On Jul 24, 2006, at 8:15 AM, Ignacio Silva-Lepe wrote:

I was seeing a similar error as Rick, I updated and picked up the fix
and now I see the following error, after which the build hangs
(suspecting a deadlock now):

[surefire] Running
org.apache.tuscany.core.services.work.jsr237.Jsr237WorkSchedu
lerTestCase
[surefire] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 0.01
sec [surefire]

Exception in thread "pool-8-thread-1" java.lang.AssertionError:
 Unexpected method call workStarted
(org.apache.tuscany.core.services.work.jsr23
[EMAIL PROTECTED]):
   workAccepted(isA(commonj.work.WorkEvent)): expected: 1, actual: 0
       at org.easymock.internal.MockInvocationHandler.invoke
(MockInvocationHand
ler.java:29)
       at org.easymock.internal.ObjectMethodsFilter.invoke
(ObjectMethodsFilter.
java:45)
       at $Proxy50.workStarted(Unknown Source)
       at
org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWo
rkManager.workStarted(ThreadPoolWorkManager.java:140)
       at
org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWo
rkManager.access$100(ThreadPoolWorkManager.java:45)
       at
org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWo
rkManager$DecoratingWork.run(ThreadPoolWorkManager.java:201)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask
(ThreadPoolExec
utor.java:650)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor
.java:675)
       at java.lang.Thread.run(Thread.java:595)



----- Original Message ----- From: "Jim Marino"
<[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, July 24, 2006 11:00 AM
Subject: Re: Java core test case failures?


Yea it is. I just checked in a fix. Please let me know if it works on

your machine, Rick.

Jim

On Jul 24, 2006, at 7:48 AM, Jeremy Boynes wrote:

On Jul 24, 2006, at 7:30 AM, Rick wrote:
testSchedule
(org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPo o
lW orkManagerTestCase)  Time elapsed: 0 sec  <<< ERROR!
java.lang.AssertionError:
 Expectation failure on verify:
   run(): expected: 1, actual: 0
   at org.easymock.internal.MocksControl.verify
(MocksControl.java:71)
   at org.easymock.EasyMock.verify(EasyMock.java:1306)
   at
org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoo l
Wo rkManagerTestCase.testSchedule
(ThreadPoolWorkManagerTestCase.java:25)


This looks like a basic race condition in the testcase. Perhaps we
should add a constructor to ThreadPoolWorkManager that allows the
Executor to be mocked.

--
Jeremy


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


This message has been checked for all email viruses by MessageLabs.




*****************************************************

    You can find us at www.voca.com

*****************************************************
This communication is confidential and intended for
the exclusive use of the addressee only. You should
not disclose its contents to any other person.
If you are not the intended recipient please notify
the sender named above immediately.

Registered in England, No 1023742,
Registered Office: Voca Limited
Drake House, Three Rivers Court,
Homestead Road, Rickmansworth,
Hertfordshire, WD3 1FX


This message has been checked for all email viruses by MessageLabs.

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