use of com.dangdang.ddframe.job.exception.JobSystemException in project elastic-job by dangdangdotcom.
the class AopTargetUtils method getTargetObject.
private static Object getTargetObject(final Object object) {
try {
Field advised = object.getClass().getDeclaredField("advised");
advised.setAccessible(true);
return ((AdvisedSupport) advised.get(object)).getTargetSource().getTarget();
// CHECKSTYLE:OFF
} catch (final Exception ex) {
// CHECKSTYLE:ON
throw new JobSystemException(ex);
}
}
use of com.dangdang.ddframe.job.exception.JobSystemException in project elastic-job by dangdangdotcom.
the class AopTargetUtils method getProxyTargetObject.
private static Object getProxyTargetObject(final Object proxy, final String proxyType) {
Field h;
try {
h = proxy.getClass().getSuperclass().getDeclaredField(proxyType);
} catch (final NoSuchFieldException ex) {
return getProxyTargetObjectForCglibAndSpring4(proxy);
}
h.setAccessible(true);
try {
return getTargetObject(h.get(proxy));
} catch (final IllegalAccessException ex) {
throw new JobSystemException(ex);
}
}
use of com.dangdang.ddframe.job.exception.JobSystemException in project elastic-job by dangdangdotcom.
the class TransientProducerScheduler method deregister.
void deregister(final CloudJobConfiguration jobConfig) {
repository.remove(jobConfig.getJobName());
String cron = jobConfig.getTypeConfig().getCoreConfig().getCron();
if (!repository.containsKey(buildJobKey(cron))) {
try {
scheduler.unscheduleJob(TriggerKey.triggerKey(cron));
} catch (final SchedulerException ex) {
throw new JobSystemException(ex);
}
}
}
use of com.dangdang.ddframe.job.exception.JobSystemException in project elastic-job by dangdangdotcom.
the class TaskExecutorThreadTest method assertLaunchTaskWithWrongElasticJobClass.
@Test
public void assertLaunchTaskWithWrongElasticJobClass() {
TaskInfo taskInfo = buildWrongElasticJobClass();
TaskThread taskThread = new TaskExecutor().new TaskThread(executorDriver, taskInfo);
try {
taskThread.run();
} catch (final JobSystemException ex) {
assertTrue(ex.getMessage().startsWith("Elastic-Job: Class 'com.dangdang.ddframe.job.cloud.executor.TaskExecutorThreadTest' must implements ElasticJob interface."));
}
}
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);
}
}
Aggregations