1616 */
1717package com .helger .pd .indexer .shadow ;
1818
19+ import org .slf4j .Logger ;
20+ import org .slf4j .LoggerFactory ;
21+
1922import com .helger .annotation .style .OverrideOnDemand ;
2023import com .helger .base .enforce .ValueEnforcer ;
2124import com .helger .base .string .StringHelper ;
2629import com .helger .http .CHttp ;
2730import com .helger .pd .indexer .mgr .PDMetaManager ;
2831import com .helger .pd .indexer .settings .PDServerConfiguration ;
29- import com .helger .quartz .*;
32+ import com .helger .quartz .DisallowConcurrentExecution ;
33+ import com .helger .quartz .IJobExecutionContext ;
34+ import com .helger .quartz .JobDataMap ;
35+ import com .helger .quartz .JobExecutionException ;
36+ import com .helger .quartz .SimpleScheduleBuilder ;
37+ import com .helger .quartz .TriggerKey ;
3038import com .helger .schedule .quartz .GlobalQuartzScheduler ;
3139import com .helger .schedule .quartz .trigger .JDK8TriggerBuilder ;
3240import com .helger .servlet .mock .MockHttpServletRequest ;
3341import com .helger .servlet .mock .OfflineHttpServletRequest ;
3442import com .helger .web .scope .mgr .WebScopeManager ;
3543import com .helger .web .scope .util .AbstractScopeAwareJob ;
44+
3645import jakarta .annotation .Nonnull ;
3746import jakarta .servlet .ServletContext ;
38- import org .slf4j .Logger ;
39- import org .slf4j .LoggerFactory ;
4047
4148/**
42- * Quartz job that dispatches pending shadow events from the outbox to the
43- * downstream replicator service. Runs every minute.
49+ * Quartz job that dispatches pending shadow events from the outbox to the downstream replicator
50+ * service. Runs every minute.
4451 * <p>
45- * Events that fail with retryable errors (network issues, 5xx) remain in the
46- * queue for retry. Events that fail with non-retryable errors (4xx) are moved
47- * to the dead-letter queue for manual investigation.
52+ * Events that fail with retryable errors (network issues, 5xx) remain in the queue for retry.
53+ * Events that fail with non-retryable errors (4xx) are moved to the dead-letter queue for manual
54+ * investigation.
4855 * </p>
4956 *
5057 * @author Mikael Aksamit
@@ -69,8 +76,8 @@ protected MockHttpServletRequest createMockHttpServletRequest ()
6976 }
7077
7178 @ Override
72- protected void onExecute (@ Nonnull final JobDataMap aJobDataMap ,
73- @ Nonnull final IJobExecutionContext aContext ) throws JobExecutionException
79+ protected void onExecute (@ Nonnull final JobDataMap aJobDataMap , @ Nonnull final IJobExecutionContext aContext )
80+ throws JobExecutionException
7481 {
7582 if (!PDServerConfiguration .isIndexerShadowingEnabled ())
7683 {
@@ -122,13 +129,15 @@ protected void onExecute (@Nonnull final JobDataMap aJobDataMap,
122129
123130 if (nStatusCode >= CHttp .HTTP_OK && nStatusCode < CHttp .HTTP_MULTIPLE_CHOICES )
124131 {
132+ // 2xx
125133 aEventList .removeEvent (aEvent .getEventID ());
126134 nSuccessCount ++;
127135 LOGGER .info ("Successfully dispatched shadow event " + aEvent .getEventID ());
128136 }
129137 else
130138 if (nStatusCode >= CHttp .HTTP_BAD_REQUEST && nStatusCode < CHttp .HTTP_INTERNAL_SERVER_ERROR )
131139 {
140+ // 4xx
132141 aEventList .removeEvent (aEvent .getEventID ());
133142 aFailedEventList .addFailedEvent ((ShadowEvent ) aEvent );
134143 nNonRetryableFailureCount ++;
@@ -141,11 +150,7 @@ protected void onExecute (@Nonnull final JobDataMap aJobDataMap,
141150 else
142151 {
143152 nRetryableFailureCount ++;
144- LOGGER .warn ("Shadow event " +
145- aEvent .getEventID () +
146- " failed with HTTP " +
147- nStatusCode +
148- " - will retry" );
153+ LOGGER .warn ("Shadow event " + aEvent .getEventID () + " failed with HTTP " + nStatusCode + " - will retry" );
149154 }
150155 }
151156 catch (final Exception ex )
0 commit comments