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


Java JsonHelper类代码示例

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


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

示例1: execute

import com.zuoxiaolong.niubi.job.core.helper.JsonHelper; //导入依赖的package包/类
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
    JobDetail jobDetail = jobExecutionContext.getJobDetail();
    Scheduler scheduler = jobExecutionContext.getScheduler();
    JobDescriptor jobDescriptor = JobDataMapManager.getJobDescriptor(jobDetail);
    JobParameter jobParameter = JobDataMapManager.getJobParameter(jobDetail);
    JobBeanFactory jobBeanFactory = getJobBeanFactory(scheduler, jobDetail);
    String jobMessageString = jobDescriptor + "  JobParameter:" + JsonHelper.toJson(jobParameter);
    try {
        LoggerHelper.info("begin execute job : " + jobMessageString);
        if (jobDescriptor.hasParameter()) {
            jobDescriptor.method().invoke(jobBeanFactory.getJobBean(jobDescriptor.group()), new Object[]{jobParameter});
        } else {
            jobDescriptor.method().invoke(jobBeanFactory.getJobBean(jobDescriptor.group()), new Object[]{});
        }
        LoggerHelper.info("execute job success: " + jobMessageString);
    } catch (Exception e) {
        LoggerHelper.error("execute job failed: " + jobMessageString, e);
        throw new NiubiException(e);
    }
}
 
开发者ID:xiaolongzuo,项目名称:niubi-job,代码行数:21,代码来源:StubJob.java

示例2: testQuartzAPI

import com.zuoxiaolong.niubi.job.core.helper.JsonHelper; //导入依赖的package包/类
public void testQuartzAPI() throws SchedulerException, InterruptedException {
    Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
    scheduler.start();
    for (int i = 1 ; i < 10; i++) {
        scheduler.scheduleJob(MockUtils.getEmptyJobDetail(String.valueOf(i)), MockUtils.getEmptyTrigger(String.valueOf(i)));
    }
    Thread.sleep(5000);
    for (;;) {
        List<JobExecutionContext> jobExecutionContexts = scheduler.getCurrentlyExecutingJobs();
        for (JobExecutionContext jobExecutionContext : jobExecutionContexts) {
            System.out.println(JsonHelper.toJson(jobExecutionContext.getJobDetail().getKey().getGroup()));
            System.out.println(JsonHelper.toJson(jobExecutionContext.getJobDetail().getKey().getName()));
            System.out.println(JsonHelper.toJson(scheduler.getTriggerState(jobExecutionContext.getTrigger().getKey())));
            System.out.println("----------------------");
        }
    }
}
 
开发者ID:xiaolongzuo,项目名称:niubi-job-examples,代码行数:18,代码来源:QuartzTest.java

示例3: saveJob

import com.zuoxiaolong.niubi.job.core.helper.JsonHelper; //导入依赖的package包/类
@Override
public void saveJob(String group, String name, StandbyJobData.Data data) {
    data.prepareOperation();
    StandbyJobData standbyJobData = new StandbyJobData(PathHelper.getJobPath(getStandbyPathApi().getJobPath(), group, name), data);
    standbyJobData.getData().incrementVersion();
    if (checkExists(standbyJobData.getPath())) {
        setData(standbyJobData.getPath(), standbyJobData.getDataBytes());
    } else {
        create(standbyJobData.getPath(), JsonHelper.toBytes(standbyJobData.getData()));
    }
}
 
开发者ID:xiaolongzuo,项目名称:niubi-job,代码行数:12,代码来源:StandbyJobApiImpl.java

示例4: saveJob

import com.zuoxiaolong.niubi.job.core.helper.JsonHelper; //导入依赖的package包/类
@Override
public void saveJob(String group, String name, MasterSlaveJobData.Data data) {
    data.prepareOperation();
    MasterSlaveJobData masterSlaveJobData = new MasterSlaveJobData(PathHelper.getJobPath(getMasterSlavePathApi().getJobPath(), group, name), data);
    masterSlaveJobData.getData().incrementVersion();
    if (checkExists(masterSlaveJobData.getPath())) {
        setData(masterSlaveJobData.getPath(), masterSlaveJobData.getDataBytes());
    } else {
        create(masterSlaveJobData.getPath(), JsonHelper.toBytes(masterSlaveJobData.getData()));
    }
}
 
开发者ID:xiaolongzuo,项目名称:niubi-job,代码行数:12,代码来源:MasterSlaveJobApiImpl.java

示例5: testGetChildren1

import com.zuoxiaolong.niubi.job.core.helper.JsonHelper; //导入依赖的package包/类
public void testGetChildren1() throws Exception {
    CuratorFramework client = CuratorFrameworkFactory.newClient("localhost:2181,localhost:3181,localhost:4181", new ExponentialBackoffRetry(1000, 4));
    client.start();
    System.out.println(JsonHelper.toJson(client.getChildren().forPath("/nodecache")));

    Thread.sleep(10000);
}
 
开发者ID:xiaolongzuo,项目名称:niubi-job-examples,代码行数:8,代码来源:CurdTest.java

示例6: testDelete

import com.zuoxiaolong.niubi.job.core.helper.JsonHelper; //导入依赖的package包/类
public void testDelete() throws Exception {
    CuratorFramework client = CuratorFrameworkFactory.newClient("localhost:2181,localhost:3181,localhost:4181", new ExponentialBackoffRetry(1000, 4));
    client.start();
    client.delete().inBackground(new BackgroundCallback() {
        public void processResult(CuratorFramework curatorFramework, CuratorEvent curatorEvent) throws Exception {
            System.out.println(JsonHelper.toJson(curatorEvent));
        }
    }).forPath("/curd-test/delete");

    Thread.sleep(10000);
}
 
开发者ID:xiaolongzuo,项目名称:niubi-job-examples,代码行数:12,代码来源:CurdTest.java

示例7: AbstractGenericData

import com.zuoxiaolong.niubi.job.core.helper.JsonHelper; //导入依赖的package包/类
public AbstractGenericData(String path, byte[] bytes) {
    this.path = path;
    this.id = PathHelper.getEndPath(this.path);
    this.data = JsonHelper.fromJson(bytes, getGenericType());
}
 
开发者ID:xiaolongzuo,项目名称:niubi-job,代码行数:6,代码来源:AbstractGenericData.java

示例8: getDataBytes

import com.zuoxiaolong.niubi.job.core.helper.JsonHelper; //导入依赖的package包/类
public byte[] getDataBytes() {
    return JsonHelper.toBytes(data);
}
 
开发者ID:xiaolongzuo,项目名称:niubi-job,代码行数:4,代码来源:AbstractGenericData.java

示例9: toString

import com.zuoxiaolong.niubi.job.core.helper.JsonHelper; //导入依赖的package包/类
@Override
public String toString() {
    return "GenericData{" +
            "data=" + JsonHelper.toJson(data) +
            '}';
}
 
开发者ID:xiaolongzuo,项目名称:niubi-job,代码行数:7,代码来源:AbstractGenericData.java


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