国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

SpringCloud(第 054 篇)簡單 Quartz-Cluster 微服務(wù),采用注解配置 Q

isLishude / 1765人閱讀

摘要:加載配置文件失敗加載配置文件失敗添加定時調(diào)度任務(wù)定時調(diào)度任務(wù)添加定時調(diào)度任務(wù)定時調(diào)度任務(wù)執(zhí)行的張表入數(shù)據(jù)庫添加啟動類簡單微服務(wù),采用注解配置分布式集群。

SpringCloud(第 054 篇)簡單 Quartz-Cluster 微服務(wù),采用注解配置 Quartz 分布式集群

-

一、大致介紹
1、因網(wǎng)友提到有沒有采用注解式配置的Quartz例子,因此本人就貼上了這樣一個樣例;
2、至于如何修改定時任務(wù)的 cronExpression 表達(dá)式值的話,大家可以參照之前的(第 010 篇)樣子看看如何修改;

3、注意:配置文件中的 mysql 數(shù)據(jù)庫鏈接配置大家就各自配置自己的哈;
二、實(shí)現(xiàn)步驟 2.1 添加 maven 引用包


    4.0.0

    springms-simple-quartz-config-cluster
    1.0-SNAPSHOT
    jar
    
    
        com.springms.cloud
        springms-spring-cloud
        1.0-SNAPSHOT
    
    
    
        
        
            org.springframework.boot
            spring-boot-starter-data-jpa
        

        
        
            org.springframework.boot
            spring-boot-starter-web
        

        
        
            mysql
            mysql-connector-java
        

        
        
            org.springframework.boot
            spring-boot-starter-jdbc
        
               
        
        
            org.quartz-scheduler
            quartz
            2.3.0
        
        
            org.quartz-scheduler
            quartz-jobs
            2.3.0
        
        
            org.springframework
            spring-context-support
        

        
        
            com.alibaba
            druid
            1.1.3
        
    


2.2 添加應(yīng)用配置文件(springms-simple-quartz-config-clustersrcmainresourcesapplication.yml)
server:
  port: 8405
spring:
  application:
    name: springms-simple-quartz-config-cluster  #全部小寫


#####################################################################################################
# mysql 屬性配置
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://ip:3306/hmilyylimh?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true
    username: username
    password: password
  jpa:
    hibernate:
      #ddl-auto: create #ddl-auto:設(shè)為create表示每次都重新建表
      ddl-auto: update #ddl-auto:設(shè)為update表示每次都不會重新建表
    show-sql: true
#####################################################################################################







#####################################################################################################
# 打印日志
logging:
  level:
    root: INFO
    org.hibernate: INFO
    org.hibernate.type.descriptor.sql.BasicBinder: TRACE
    org.hibernate.type.descriptor.sql.BasicExtractor: TRACE
    com.springms: DEBUG
#####################################################################################################
2.3 添加 quartz 配置文件(springms-simple-quartz-config-cluster/src/main/resources/quartz.properties)
org.quartz.scheduler.instanceName = quartzScheduler  
org.quartz.scheduler.instanceId = AUTO  


org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX  
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.tablePrefix = QRTZ_  
org.quartz.jobStore.isClustered = true  
org.quartz.jobStore.useProperties = false
org.quartz.jobStore.clusterCheckinInterval = 20000    


org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool  
org.quartz.threadPool.threadCount = 10  
org.quartz.threadPool.threadPriority = 5  
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true
2.4 添加數(shù)據(jù)源配置類(springms-simple-quartz-config-clustersrcmainjavacomspringmscloudconfigDataSourceConfig.java)
package com.springms.cloud.config;

import org.apache.tomcat.jdbc.pool.DataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import javax.annotation.Resource;

/**
 * 數(shù)據(jù)源配置。
 *
 * @author hmilyylimh
 *
 * @version 0.0.1
 *
 * @date 2017/12/17
 *
 */
@Configuration
public class DataSourceConfig {

    @Resource
    private Environment env;

