public OperableTrigger retrieveTrigger ( TriggerKey triggerKey , T jedis ) throws JobPersistenceException { final String triggerHashKey = redisSchema . triggerHashKey ( triggerKey ) ; Map < String , String > triggerMap = jedis . hgetAll ( triggerHashKey ) ; if ( triggerMap == null || triggerMap . isEmpty ( ) ) { logger . debug ( String . format ( "No trigger exists for key %s" , triggerHashKey ) ) ; return null ; } Class triggerClass ; try { triggerClass = Class . forName ( triggerMap . get ( TRIGGER_CLASS ) ) ; } catch ( ClassNotFoundException e ) { throw new JobPersistenceException ( String . format ( "Could not find class %s for trigger." , triggerMap . get ( TRIGGER_CLASS ) ) , e ) ; } triggerMap . remove ( TRIGGER_CLASS ) ; OperableTrigger operableTrigger = ( OperableTrigger ) mapper . convertValue ( triggerMap , triggerClass ) ; operableTrigger . setFireInstanceId ( schedulerInstanceId + "-" + operableTrigger . getKey ( ) + "-" + operableTrigger . getStartTime ( ) . getTime ( ) ) ; final Map < String , String > jobData = jedis . hgetAll ( redisSchema . triggerDataMapHashKey ( triggerKey ) ) ; if ( jobData != null && ! jobData . isEmpty ( ) ) { JobDataMap jobDataMap = new JobDataMap ( ) ; jobDataMap . putAll ( jobData ) ; operableTrigger . setJobDataMap ( jobDataMap ) ; } return operableTrigger ; }
Retrieve a trigger from Redis