当前位置:网站首页>Disruptor local thread queue_ Workprocessor exception_ Fatalexceptionhandler--- inter thread communication work note 004

Disruptor local thread queue_ Workprocessor exception_ Fatalexceptionhandler--- inter thread communication work note 004

2022-06-21 16:55:00 Brain cooling

In the use of disruptor In the process of ,disruptor The queue occasionally reports an error , That's it :

_FatalExceptionHandler Such mistake , Actually :

stay disruptor in , It encapsulates the exception : You can look at the source code , We know

stay disruptor The worker thread in is com.lmax.disruptor.WorkProcessor#run In this method ,

You can see that there is a try ,catch, You can see that after the exception is caught ,

Here we use exceptionHandler.handleEventException What we deal with here is , and :handleEventException This method

The end result of the call is actually ,exceptionHandler Methods in the implementation class :

            catch (final Throwable ex)
            {
                // handle, mark as processed, unless the exception handler threw an exception
                exceptionHandler.handleEventException(ex, nextSequence, event);
                processedSequence = true;
            }

You can see the source code :ExceptionHandler Implementation class of com.lmax.disruptor.FatalExceptionHandler, its com.lmax.disruptor.FatalExceptionHandler#handleEventException The method is as follows :

    @Override
    public void handleEventException(final Throwable ex, final long sequence, final Object event)
原网站

版权声明
本文为[Brain cooling]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/172/202206211312517066.html