@ -28,7 +28,6 @@ import org.quartz.impl.triggers.SimpleTriggerImpl;
@@ -28,7 +28,6 @@ import org.quartz.impl.triggers.SimpleTriggerImpl;
import org.springframework.beans.factory.BeanNameAware ;
import org.springframework.beans.factory.FactoryBean ;
import org.springframework.beans.factory.InitializingBean ;
import org.springframework.core.Constants ;
import org.springframework.lang.Nullable ;
import org.springframework.util.Assert ;
@ -46,6 +45,7 @@ import org.springframework.util.Assert;
@@ -46,6 +45,7 @@ import org.springframework.util.Assert;
* instead of registering the JobDetail separately .
*
* @author Juergen Hoeller
* @author Sam Brannen
* @since 3 . 1
* @see # setName
* @see # setGroup
@ -56,9 +56,26 @@ import org.springframework.util.Assert;
@@ -56,9 +56,26 @@ import org.springframework.util.Assert;
* /
public class SimpleTriggerFactoryBean implements FactoryBean < SimpleTrigger > , BeanNameAware , InitializingBean {
/** Constants for the SimpleTrigger class. */
private static final Constants constants = new Constants ( SimpleTrigger . class ) ;
/ * *
* Map of constant names to constant values for the misfire instruction constants
* defined in { @link org . quartz . Trigger } and { @link org . quartz . SimpleTrigger } .
* /
private static final Map < String , Integer > constants = Map . of (
"MISFIRE_INSTRUCTION_SMART_POLICY" ,
SimpleTrigger . MISFIRE_INSTRUCTION_SMART_POLICY ,
"MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY" ,
SimpleTrigger . MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY ,
"MISFIRE_INSTRUCTION_FIRE_NOW" ,
SimpleTrigger . MISFIRE_INSTRUCTION_FIRE_NOW ,
"MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT" ,
SimpleTrigger . MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT ,
"MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT" ,
SimpleTrigger . MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT ,
"MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT" ,
SimpleTrigger . MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT ,
"MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT" ,
SimpleTrigger . MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT
) ;
@Nullable
private String name ;
@ -204,7 +221,10 @@ public class SimpleTriggerFactoryBean implements FactoryBean<SimpleTrigger>, Bea
@@ -204,7 +221,10 @@ public class SimpleTriggerFactoryBean implements FactoryBean<SimpleTrigger>, Bea
* @see org . quartz . SimpleTrigger # MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT
* /
public void setMisfireInstructionName ( String constantName ) {
this . misfireInstruction = constants . asNumber ( constantName ) . intValue ( ) ;
Assert . hasText ( constantName , "'constantName' must not be null or blank" ) ;
Integer misfireInstruction = constants . get ( constantName ) ;
Assert . notNull ( misfireInstruction , "Only misfire instruction constants allowed" ) ;
this . misfireInstruction = misfireInstruction ;
}
/ * *