Search in sources :

Example 11 with JobSystemException

use of com.dangdang.ddframe.job.exception.JobSystemException in project elastic-job by dangdangdotcom.

the class AopTargetUtils method getProxyTargetObjectForCglibAndSpring4.

private static Object getProxyTargetObjectForCglibAndSpring4(final Object proxy) {
    Field h;
    try {
        h = proxy.getClass().getDeclaredField("CGLIB$CALLBACK_0");
        h.setAccessible(true);
        Object dynamicAdvisedInterceptor = h.get(proxy);
        Field advised = dynamicAdvisedInterceptor.getClass().getDeclaredField("advised");
        advised.setAccessible(true);
        return ((AdvisedSupport) advised.get(dynamicAdvisedInterceptor)).getTargetSource().getTarget();
    // CHECKSTYLE:OFF
    } catch (final Exception ex) {
        // CHECKSTYLE:ON
        throw new JobSystemException(ex);
    }
}
Also used : Field(java.lang.reflect.Field) JobSystemException(com.dangdang.ddframe.job.exception.JobSystemException) JobSystemException(com.dangdang.ddframe.job.exception.JobSystemException)

Example 12 with JobSystemException

use of com.dangdang.ddframe.job.exception.JobSystemException in project elastic-job by dangdangdotcom.

the class TransientProducerScheduler method register.

// TODO 并发优化
synchronized void register(final CloudJobConfiguration jobConfig) {
    String cron = jobConfig.getTypeConfig().getCoreConfig().getCron();
    JobKey jobKey = buildJobKey(cron);
    repository.put(jobKey, jobConfig.getJobName());
    try {
        if (!scheduler.checkExists(jobKey)) {
            scheduler.scheduleJob(buildJobDetail(jobKey), buildTrigger(jobKey.getName()));
        }
    } catch (final SchedulerException ex) {
        throw new JobSystemException(ex);
    }
}
Also used : JobKey(org.quartz.JobKey) SchedulerException(org.quartz.SchedulerException) JobSystemException(com.dangdang.ddframe.job.exception.JobSystemException)

Aggregations

JobSystemException (com.dangdang.ddframe.job.exception.JobSystemException)12 SchedulerException (org.quartz.SchedulerException)5 Field (java.lang.reflect.Field)3 TaskThread (com.dangdang.ddframe.job.cloud.executor.TaskExecutor.TaskThread)2 TaskInfo (org.apache.mesos.Protos.TaskInfo)2 Test (org.junit.Test)2 SchedulerService (com.dangdang.ddframe.job.cloud.scheduler.mesos.SchedulerService)1 BigInteger (java.math.BigInteger)1 MessageDigest (java.security.MessageDigest)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 JobDetail (org.quartz.JobDetail)1 JobKey (org.quartz.JobKey)1 Scheduler (org.quartz.Scheduler)1 StdSchedulerFactory (org.quartz.impl.StdSchedulerFactory)1