Quartz JobKey source of interpretation

First, we look at the last Bowen (CronTrigger Example 2, part of the contents of the log print)

[INFO] 17 一月 09:41:40.016 下午 MyScheduler_Worker-9 [com.example03.SimpleJob]
SimpleJob says: group1.job1 executing at Fri Jan 17 21:41:40 CST 2020

See group1.job1 yet, it was printed by the following code.

Jobkey print content is   group1.job1.  

Let's take a look at the source content JobKey 

public final class JobKey extends Key<JobKey> {

    private static final long serialVersionUID = -6073883950062574010L;
    
    public JobKey(String name) {
        super(name, null);
    }

    public JobKey(String name, String group) {
        super(name, group);
    }

    public static JobKey jobKey(String name) {
        return new JobKey(name, null);
    }
    
    public static JobKey jobKey(String name, String group) {
        return new JobKey(name, group);
    }

}

It inherits the Key interfaces, which has a toString method, thus, be aware of the contents of jobKey.

   /**
     * <p>
     * Return the string representation of the key. The format will be:
     * &lt;group&gt;.&lt;name&gt;.
     * </p>
     * 
     * @return the string representation of the key
     */
    @Override
    public String toString() {
        return getGroup() + '.' + getName();
    }
public class Key<T>  implements Serializable, Comparable<Key<T>> {
  
    private static final long serialVersionUID = -7141167957642391350L;

    /**
     * The default group for scheduling entities, with the value "DEFAULT".
     */
    public static final String DEFAULT_GROUP = "DEFAULT";

    private final String name;
    private final String group;
    

As can be seen from the above code fragment, the default group for Job name "DEFAULT".

 

 

He published 192 original articles · won praise 254 · views 760 000 +

Guess you like

Origin blog.csdn.net/yulei_qq/article/details/104026098