    @Bean
    public DataSource dataSource(){
        DataSource configDataSource = new DataSource();
        configDataSource.setUrl("jdbc:mysql://ip:3306/hmilyylimh?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true");
        configDataSource.setDriverClassName("com.mysql.jdbc.Driver");
        configDataSource.setUsername("username");
        configDataSource.setPassword("password");
        configDataSource.setInitialSize(5);
        configDataSource.setDefaultAutoCommit(true);

        if(configDataSource.getUrl().startsWith("jdbc:mysql://ip")){
            throw new RuntimeException("請配置數(shù)據(jù)源地址");
        }
        if(configDataSource.getUsername().startsWith("username")){
            throw new RuntimeException("請配置數(shù)據(jù)源用戶名");
        }
        if(configDataSource.getPassword().startsWith("password")){
            throw new RuntimeException("請配置數(shù)據(jù)源密碼");
        }

        // 這些配置看個人需要,需要的話可以全部配置起來,我這里寫Demo的話就沒有全部配置起來了
        //configDataSource.setInitialSize();
        //configDataSource.setMinEvictableIdleTimeMillis();
        //configDataSource.setNumTestsPerEvictionRun();
        //configDataSource.setTestWhileIdle();
        //configDataSource.setMaxActive();
        //configDataSource.setMaxIdle();
        //configDataSource.setMinIdle();
        //configDataSource.setMaxWait();
        //configDataSource.setRemoveAbandoned();
        //configDataSource.setRemoveAbandonedTimeout();
        //configDataSource.setValidationQuery();
        //configDataSource.setValidationQueryTimeout();
        //configDataSource.setValidationInterval();
        //configDataSource.setTimeBetweenEvictionRunsMillis();
        
        return configDataSource;
    }
}
2.5 添加Quartz調(diào)度配置類(springms-simple-quartz-config-clustersrcmainjavacomspringmscloudconfigQuartzSchedulerConfig.java)
package com.springms.cloud.config;

import com.springms.cloud.job.Job1;
import com.springms.cloud.job.Job2;
import org.apache.tomcat.jdbc.pool.DataSource;
import org.quartz.CronTrigger;
import org.quartz.JobDetail;
import org.quartz.spi.JobFactory;
import org.quartz.spi.TriggerFiredBundle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.beans.factory.config.PropertiesFactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
import org.springframework.scheduling.quartz.JobDetailFactoryBean;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.scheduling.quartz.SpringBeanJobFactory;

import java.io.IOException;
import java.util.Properties;

/**
 * Quartz調(diào)度配置類。
 *
 * @author hmilyylimh
 *
 * @version 0.0.1
 *
 * @date 2017/12/17
 *
 */
@Configuration
public class QuartzSchedulerConfig {

    @Autowired
    private DataSource dataSource;

    private static final Logger Logger = LoggerFactory.getLogger(QuartzSchedulerConfig.class);
    private static final String QUARTZ_PROPERTIES_NAME = "/quartz.properties";

    @Bean
    public JobFactory jobFactory(ApplicationContext applicationContext) {
        AutowiringSpringBeanJobFactory jobFactory = new AutowiringSpringBeanJobFactory();
        jobFactory.setApplicationContext(applicationContext);
        return jobFactory;
    }

    @Bean
    public SchedulerFactoryBean schedulerFactoryBean(JobFactory jobFactory, CronTrigger[] cronTrigger, JobDetail[]
            jobDetails) {
        SchedulerFactoryBean factoryBean = new SchedulerFactoryBean();
        try {
            factoryBean.setQuartzProperties(quartzProperties());
            factoryBean.setDataSource(dataSource);
            factoryBean.setJobFactory(jobFactory);
            factoryBean.setTriggers(cronTrigger);
            factoryBean.setJobDetails(jobDetails);
            factoryBean.setOverwriteExistingJobs(true);
        } catch (Exception e) {
            Logger.error("加載 {} 配置文件失敗.", QUARTZ_PROPERTIES_NAME, e);
            throw new RuntimeException("加載配置文件失敗", e);
        }

        return factoryBean;
    }

    @Bean(name = "job1Trigger")
    public CronTriggerFactoryBean job1Trigger(@Qualifier("job1Detail") JobDetail jobDetail) {
        CronTriggerFactoryBean cronTriggerFactoryBean = new CronTriggerFactoryBean();
        cronTriggerFactoryBean.setJobDetail(jobDetail);
        cronTriggerFactoryBean.setCronExpression("0/15 * * * * ?");
        return cronTriggerFactoryBean;
    }

