Domanda

What happens if an exception is thrown between next() and publish() when using Disruptor or publish() does not get called for some other reason or in acceptable time?

What are recovery / time out techniques to handle such cases?

È stato utile?

Soluzione

Within the Disruptor it self calls to publish are in finally blocks to ensure that they are always called. for example Disruptor.java#1017-1027

As publish marks the slot as available to event handlers they will stall until the call to publish happens.

The recovery strategy is don't break it ;) That is there is no need or point in claiming your slot until you are ready to use it and always call publish. You possibly need some sort of error marker to go in the slot if you don't want to publish the data you've claimed the slot for.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top