Hi Sir,

I found there was thread leak when do add/remove/nodify/rename entry in this 
class.


The method name is as following:
private void fire( final OperationContext opContext, EventType type, final 
DirectoryListener listener )
    {
        switch ( type )
        {
            case ADD:
                if ( listener.isSynchronous() )
                {
                    listener.entryAdded( ( AddOperationContext ) opContext );
                }
                else
                {
                    executor.execute( new Runnable()
                    {
                        public void run()
                        {
                            listener.entryAdded( ( AddOperationContext ) 
opContext );
                        }
                    } );
                }

                break;

            case DELETE:
                if ( listener.isSynchronous() )
                {
                    listener.entryDeleted( ( DeleteOperationContext ) opContext 
);
                }
                else
                {
                    executor.execute( new Runnable()
                    {
                        public void run()
                        {
                            listener.entryDeleted( ( DeleteOperationContext ) 
opContext );
                        }
                    } );
                }

                break;

            case MODIFY:
                if ( listener.isSynchronous() )
                {
                    listener.entryModified( ( ModifyOperationContext ) 
opContext );
                }
                else
                {
                    executor.execute( new Runnable()
                    {
                        public void run()
                        {
                            listener.entryModified( ( ModifyOperationContext ) 
opContext );
                        }
                    } );
                }

                break;

            case MOVE:
                if ( listener.isSynchronous() )
                {
                    listener.entryMoved( ( MoveOperationContext ) opContext );
                }
                else
                {
                    executor.execute( new Runnable()
                    {
                        public void run()
                        {
                            listener.entryMoved( ( MoveOperationContext ) 
opContext );
                        }
                    } );
                }

                break;

            case RENAME:
                if ( listener.isSynchronous() )
                {
                    listener.entryRenamed( ( RenameOperationContext ) opContext 
);
                }
                else
                {
                    executor.execute( new Runnable()
                    {
                        public void run()
                        {
                            listener.entryRenamed( ( RenameOperationContext ) 
opContext );
                        }
                    } );
                }

                break;

            case MOVE_AND_RENAME:
                if ( listener.isSynchronous() )
                {
                    listener.entryMovedAndRenamed( ( 
MoveAndRenameOperationContext ) opContext );
                }
                else
                {
                    executor.execute( new Runnable()
                    {
                        public void run()
                        {
                            listener.entryMovedAndRenamed( ( 
MoveAndRenameOperationContext ) opContext );
                        }
                    } );
                }

                break;
        }
}


The thread named as my snapshot:
[cid:[email protected]]

This thread always alive when I integrated the apacheds into my application. 
Even I called ApacheDsService's stop method in my application.

Any suggestion will be great!


Thanks,
Hai



Attachment: EventInterceptor.java
Description: EventInterceptor.java

Reply via email to