    @Bean(name = "job1Detail")
    public JobDetailFactoryBean job1Detail() {
        JobDetailFactoryBean jobDetailFactoryBean = new JobDetailFactoryBean();
        jobDetailFactoryBean.setJobClass(Job1.class);
        jobDetailFactoryBean.setDurability(true);
        return jobDetailFactoryBean;
    }

    @Bean(name = "job2Trigger")
    public CronTriggerFactoryBean job2Trigger(@Qualifier("job2Detail") JobDetail jobDetail) {
        CronTriggerFactoryBean cronTriggerFactoryBean = new CronTriggerFactoryBean();
        cronTriggerFactoryBean.setJobDetail(jobDetail);
        cronTriggerFactoryBean.setCronExpression("0/5 * * * * ?");
        return cronTriggerFactoryBean;
    }

    @Bean(name = "job2Detail")
    public JobDetailFactoryBean job2Detail() {
        JobDetailFactoryBean jobDetailFactoryBean = new JobDetailFactoryBean();
        jobDetailFactoryBean.setJobClass(Job2.class);
        jobDetailFactoryBean.setDurability(true);
        return jobDetailFactoryBean;
    }

    @Bean
    public Properties quartzProperties() throws IOException {
        PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
        propertiesFactoryBean.setLocation(new ClassPathResource(QUARTZ_PROPERTIES_NAME));
        propertiesFactoryBean.afterPropertiesSet();
        return propertiesFactoryBean.getObject();
    }

    class AutowiringSpringBeanJobFactory extends SpringBeanJobFactory implements ApplicationContextAware {

        private transient AutowireCapableBeanFactory beanFactory;

        @Override
        public void setApplicationContext(final ApplicationContext context) {
            beanFactory = context.getAutowireCapableBeanFactory();
        }

        @Override
        protected Object createJobInstance(final TriggerFiredBundle bundle)
                throws Exception {
            final Object job = super.createJobInstance(bundle);
            beanFactory.autowireBean(job);
            return job;
        }
    }
}
2.6 添加定時調(diào)度任務(wù)Job1(springms-simple-quartz-config-clustersrcmainjavacomspringmscloudjobJob1.java)
package com.springms.cloud.job;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 定時調(diào)度任務(wù)Job1.
 *
 * @author hmilyylimh
 *
 * @version 0.0.1
 *
 * @date 2017/12/17
 *
 */
@Component
public class Job1 extends QuartzJobBean {

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {

        System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
        System.out.println("@@@@@@@@@@@@        "+(new SimpleDateFormat("yyyy-mm-dd HH:mm:ss.SSSSSS")).format(new Date())+"         @@@@@@@@@@@");
        System.out.println("@@@@@@@@@@@@@@@@@@@@@@@        Job1         @@@@@@@@@@@@@@@@@@@@@@");
        System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
        System.out.println();
    }
}
2.7 添加定時調(diào)度任務(wù)Job2(springms-simple-quartz-config-clustersrcmainjavacomspringmscloudjobJob2.java)
package com.springms.cloud.job;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 定時調(diào)度任務(wù)Job2.
 *
 * @author hmilyylimh
 *
 * @version 0.0.1
 *
 * @date 2017/12/17
 *
 */
public class Job2 extends QuartzJobBean {

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        System.out.println("==================================================================");
        System.out.println("===========        "+(new SimpleDateFormat("yyyy-mm-dd HH:mm:ss.SSSSSS")).format(new Date())+"         ============");
        System.out.println("=======================        Job2         ======================");
        System.out.println("==================================================================");
        System.out.println();
    }
}
2.8 執(zhí)行 Quartz 的 11 張表入數(shù)據(jù)庫(springms-simple-quartz-config-cluster/quartz-tables.log)

DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS;
DROP TABLE IF EXISTS QRTZ_SCHEDULER_STATE;
DROP TABLE IF EXISTS QRTZ_LOCKS;
DROP TABLE IF EXISTS QRTZ_SIMPLE_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_SIMPROP_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_CRON_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_BLOB_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_JOB_DETAILS;
DROP TABLE IF EXISTS QRTZ_CALENDARS;


CREATE TABLE QRTZ_JOB_DETAILS
  (
    SCHED_NAME VARCHAR(120) NOT NULL,
    JOB_NAME  VARCHAR(200) NOT NULL,
    JOB_GROUP VARCHAR(200) NOT NULL,
    DESCRIPTION VARCHAR(250) NULL,
    JOB_CLASS_NAME   VARCHAR(250) NOT NULL,
    IS_DURABLE VARCHAR(1) NOT NULL,
    IS_NONCONCURRENT VARCHAR(1) NOT NULL,
    IS_UPDATE_DATA VARCHAR(1) NOT NULL,
    REQUESTS_RECOVERY VARCHAR(1) NOT NULL,
    JOB_DATA BLOB NULL,
    PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
);

CREATE TABLE QRTZ_TRIGGERS
  (
    SCHED_NAME VARCHAR(120) NOT NULL,
    TRIGGER_NAME VARCHAR(200) NOT NULL,
    TRIGGER_GROUP VARCHAR(200) NOT NULL,
    JOB_NAME  VARCHAR(200) NOT NULL,
    JOB_GROUP VARCHAR(200) NOT NULL,
    DESCRIPTION VARCHAR(250) NULL,
    NEXT_FIRE_TIME BIGINT(13) NULL,
    PREV_FIRE_TIME BIGINT(13) NULL,
    PRIORITY INTEGER NULL,
    TRIGGER_STATE VARCHAR(16) NOT NULL,
    TRIGGER_TYPE VARCHAR(8) NOT NULL,
    START_TIME BIGINT(13) NOT NULL,
    END_TIME BIGINT(13) NULL,
    CALENDAR_NAME VARCHAR(200) NULL,
    MISFIRE_INSTR SMALLINT(2) NULL,
    JOB_DATA BLOB NULL,
    PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
    FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
        REFERENCES QRTZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP)
);

CREATE TABLE QRTZ_SIMPLE_TRIGGERS
  (
    SCHED_NAME VARCHAR(120) NOT NULL,
    TRIGGER_NAME VARCHAR(200) NOT NULL,
    TRIGGER_GROUP VARCHAR(200) NOT NULL,
    REPEAT_COUNT BIGINT(7) NOT NULL,
    REPEAT_INTERVAL BIGINT(12) NOT NULL,
    TIMES_TRIGGERED BIGINT(10) NOT NULL,
    PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
    FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
        REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
);

CREATE TABLE QRTZ_CRON_TRIGGERS
  (
    SCHED_NAME VARCHAR(120) NOT NULL,
    TRIGGER_NAME VARCHAR(200) NOT NULL,
    TRIGGER_GROUP VARCHAR(200) NOT NULL,
    CRON_EXPRESSION VARCHAR(200) NOT NULL,
    TIME_ZONE_ID VARCHAR(80),
    PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
    FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
        REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
);

CREATE TABLE QRTZ_SIMPROP_TRIGGERS
  (
    SCHED_NAME VARCHAR(120) NOT NULL,
    TRIGGER_NAME VARCHAR(200) NOT NULL,
    TRIGGER_GROUP VARCHAR(200) NOT NULL,
    STR_PROP_1 VARCHAR(512) NULL,
    STR_PROP_2 VARCHAR(512) NULL,
    STR_PROP_3 VARCHAR(512) NULL,
    INT_PROP_1 INT NULL,
    INT_PROP_2 INT NULL,
    LONG_PROP_1 BIGINT NULL,
    LONG_PROP_2 BIGINT NULL,
    DEC_PROP_1 NUMERIC(13,4) NULL,
    DEC_PROP_2 NUMERIC(13,4) NULL,
    BOOL_PROP_1 VARCHAR(1) NULL,
    BOOL_PROP_2 VARCHAR(1) NULL,
    PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
    FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
    REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
);

