可用版本:Dev (3.21) | 最新 (3.20) | 3.19 | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12

监听器调用顺序

适用于 ✅ 开源版   ✅ 专业版   ✅ 企业版

jOOQ 在 Configuration 对象中提供了各种 SPI。 其中一些 SPI 是事件监听器,可以监听“start”和“end”事件,例如 ExecuteListener,它监听查询执行生命周期。

当注册一个类型的多个监听器时,调用顺序可能很重要,因为自定义监听器可能会相互通信。 在这种情况下,以下设置允许覆盖每种类型的监听器的“start”和“end”事件的调用顺序

示例配置

Settings settings = new Settings()
    .withTransactionListenerStartInvocationOrder(DEFAULT) // Defaults to DEFAULT
    .withTransactionListenerEndInvocationOrder(REVERSE)   // Defaults to DEFAULT
    .withVisitListenerStartInvocationOrder(DEFAULT)       // Defaults to DEFAULT
    .withVisitListenerEndInvocationOrder(REVERSE)         // Defaults to DEFAULT
    .withRecordListenerStartInvocationOrder(DEFAULT)      // Defaults to DEFAULT
    .withRecordListenerEndInvocationOrder(REVERSE)        // Defaults to DEFAULT
    .withExecuteListenerStartInvocationOrder(DEFAULT)     // Defaults to DEFAULT
    .withExecuteListenerEndInvocationOrder(REVERSE);      // Defaults to DEFAULT

反馈

您对此页面有任何反馈吗? 我们很乐意听到您的意见!

The jOOQ Logo