日本好好热aⅴ|国产99视频精品免费观看|日本成人aV在线|久热香蕉国产在线

  • <cite id="ikgdy"><table id="ikgdy"></table></cite>
    1. 西西軟件園多重安全檢測(cè)下載網(wǎng)站、值得信賴的軟件下載站!
      西西首頁 電腦軟件 安卓軟件 電腦游戲 安卓游戲 排行榜 專題合集

      quartz-all-1.8.5.jar

      • quartz-all-1.8.5.jar
      • 軟件大小:421KB
      • 更新時(shí)間:2013-07-22 09:07
      • 軟件語言:中文
      • 軟件廠商:
      • 軟件類別:國(guó)產(chǎn)軟件 / 免費(fèi)軟件 / 編程控件
      • 軟件等級(jí):2級(jí)
      • 應(yīng)用平臺(tái):WinAll, WinXP
      • 官方網(wǎng)站:暫無
      • 應(yīng)用備案:
      好評(píng):50%
      壞評(píng):50%

      本類精品

      軟件介紹

      在數(shù)據(jù)庫中創(chuàng)建Quartz所需表(sql語句可以在quartz-1.8.5\docs\dbTables中找到,

      這里以oracle數(shù)據(jù)庫為例):

      qrtz_blob_triggers,
      qrtz_calendars,
      qrtz_cron_triggers,
      qrtz_fired_triggers,
      qrtz_job_details,
      qrtz_job_listeners,
      qrtz_locks,
      qrtz_paused_trigger_grps,
      qrtz_scheduler_state,
      qrtz_simple_triggers,
      qrtz_triggers,
      qrtz_trigger_listeners

      加入quartz 所需要的包:

      放入jboss-4.2.3.GA\server\all\lib下

      先把jboss自帶的quartz jar刪除掉。包括(quartz-ra.rar)都刪除掉。

      commons-dbcp-1.3.jar
      commons-pool-1.5.4.jar
      jta-1.1.jar
      log4j-1.2.14.jar
      quartz-all-1.8.5.jar
      slf4j-api-1.6.0.jar
      slf4j-log4j12-1.6.0.jar
      3.創(chuàng)建quartz-service.xml文件(放入jboss-4.2.3.GA\server\all\deploy下),文件內(nèi)容如下:
      <?xml version="1.0" encoding="UTF-8"?>
      <server>
      <mbean code="org.quartz.ee.jmx.jboss.QuartzService"
      name="user:service=QuartzService,name=QuartzService">
      <attribute name="JndiName">Quartz</attribute>
      <attribute name="StartScheduler">true</attribute>
      <attribute name="Properties">
      #============================================================================
      # Configure Main Scheduler Properties
      #============================================================================
      #==========集群名稱,每個(gè)節(jié)點(diǎn)的名字都一樣===========
      org.quartz.scheduler.instanceName = quartzjbossdemopartitionName
      #==========集群每個(gè)節(jié)點(diǎn)ID=======
      org.quartz.scheduler.instanceId = AUTO

      #============================================================================
      # Configure ThreadPool
      #============================================================================
      #=======線程====
      org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
      org.quartz.threadPool.threadCount = 25
      org.quartz.threadPool.threadPriority = 5

      #============================================================================
      # Configure JobStore
      #============================================================================

      org.quartz.jobStore.misfireThreshold = 60000
      org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
      org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
      org.quartz.jobStore.dataSource = QUARTZ
      org.quartz.jobStore.tablePrefix = QRTZ_

      org.quartz.jobStore.isClustered = true
      org.quartz.jobStore.clusterCheckinInterval = 30000

      #============================================================================
      # Configure Datasources
      #============================================================================
      #=================數(shù)據(jù)庫寫上自己的數(shù)據(jù)庫======
      org.quartz.dataSource.QUARTZ.driver = oracle.jdbc.driver.OracleDriver
      org.quartz.dataSource.QUARTZ.URL = jdbc:oracle:thin:@192.168.111.24:1521:db org.quartz.dataSource.QUARTZ.user = rootmq
      org.quartz.dataSource.QUARTZ.password = rootmq
      org.quartz.dataSource.QUARTZ.maxConnections = 5
      org.quartz.dataSource.QUARTZ.validationQuery=select 0 from dual

      </attribute>
      </mbean>

      </server>
      4. java代碼
      每一個(gè) Quartz Job 必須有一個(gè)實(shí)現(xiàn)了 org.quartz.Job 接口的具體類.
      public class JbossJob implements Job {

      public void execute(JobExecutionContext arg0) throws JobExecutionException {
      System.out.println("hello jbossJob .....");
      }

      }
      5. 具體調(diào)用
      public class StartOrCloseScheduler implements Serializable{


      /**
      *
      */
      private static final long serialVersionUID = -2266323478579408291L;
      private static Logger myLogger = Logger.getLogger(StartOrCloseScheduler.class);
      private static Scheduler sched = null;
      /**
      * 啟動(dòng)任務(wù)
      * jobName: job名稱
      * jobGroupName: job組名稱
      * triggerName: trigger名稱
      * triggerGroupName:trigger組名稱
      */
      @SuppressWarnings("rawtypes")
      public static void start(String jobName,String jobGroupName,
      String triggerName,String triggerGroupName,
      Class c, String str) {
      try {
      InitialContext ctx = new InitialContext();
      sched = (Scheduler) ctx.lookup("Quartz");
      System.out.println("Scheduler:" + sched);
      } catch (NamingException e) {
      e.printStackTrace();
      }
      JobDetail job = new JobDetail(jobName,jobGroupName, c);
      System.out.println("JobDetail:" + job);
      Trigger trigger = new CronTrigger(triggerName,triggerGroupName);
      System.out.println("Trigger:" + trigger);
      try {
      ((CronTrigger) trigger).setCronExpression(str);
      sched.scheduleJob(job, trigger);
      System.out.println("job:" + job);
      sched.start();
      } catch (Exception e) {
      myLogger.error("開啟一個(gè)任務(wù)"+jobName+e.getMessage());
      e.printStackTrace();
      }

      }


      /**
      * 移除一個(gè)任務(wù)
      * @param jobName: job名稱
      * @param jobGroupName: job組名稱
      * @param triggerName: trigger名稱
      * @param triggerGroupName: trigger組名稱
      * @throws SchedulerException
      */
      public static void removeJob(String jobName,String jobGroupName,
      String triggerName,String triggerGroupName) {
      try {
      InitialContext ctx = new InitialContext();
      sched = (Scheduler) ctx.lookup("Quartz");
      } catch (NamingException e) {
      e.printStackTrace();
      }
      try {
      //停止觸發(fā)器
      sched.pauseTrigger(triggerName,triggerGroupName);
      //移除觸發(fā)器
      sched.unscheduleJob(triggerName,triggerGroupName);
      //刪除任務(wù)
      sched.deleteJob(jobName,jobGroupName);
      } catch (SchedulerException e) {
      myLogger.info("移除一個(gè)任務(wù)"+jobName+e.getMessage());
      }
      }

      }
      軟件標(biāo)簽: jar

      其他版本下載

      最新評(píng)論查看所有(1)條評(píng)論 >

      第 1 樓 上海有線通 網(wǎng)友 客人 2015/11/21 9:53:28
      謝謝,非常感謝

      支持( 0 ) 蓋樓(回復(fù))

      發(fā)表評(píng)論

      昵稱:
      表情: 高興 可 汗 我不要 害羞 好 下下下 送花 屎 親親
      查看所有(1)條評(píng)論 > 字?jǐn)?shù): 0/500

      TOP
      軟件下載