CREATE TABLE QRTZ_BLOB_TRIGGERS
  (
    SCHED_NAME VARCHAR(120) NOT NULL,
    TRIGGER_NAME VARCHAR(200) NOT NULL,
    TRIGGER_GROUP VARCHAR(200) NOT NULL,
    BLOB_DATA BLOB NULL,
    PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
    FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
        REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
);

CREATE TABLE QRTZ_CALENDARS
  (
    SCHED_NAME VARCHAR(120) NOT NULL,
    CALENDAR_NAME  VARCHAR(200) NOT NULL,
    CALENDAR BLOB NOT NULL,
    PRIMARY KEY (SCHED_NAME,CALENDAR_NAME)
);

CREATE TABLE QRTZ_PAUSED_TRIGGER_GRPS
  (
    SCHED_NAME VARCHAR(120) NOT NULL,
    TRIGGER_GROUP  VARCHAR(200) NOT NULL,
    PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP)
);

CREATE TABLE QRTZ_FIRED_TRIGGERS
  (
    SCHED_NAME VARCHAR(120) NOT NULL,
    ENTRY_ID VARCHAR(95) NOT NULL,
    TRIGGER_NAME VARCHAR(200) NOT NULL,
    TRIGGER_GROUP VARCHAR(200) NOT NULL,
    INSTANCE_NAME VARCHAR(200) NOT NULL,
    FIRED_TIME BIGINT(13) NOT NULL,
    SCHED_TIME BIGINT(13) NOT NULL,
    PRIORITY INTEGER NOT NULL,
    STATE VARCHAR(16) NOT NULL,
    JOB_NAME VARCHAR(200) NULL,
    JOB_GROUP VARCHAR(200) NULL,
    IS_NONCONCURRENT VARCHAR(1) NULL,
    REQUESTS_RECOVERY VARCHAR(1) NULL,
    PRIMARY KEY (SCHED_NAME,ENTRY_ID)
);

CREATE TABLE QRTZ_SCHEDULER_STATE
  (
    SCHED_NAME VARCHAR(120) NOT NULL,
    INSTANCE_NAME VARCHAR(200) NOT NULL,
    LAST_CHECKIN_TIME BIGINT(13) NOT NULL,
    CHECKIN_INTERVAL BIGINT(13) NOT NULL,
    PRIMARY KEY (SCHED_NAME,INSTANCE_NAME)
);

CREATE TABLE QRTZ_LOCKS
  (
    SCHED_NAME VARCHAR(120) NOT NULL,
    LOCK_NAME  VARCHAR(40) NOT NULL,
    PRIMARY KEY (SCHED_NAME,LOCK_NAME)
);


commit;
2.9 添加 Quartz-Cluster 啟動類(springms-simple-quartz-config-clustersrcmainjavacomspringmscloudSimpleQuartzConfigClusterApplication.java)
package com.springms.cloud;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ImportResource;

/**
 * 簡單 Quartz-Cluster 微服務(wù),采用注解配置 Quartz 分布式集群。
 *
 * @author hmilyylimh
 *
 * @version 0.0.1
 *
 * @date 2017/12/17
 *
 */
@SpringBootApplication
public class SimpleQuartzConfigClusterApplication {

    private static final Logger Logger = LoggerFactory.getLogger(SimpleQuartzConfigClusterApplication.class);

    public static void main(String[] args) {
        SpringApplication.run(SimpleQuartzConfigClusterApplication.class, args);

        System.out.println("【【【【【【 簡單Quartz-Config-Cluster微服務(wù) 】】】】】】已啟動.");
    }
}
三、測試
/****************************************************************************************
 一、簡單 Quartz-Cluster 微服務(wù),采用注解配置 Quartz 分布式集群:

 1、添加 Quartz 相關(guān)配置文件;
 2、啟動 springms-simple-quartz-config-cluster 模塊服務(wù),啟動3個端口(8405、8406、8407);
 3、然后看到 3 臺服務(wù)器只有 1 臺服務(wù)器調(diào)用了 Job1 類中的方法,因此 Quartz 的集群分布式也算是部署成功了;
 4、然后關(guān)閉 1 臺活躍 Quartz 服務(wù)器;
 5、再等一會兒就看到 2 臺服務(wù)器中的 1 臺服務(wù)器每隔一定的時間調(diào)用 Job1 類中的方法;
 ****************************************************************************************/
