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


Java JobEntity.setLockOwner方法代码示例

本文整理汇总了Java中org.activiti.engine.impl.persistence.entity.JobEntity.setLockOwner方法的典型用法代码示例。如果您正苦于以下问题:Java JobEntity.setLockOwner方法的具体用法?Java JobEntity.setLockOwner怎么用?Java JobEntity.setLockOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.impl.persistence.entity.JobEntity的用法示例。


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

示例1: execute

import org.activiti.engine.impl.persistence.entity.JobEntity; //导入方法依赖的package包/类
public Object execute(CommandContext commandContext) {
  JobEntity job = Context
    .getCommandContext()
    .getJobManager()
    .findJobById(jobId);
  job.setRetries(job.getRetries() - 1);
  job.setLockOwner(null);
  job.setLockExpirationTime(null);
  
  if(exception != null) {
    job.setExceptionMessage(exception.getMessage());
    job.setExceptionStacktrace(getExceptionStacktrace());
  }
  
  JobExecutor jobExecutor = Context.getProcessEngineConfiguration().getJobExecutor();
  MessageAddedNotification messageAddedNotification = new MessageAddedNotification(jobExecutor);
  TransactionContext transactionContext = commandContext.getTransactionContext();
  transactionContext.addTransactionListener(TransactionState.COMMITTED, messageAddedNotification);
  
  return null;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:22,代码来源:DecrementJobRetriesCmd.java

示例2: execute

import org.activiti.engine.impl.persistence.entity.JobEntity; //导入方法依赖的package包/类
public Object execute(CommandContext commandContext) {
  JobEntity job = Context
    .getCommandContext()
    .getJobEntityManager()
    .findJobById(jobId);
  job.setRetries(job.getRetries() - 1);
  job.setLockOwner(null);
  job.setLockExpirationTime(null);
  
  if(exception != null) {
    job.setExceptionMessage(exception.getMessage());
    job.setExceptionStacktrace(getExceptionStacktrace());
  }
  
  JobExecutor jobExecutor = Context.getProcessEngineConfiguration().getJobExecutor();
  MessageAddedNotification messageAddedNotification = new MessageAddedNotification(jobExecutor);
  TransactionContext transactionContext = commandContext.getTransactionContext();
  transactionContext.addTransactionListener(TransactionState.COMMITTED, messageAddedNotification);
  
  return null;
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:22,代码来源:DecrementJobRetriesCmd.java

示例3: execute

import org.activiti.engine.impl.persistence.entity.JobEntity; //导入方法依赖的package包/类
@Override
public Object execute(CommandContext commandContext) {
    JobEntity job = Context.getCommandContext().getJobEntityManager().findJobById(jobId);
    job.setRetries(NO_RETRIES);
    job.setLockOwner(null);
    job.setLockExpirationTime(null);

    if (exception != null) {
        job.setExceptionMessage(exception.getMessage());
        job.setExceptionStacktrace(getExceptionStacktrace());
    }

    addTransactionListener(commandContext);
    return null;
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:16,代码来源:NoJobRetryCommandFactory.java

示例4: execute

import org.activiti.engine.impl.persistence.entity.JobEntity; //导入方法依赖的package包/类
public AcquiredJobs execute(CommandContext commandContext) {
  String lockOwner = jobExecutor.getLockOwner();
  int lockTimeInMillis = jobExecutor.getLockTimeInMillis();
  int maxJobsPerAcquisition = jobExecutor.getMaxJobsPerAcquisition();
  
  
  AcquiredJobs acquiredJobs = new AcquiredJobs();
  List<JobEntity> jobs = commandContext
    .getJobManager()
    .findNextJobsToExecute(new Page(0, maxJobsPerAcquisition));
  
  for (JobEntity job: jobs) {
    List<String> jobIds = new ArrayList<String>();

    if (job != null) {
      job.setLockOwner(lockOwner);
      GregorianCalendar gregorianCalendar = new GregorianCalendar();
      gregorianCalendar.setTime(ClockUtil.getCurrentTime());
      gregorianCalendar.add(Calendar.MILLISECOND, lockTimeInMillis);
      job.setLockExpirationTime(gregorianCalendar.getTime());
      jobIds.add(job.getId());
      if (job.isExclusive()) {
        // TODO acquire other exclusive jobs for the same process instance.
      }
    }
    
    acquiredJobs.addJobIds(jobIds);
  }
  
  return acquiredJobs;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:32,代码来源:AcquireJobsCmd.java

示例5: lockJob

import org.activiti.engine.impl.persistence.entity.JobEntity; //导入方法依赖的package包/类
protected void lockJob(JobEntity job, String lockOwner, int lockTimeInMillis) {    
  job.setLockOwner(lockOwner);
  GregorianCalendar gregorianCalendar = new GregorianCalendar();
  gregorianCalendar.setTime(ClockUtil.getCurrentTime());
  gregorianCalendar.add(Calendar.MILLISECOND, lockTimeInMillis);
  job.setLockExpirationTime(gregorianCalendar.getTime());    
}
 
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:8,代码来源:AcquireJobsCmd.java

示例6: updateNumberOfRetries

import org.activiti.engine.impl.persistence.entity.JobEntity; //导入方法依赖的package包/类
private void updateNumberOfRetries(JobEntity job) {
    if (maxNumberOfRetries == -1) {
        job.setLockOwner(LOCK_OWNER);
        job.setLockExpirationTime(calculateDueDate());
        return; /* always retry without counting */
    }

    int realUpperBound = maxNumberOfRetries + JobEntity.DEFAULT_RETRIES;
    if (job.getRetries() >= realUpperBound) {
        LOG.warn("Job {} from process {} has no more retries left. The process will block and may " +
            "require human intervention.", job.getId(), job.getProcessInstanceId());

        job.setRetries(0);  /* stop retrying this job */
        job.setLockOwner(null);

    } else {
        final Date newDate = calculateDueDate();
        LOG.info("Scheduling job {} from process {} to be retried at {}. Try {}/{}",
            new Object[]{job.getId(), job.getProcessInstanceId(), newDate,
                job.getRetries() - JobEntity.DEFAULT_RETRIES, maxNumberOfRetries});

        /* I've tried to use job.setDuedate() but it doesn't work as expected */

        job.setLockOwner(LOCK_OWNER);
        job.setLockExpirationTime(newDate);

        job.setRetries(job.getRetries() + 1);
    }
}
 
开发者ID:apache,项目名称:incubator-provisionr,代码行数:30,代码来源:ConfigurableFailedJobCommandFactory.java


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