Hi,
The ProcessEventsRunnable also doesnt process event in sequence:
because the processEvent method call is outside the synch part :
public void run()
{
while( true )
{
Event event;
synchronized( buffer.eventQueue )
{
if( buffer.eventQueue.isEmpty() )
{
buffer.processingCompleted = true;
break;
}
event = ( Event ) buffer.eventQueue.remove( 0 );
}
processEvent( event.getNextFilter(), buffer.session,
event.getType(), event.getData() );
}
if ( logger.isDebugEnabled() ) {
logger.debug( "Exiting since queue is empty for " +
buffer.session.getRemoteAddress() );
}
}
Marcin Waldowski-2 wrote:
>
> Haviv wrote:
>> Hi Trustin,
>>
>> Where in the code you see that "ExecutorFilter ensures that two threads
>> don't handle the same session".
>> You have said that before and I didn't understand it.
>> Looking at the ExecutorFilter(version 1.0.1) fireEvent method :
>> private void fireEvent(...)
>> {
>> Event event = new Event( type, nextFilter, data );
>> SessionBuffer buf = SessionBuffer.getSessionBuffer( session );
>>
>> synchronized( buf.eventQueue )
>> {
>> buf.eventQueue.add( event );
>> if( buf.processingCompleted )
>> {
>> buf.processingCompleted = false;
>> if ( logger.isDebugEnabled() ) {
>> logger.debug( "Launching thread for " +
>> session.getRemoteAddress() );
>> }
>>
>> executor.execute( new ProcessEventsRunnable( buf ) );
>> }
>> }
>> }
>>
>> There is a synch part but it synchronizes the executor.execute
>> method(which
>> just adds the ProcessEventsRunnable to its workQueue) and not the
>> execution
>> of the ProcessEventsRunnable itself.
>> Am I missing something ?
>>
>>
>>
>>
>
> Hi Haviv.
>
> Look at ProcessEventsRunnable class. It process event in sequence. Look
> at ExecutorFilter fireEvent() method. It ensures that only one
> ProcessEventRunnable instance can be executed by executor for one session.
>
> Did you applay patches from http://tinyurl.com/2gldgx ? Did you check if
> this solves your issue?
>
> Regards, Marcin
>
>
>
--
View this message in context:
http://www.nabble.com/CumulativeProtocolDecoder-BUG---tf3466819.html#a9728766
Sent from the mina dev mailing list archive at Nabble.com.