当前位置: 首页>>代码示例>>Java>>正文


Java ClassLoadHelper类代码示例

本文整理汇总了Java中org.quartz.spi.ClassLoadHelper的典型用法代码示例。如果您正苦于以下问题:Java ClassLoadHelper类的具体用法?Java ClassLoadHelper怎么用?Java ClassLoadHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ClassLoadHelper类属于org.quartz.spi包,在下文中一共展示了ClassLoadHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import org.quartz.spi.ClassLoadHelper; //导入依赖的package包/类
/**
 * <p>
 * Called during creation of the <code>Scheduler</code> in order to give
 * the <code>SchedulerPlugin</code> a chance to initialize.
 * </p>
 * 
 * @throws SchedulerConfigException
 *           if there is an error initializing.
 */
public void initialize(String name, final Scheduler scheduler, ClassLoadHelper classLoadHelper)
    throws SchedulerException {

    getLog().info("Registering Quartz shutdown hook.");

    Thread t = new Thread("Quartz Shutdown-Hook "
            + scheduler.getSchedulerName()) {
        @Override
        public void run() {
            getLog().info("Shutting down Quartz...");
            try {
                scheduler.shutdown(isCleanShutdown());
            } catch (SchedulerException e) {
                getLog().info(
                        "Error shutting down Quartz: " + e.getMessage(), e);
            }
        }
    };

    Runtime.getRuntime().addShutdownHook(t);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:ShutdownHookPlugin.java

示例2: initialize

import org.quartz.spi.ClassLoadHelper; //导入依赖的package包/类
@Override
public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler) throws SchedulerConfigException {
  init();
  realJobStore.setInstanceId(schedInstId);
  realJobStore.setInstanceName(schedName);
  realJobStore.setTcRetryInterval(tcRetryInterval);

  if (misFireThreshold != null) {
    realJobStore.setMisfireThreshold(misFireThreshold);
  }

  if (synchWrite != null) {
    realJobStore.setSynchronousWrite(synchWrite);
  }

  if (estimatedTimeToReleaseAndAcquireTrigger != null) {
    realJobStore.setEstimatedTimeToReleaseAndAcquireTrigger(estimatedTimeToReleaseAndAcquireTrigger);
  }

  realJobStore.initialize(loadHelper, signaler);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:AbstractTerracottaJobStore.java

示例3: initialize

import org.quartz.spi.ClassLoadHelper; //导入依赖的package包/类
/**
 * <p>
 * Called by the QuartzScheduler before the <code>JobStore</code> is used, in order to give the it a chance to
 * initialize.
 * </p>
 */

@Override
// XXX: remove this suppression
@SuppressWarnings("unchecked")
public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler schedulerSignaler) {
  this.terracottaClientId = clusterInfo.getCurrentNode().getId();
  this.ftrCtr = System.currentTimeMillis();

  // this MUST happen before initializing the trigger set (otherwise we might receive an update which get an NPE)
  // this.serializer.setClassLoadHelper(loadHelper);

  this.signaler = schedulerSignaler;

  getLog().info(getClass().getSimpleName() + " initialized.");

  ((ToolkitInternal) toolkit).registerBeforeShutdownHook(new ShutdownHook(this));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:DefaultClusteredJobStore.java

示例4: initialize

import org.quartz.spi.ClassLoadHelper; //导入依赖的package包/类
@Override
public synchronized void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler)
    throws SchedulerConfigException {
  if (clusteredJobStore != null) { throw new IllegalStateException("already initialized"); }

  clusteredJobStore = createNewJobStoreInstance(schedName, Boolean.valueOf(synchWrite));
  clusteredJobStore.setThreadPoolSize(threadPoolSize);

  // apply deferred misfire threshold if present
  if (misfireThreshold != null) {
    clusteredJobStore.setMisfireThreshold(misfireThreshold);
    misfireThreshold = null;
  }

  if (estimatedTimeToReleaseAndAcquireTrigger != null) {
    clusteredJobStore.setEstimatedTimeToReleaseAndAcquireTrigger(estimatedTimeToReleaseAndAcquireTrigger);
    estimatedTimeToReleaseAndAcquireTrigger = null;
  }
  clusteredJobStore.setInstanceId(schedInstanceId);
  clusteredJobStore.setTcRetryInterval(tcRetryInterval);
  clusteredJobStore.initialize(loadHelper, signaler);

  // update check
  scheduleUpdateCheck();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:PlainTerracottaJobStore.java

示例5: initialize

import org.quartz.spi.ClassLoadHelper; //导入依赖的package包/类
@Override
public void initialize(ClassLoadHelper loadHelper,
        SchedulerSignaler signaler) throws SchedulerConfigException {

    if (nonManagedTxDsName == null) {
        throw new SchedulerConfigException(
            "Non-ManagedTX DataSource name not set!  " +
            "If your 'org.quartz.jobStore.dataSource' is XA, then set " + 
            "'org.quartz.jobStore.nonManagedTXDataSource' to a non-XA "+ 
            "datasource (for the same DB).  " + 
            "Otherwise, you can set them to be the same.");
    }

    if (getLockHandler() == null) {
        // If the user hasn't specified an explicit lock handler, 
        // then we *must* use DB locks with CMT...
        setUseDBLocks(true);
    }

    super.initialize(loadHelper, signaler);

    getLog().info("JobStoreCMT initialized.");
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:JobStoreCMT.java

示例6: initialize

import org.quartz.spi.ClassLoadHelper; //导入依赖的package包/类
/**
 * <p>
 * Called during creation of the <code>Scheduler</code> in order to give
 * the <code>SchedulerPlugin</code> a chance to initialize.
 * </p>
 * 
 * @throws org.quartz.SchedulerConfigException
 *           if there is an error initializing.
 */
public void initialize(String name, final Scheduler scheduler, ClassLoadHelper schedulerFactoryClassLoadHelper)
    throws SchedulerException {
    super.initialize(name, scheduler);
    this.classLoadHelper = schedulerFactoryClassLoadHelper;
    
    getLog().info("Registering Quartz Job Initialization Plug-in.");
    
    // Create JobFile objects
    StringTokenizer stok = new StringTokenizer(fileNames, FILE_NAME_DELIMITERS);
    while (stok.hasMoreTokens()) {
        final String fileName = stok.nextToken();
        final JobFile jobFile = new JobFile(fileName);
        jobFiles.put(fileName, jobFile);         
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:XMLSchedulingDataProcessorPlugin.java

示例7: initialize

import org.quartz.spi.ClassLoadHelper; //导入依赖的package包/类
public void initialize(ClassLoadHelper loadHelper,
        SchedulerSignaler signaler) throws SchedulerConfigException {

    if (nonManagedTxDsName == null) {
        throw new SchedulerConfigException(
            "Non-ManagedTX DataSource name not set!  " +
            "If your 'org.quartz.jobStore.dataSource' is XA, then set " + 
            "'org.quartz.jobStore.nonManagedTXDataSource' to a non-XA "+ 
            "datasource (for the same DB).  " + 
            "Otherwise, you can set them to be the same.");
    }

    if (getLockHandler() == null) {
        // If the user hasn't specified an explicit lock handler, 
        // then we *must* use DB locks with CMT...
        setUseDBLocks(true);
    }

    super.initialize(loadHelper, signaler);

    getLog().info("JobStoreCMT initialized.");
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:23,代码来源:JobStoreCMT.java

示例8: setUp

import org.quartz.spi.ClassLoadHelper; //导入依赖的package包/类
@BeforeClass
public void setUp()
  throws SchedulerException, InterruptedException {

  fSignaler = new SampleSignaler();

  Config config = new Config();
  config.setProperty("hazelcast.logging.type", "slf4j");
  hazelcastInstance = Hazelcast.newHazelcastInstance(config);

  ClassLoadHelper loadHelper = new CascadingClassLoadHelper();
  loadHelper.initialize();

  HazelcastJobStore.setHazelcastClient(hazelcastInstance);
  jobStore = createJobStore("AbstractJobStoreTest");
  jobStore.initialize(loadHelper, this.fSignaler);
  jobStore.schedulerStarted();

  jobDetail = JobBuilder.newJob(NoOpJob.class).withIdentity("job1", "jobGroup1").build();
  jobStore.storeJob(jobDetail, false);
}
 
开发者ID:FlavioF,项目名称:quartz-scheduler-hazelcast-jobstore,代码行数:22,代码来源:HazelcastJobStoreTest.java

示例9: testStoreAndRetrieveJobs

import org.quartz.spi.ClassLoadHelper; //导入依赖的package包/类
@Test
public void testStoreAndRetrieveJobs()
  throws Exception {

  final int nJobs = 10;

  SchedulerSignaler schedSignaler = new SampleSignaler();
  ClassLoadHelper loadHelper = new CascadingClassLoadHelper();
  loadHelper.initialize();

  JobStore store = createJobStore("testStoreAndRetrieveJobs");
  store.initialize(loadHelper, schedSignaler);

  // Store jobs.
  for (int i = 0; i < nJobs; i++) {
    JobDetail job = JobBuilder.newJob(NoOpJob.class).withIdentity("job" + i).build();
    store.storeJob(job, false);
  }

  // Retrieve jobs.
  for (int i = 0; i < nJobs; i++) {
    JobKey jobKey = JobKey.jobKey("job" + i);
    JobDetail storedJob = store.retrieveJob(jobKey);
    Assert.assertEquals(storedJob.getKey(), jobKey);
  }
}
 
开发者ID:FlavioF,项目名称:quartz-scheduler-hazelcast-jobstore,代码行数:27,代码来源:HazelcastJobStoreTest.java

示例10: initialize

import org.quartz.spi.ClassLoadHelper; //导入依赖的package包/类
@Override
public void initialize(ClassLoadHelper loadHelper,
		SchedulerSignaler signaler) throws SchedulerConfigException {
	
	this.loadHelper = loadHelper;
	this.signaler = signaler;		
   
   	// initializing a connection pool
   	JedisPoolConfig config = new JedisPoolConfig();
   	if (password != null)
   		pool = new JedisPool(config, host, port, Protocol.DEFAULT_TIMEOUT, password);	    		
   	else
   		pool = new JedisPool(config, host, port, Protocol.DEFAULT_TIMEOUT);
   	
   	// initializing a locking connection pool with a longer timeout
   	if (lockTimeout == 0)
   		lockTimeout = 10 * 60 * 1000; // 10 Minutes locking timeout
   	
     lockPool = new JedisLock(pool.getResource(), "JobLock", lockTimeout);

}
 
开发者ID:RedisLabs,项目名称:redis-quartz,代码行数:22,代码来源:RedisJobStore.java

示例11: testStoreAndRetrieveJobs

import org.quartz.spi.ClassLoadHelper; //导入依赖的package包/类
@Test()
public void testStoreAndRetrieveJobs() throws Exception {
  SchedulerSignaler schedSignaler = new SampleSignaler();
  ClassLoadHelper loadHelper = new CascadingClassLoadHelper();
  loadHelper.initialize();

  JobStore store = createJobStore("testStoreAndRetrieveJobs");
  store.initialize(loadHelper, schedSignaler);

  // Store jobs.
  for (int i = 0; i < 10; i++) {
    JobDetail job = JobBuilder.newJob(NoOpJob.class).withIdentity("job" + i)
        .build();
    store.storeJob(job, false);
  }
  // Retrieve jobs.
  for (int i = 0; i < 10; i++) {
    JobKey jobKey = JobKey.jobKey("job" + i);
    JobDetail storedJob = store.retrieveJob(jobKey);
    Assert.assertEquals(jobKey, storedJob.getKey());
  }
}
 
开发者ID:Ameausoone,项目名称:quartz-hazelcast-jobstore,代码行数:23,代码来源:TestHazelcastJobStore.java

示例12: setUp

import org.quartz.spi.ClassLoadHelper; //导入依赖的package包/类
@BeforeClass
public void setUp() throws SchedulerException, InterruptedException {

  Config config = new Config();
  config.setProperty("hazelcast.logging.type", "slf4j");
  hazelcastInstance = Hazelcast.newHazelcastInstance(config);

  this.fSignaler = new SampleSignaler();

  ClassLoadHelper loadHelper = new CascadingClassLoadHelper();
  loadHelper.initialize();

  this.jobStore = createJobStore("AbstractJobStoreTest");
  this.jobStore.initialize(loadHelper, this.fSignaler);
  this.jobStore.schedulerStarted();

  this.fJobDetail = new JobDetailImpl("job1", "jobGroup1", NoOpJob.class);
  this.fJobDetail.setDurability(true);
  this.jobStore.storeJob(this.fJobDetail, false);
}
 
开发者ID:Ameausoone,项目名称:quartz-hazelcast-jobstore,代码行数:21,代码来源:AbstractTestHazelcastJobStore.java

示例13: initialize

import org.quartz.spi.ClassLoadHelper; //导入依赖的package包/类
@Override
public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler schedulerSignaler) throws SchedulerConfigException {
    this.loadHelper = loadHelper;
    this.schedulerSignaler = schedulerSignaler;

    if (dynamoDbUrl == null) {
        throw new SchedulerConfigException("DynamoDB location must be set");
    }

    log.info(String.format("DynamoDb: location: '%s', table prefix: '%s'", dynamoDbUrl, quartzPrefix));

    configureAwsCredentials();
    configureClient();

    createClient();

    ensureTables();
}
 
开发者ID:mdaley,项目名称:quartz-dynamodb,代码行数:19,代码来源:DynamoDbJobStore.java

示例14: initialize

import org.quartz.spi.ClassLoadHelper; //导入依赖的package包/类
/**
 * Called to give the ClassLoadHelper a chance to initialize itself,
 * including the opportunity to "steal" the class loader off of the calling
 * thread, which is the thread that is initializing Quartz.
 */
public void initialize() {
    loadHelpers = new LinkedList<ClassLoadHelper>();

    loadHelpers.add(new LoadingLoaderClassLoadHelper());
    loadHelpers.add(new SimpleClassLoadHelper());
    loadHelpers.add(new ThreadContextClassLoadHelper());
    loadHelpers.add(new InitThreadContextClassLoadHelper());
    
    for(ClassLoadHelper loadHelper: loadHelpers) {
        loadHelper.initialize();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:CascadingClassLoadHelper.java

示例15: getResource

import org.quartz.spi.ClassLoadHelper; //导入依赖的package包/类
/**
 * Finds a resource with a given name. This method returns null if no
 * resource with this name is found.
 * @param name name of the desired resource
 * @return a java.net.URL object
 */
public URL getResource(String name) {

    URL result = null;

    if (bestCandidate != null) {
        result = bestCandidate.getResource(name);
        if(result == null) {
          bestCandidate = null;
        }
        else {
            return result;
        }
    }

    ClassLoadHelper loadHelper = null;

    Iterator<ClassLoadHelper> iter = loadHelpers.iterator();
    while (iter.hasNext()) {
        loadHelper = iter.next();

        result = loadHelper.getResource(name);
        if (result != null) {
            break;
        }
    }

    bestCandidate = loadHelper;
    return result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:CascadingClassLoadHelper.java


注:本文中的org.quartz.spi.ClassLoadHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。