Yes, When we create SequencedEvents, only FOCUS_LAST+1 ids are pushed to the queue, but no event with FOCUS_LAST+2 are pushed. The order(creation) is maintained by having a static List. There is only one public constructor for SequencedEvents, and it always creates with FOCUS_LAST + 1 as the id for all the events. So, there is no event with FOCUS_LAST + 2 being pushed in the context of a SequencedEvent.,
Also, looking at the logic of the code, what we are saying is that all the SequencedEvents should be processed before any other events in the event queue. Thanks to Sergey for pointing this one out. My test case already contains two app contexts, and I have posted events on both, creating a dependency between them. Let me know if you want me to add more app contexts. Thanks, Krishna -----Original Message----- From: Semyon Sadetsky Sent: Thursday, March 15, 2018 10:48 PM To: Krishna Addepalli <krishna.addepa...@oracle.com>; awt-dev@openjdk.java.net Subject: Re: <AWT Dev> [11][JDK-8152974] AWT hang occurs when sequenced events On 03/15/2018 10:11 AM, Krishna Addepalli wrote: > If no such event is posted to the queue, it will lead to hang right? Are you sure that the root cause is that there are no such event? I think the event is enqueued but its order is wrong. The test to the fix must contain several application contexts because this mechanism provides synchronization between contexts. --Semyon > And also, the correct order of processing is not by the event number, but > rather by the condition check to see if the current event is the first event > in the separate list maintained for SequencedEvents. > Just repeating it for reference: > "edt.pumpEvents(ID, () -> !SequencedEvent.this.isFirstOrDisposed());" > > Thanks, > Krishna > > -----Original Message----- > From: Semyon Sadetsky > Sent: Thursday, March 15, 2018 10:36 PM > To: Krishna Addepalli <krishna.addepa...@oracle.com>; > awt-dev@openjdk.java.net > Subject: Re: <AWT Dev> [11][JDK-8152974] AWT hang occurs when > sequenced events > > On 03/15/2018 09:59 AM, Krishna Addepalli wrote: > >> Hi Semyon, >> >> SequencedEvent is created with FOCUS_LAST + 1 as its id, whereas when it is >> dispatching events, it is looking for FOCUS_LAST + 2, which is causing the >> hang. > I think it correctly waits for FOCUS_LAST + 2 to guaranty the right order of > processing in which the sequenced event is first processed on another EDT. > --Semyon >> I have modified it to look for only FOCUS_LAST + 1 events, which has fixed >> the problem. >> >> Thanks, >> Krishna >> >> -----Original Message----- >> From: Semyon Sadetsky >> Sent: Thursday, March 15, 2018 9:14 PM >> To: Krishna Addepalli <krishna.addepa...@oracle.com>; >> awt-dev@openjdk.java.net >> Subject: Re: <AWT Dev> [11][JDK-8152974] AWT hang occurs when >> sequenced events >> >> Hi Krishna, >> >> You have replaced FOCUS_LAST+2 with the FOCUS_LAST+1 which is absolutely >> different event. >> >> They can be used interchangeably? >> >> --Semyon >> >> >> On 03/14/2018 07:53 AM, Krishna Addepalli wrote: >>> Hi Sergey, >>> >>> As per our discussion, I have modified the fix to process only >>> SequencedEvents and ignore others. I have also modified the test case to >>> include some dummy events between two SequencedEvents, and it works. >>> Here is the new webrev: >>> http://cr.openjdk.java.net/~kaddepalli/8152974/webrev01/ >>> >>> However, could you point me to a doc/spec which says that all the >>> SequencedEvents have to be processed together, even if other events in the >>> queue have arrived before? >>> >>> Thanks, >>> Krishna >>> >>> -----Original Message----- >>> From: Krishna Addepalli >>> Sent: Saturday, February 17, 2018 7:57 AM >>> To: Sergey Bylokhov <sergey.bylok...@oracle.com>; >>> awt-dev@openjdk.java.net; Semyon Sadetsky >>> <semyon.sadet...@oracle.com> >>> Subject: RE: <AWT Dev> [11][JDK-8152974] AWT hang occurs when >>> sequenced events >>> >>> Hi Sergey, >>> >>> The event is present, but with the id >>> "java.awt.event.FocusEvent.FOCUS_LAST+1", whereas when it is pumping the >>> events, it is looking for "java.awt.event.FocusEvent.FOCUS_LAST+2", which >>> is not in the queue. >>> >>> Thanks, >>> Krishna >>> >>> -----Original Message----- >>> From: Sergey Bylokhov >>> Sent: Saturday, February 17, 2018 1:49 AM >>> To: Krishna Addepalli <krishna.addepa...@oracle.com>; >>> awt-dev@openjdk.java.net; Semyon Sadetsky >>> <semyon.sadet...@oracle.com> >>> Subject: Re: <AWT Dev> [11][JDK-8152974] AWT hang occurs when >>> sequenced events >>> >>> Hi, Krishna. >>> On 16/02/2018 00:42, Krishna Addepalli wrote: >>>> The SentEvent.ID value is "java.awt.event.FocusEvent.FOCUS_LAST+2", and >>>> when in the function pumpOneEventForFilters, it tries to call >>>> EventQueue.getNextEvent(id), it looks for SentEvent.ID, which is not >>>> present, and then the queue blocks in the hope that someone will post that >>>> event. This is what is leading to the hang. >>> But both events are posted by the test, why the second event is not present >>> in the queue? >>> >>>