四、下載地址

https://gitee.com/ylimhhmily/SpringCloudTutorial.git

SpringCloudTutorial交流QQ群: 235322432

SpringCloudTutorial交流微信群: 微信溝通群二維碼圖片鏈接

歡迎關(guān)注,您的肯定是對我最大的支持!!!

文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請注明本文地址:http://specialneedsforspecialkids.com/yun/70837.html

相關(guān)文章

  • SpringCloud 046 注解式Schedule配置定時任務(wù),不支持任務(wù)調(diào)度

    摘要:當(dāng)前時間打印當(dāng)前時間定時任務(wù)觸發(fā),操作多個添加數(shù)據(jù),事務(wù)中任一異常,都可以正常導(dǎo)致數(shù)據(jù)回滾。當(dāng)前時間當(dāng)前時間添加微服務(wù)啟動類注解式配置定時任務(wù),不支持任務(wù)調(diào)度。 SpringCloud(第 046 篇)注解式Schedule配置定時任務(wù),不支持任務(wù)調(diào)度 - 一、大致介紹 1、很多時候我們需要隔一定的時間去執(zhí)行某個任務(wù),為了實(shí)現(xiàn)這樣的需求通常最普通的方式就是利用多線程來實(shí)現(xiàn); 2、但是有...

    masturbator 評論0 收藏0
  • SpringCloud 010 簡單 Quartz-Cluster 支持集群分布式且支持動態(tài)

    摘要:通過再添加其他的元素可在中放置多個觸發(fā)器。停止觸發(fā)器重啟觸發(fā)器停止觸發(fā)器移除觸發(fā)器添加調(diào)度的任務(wù)類調(diào)度的任務(wù)。執(zhí)行的張表入數(shù)據(jù)庫添加啟動類簡單微服務(wù),支持集群分布式,并支持動態(tài)修改任務(wù)的執(zhí)行時間。 SpringCloud(第 010 篇)簡單 Quartz-Cluster 微服務(wù),支持集群分布式,并支持動態(tài)修改 Quartz 任務(wù)的 cronExpression 執(zhí)行時間 - 一、大致...

    xiyang 評論0 收藏0
  • SpringCloud 024 簡單文件上傳服務(wù)加入zuul服務(wù)后用zuul服務(wù)地址實(shí)

    摘要:提供給文件上傳微服務(wù)用的。注意注解能注冊到服務(wù)上,是因?yàn)樵撟⒔獍丝蛻舳说淖⒔猓撌且粋€復(fù)合注解。地址可以查看該微服務(wù)網(wǎng)關(guān)代理了多少微服務(wù)的。 SpringCloud(第 024 篇)簡單文件上傳微服務(wù),并加入 zuul 微服務(wù)后用 zuul 微服務(wù)地址采取curl或者頁面點(diǎn)擊實(shí)現(xiàn)文件上傳 - 一、大致介紹 1、本章節(jié)主要將文件上傳微服務(wù)加入到 zuul 服務(wù)中去,然后利用 zuul...

    Cympros 評論0 收藏0
  • SpringCloud 027 )集成異構(gòu)服務(wù)系統(tǒng)到 SpringCloud 生態(tài)圈中(比如

    摘要:注意注解能注冊到服務(wù)上,是因?yàn)樵撟⒔獍丝蛻舳说淖⒔猓撌且粋€復(fù)合注解。包含了客戶端注解,同時也包含了斷路器模塊注解,還包含了網(wǎng)關(guān)模塊。 SpringCloud(第 027 篇)集成異構(gòu)微服務(wù)系統(tǒng)到 SpringCloud 生態(tài)圈中(比如集成 nodejs 微服務(wù)) - 一、大致介紹 1、在一些稍微復(fù)雜點(diǎn)系統(tǒng)中,往往都不是單一代碼寫的服務(wù),而恰恰相反集成了各種語言寫的系統(tǒng),并且我們還...

    caozhijian 評論0 收藏0

發(fā)表評論

0條評論

最新活動
閱讀需要支付1元查看
<