本文整理汇总了Java中org.ofbiz.service.job.JobManagerException类的典型用法代码示例。如果您正苦于以下问题:Java JobManagerException类的具体用法?Java JobManagerException怎么用?Java JobManagerException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JobManagerException类属于org.ofbiz.service.job包,在下文中一共展示了JobManagerException类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: schedule
import org.ofbiz.service.job.JobManagerException; //导入依赖的package包/类
/**
* SCIPIO: Modified to accept an eventId
*
* @see org.ofbiz.service.LocalDispatcher#schedule(java.lang.String, java.lang.String, java.lang.String, java.util.Map, long, int, int, int, long, int)
*/
@Override
public void schedule(String jobName, String poolName, String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, int count, long endTime, int maxRetry, String eventId) throws GenericServiceException {
Transaction suspendedTransaction = null;
try {
boolean beganTransaction = false;
suspendedTransaction = TransactionUtil.suspend();
try {
beganTransaction = TransactionUtil.begin();
try {
getJobManager().schedule(jobName, poolName, serviceName, context, startTime, frequency, interval, count, endTime, maxRetry, eventId);
if (Debug.verboseOn()) {
Debug.logVerbose("[LocalDispatcher.schedule] : Current time : " + (new Date()).getTime(), module);
Debug.logVerbose("[LocalDispatcher.schedule] : Runtime : " + startTime, module);
Debug.logVerbose("[LocalDispatcher.schedule] : Frequency : " + frequency, module);
Debug.logVerbose("[LocalDispatcher.schedule] : Interval : " + interval, module);
Debug.logVerbose("[LocalDispatcher.schedule] : Count : " + count, module);
Debug.logVerbose("[LocalDispatcher.schedule] : EndTime : " + endTime, module);
Debug.logVerbose("[LocalDispatcher.schedule] : MaxRetry : " + maxRetry, module);
Debug.logVerbose("[LocalDispatcher.schedule] : Event ID : " + eventId, module);
}
} catch (JobManagerException jme) {
throw new GenericServiceException(jme.getMessage(), jme);
}
} catch (Exception e) {
String errMsg = "General error while scheduling job";
Debug.logError(e, errMsg, module);
try {
TransactionUtil.rollback(beganTransaction, errMsg, e);
} catch (GenericTransactionException gte1) {
Debug.logError(gte1, "Unable to rollback transaction", module);
}
} finally {
try {
TransactionUtil.commit(beganTransaction);
} catch (GenericTransactionException gte2) {
Debug.logError(gte2, "Unable to commit scheduled job", module);
}
}
} catch (GenericTransactionException gte) {
Debug.logError(gte, "Error suspending transaction while scheduling job", module);
} finally {
if (suspendedTransaction != null) {
try {
TransactionUtil.resume(suspendedTransaction);
} catch (GenericTransactionException gte3) {
Debug.logError(gte3, "Error resuming suspended transaction after scheduling job", module);
}
}
}
}
示例2: schedule
import org.ofbiz.service.job.JobManagerException; //导入依赖的package包/类
/**
* @see org.ofbiz.service.LocalDispatcher#schedule(java.lang.String, java.lang.String, java.lang.String, java.util.Map, long, int, int, int, long, int)
*/
public void schedule(String jobName, String poolName, String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, int count, long endTime, int maxRetry) throws GenericServiceException {
Transaction suspendedTransaction = null;
try {
boolean beganTransaction = false;
suspendedTransaction = TransactionUtil.suspend();
try {
beganTransaction = TransactionUtil.begin();
try {
getJobManager().schedule(jobName, poolName, serviceName, context, startTime, frequency, interval, count, endTime, maxRetry);
if (Debug.verboseOn()) {
Debug.logVerbose("[LocalDispatcher.schedule] : Current time : " + (new Date()).getTime(), module);
Debug.logVerbose("[LocalDispatcher.schedule] : Runtime : " + startTime, module);
Debug.logVerbose("[LocalDispatcher.schedule] : Frequency : " + frequency, module);
Debug.logVerbose("[LocalDispatcher.schedule] : Interval : " + interval, module);
Debug.logVerbose("[LocalDispatcher.schedule] : Count : " + count, module);
Debug.logVerbose("[LocalDispatcher.schedule] : EndTime : " + endTime, module);
Debug.logVerbose("[LocalDispatcher.schedule] : MazRetry : " + maxRetry, module);
}
} catch (JobManagerException jme) {
throw new GenericServiceException(jme.getMessage(), jme);
}
} catch (Exception e) {
String errMsg = "General error while scheduling job";
Debug.logError(e, errMsg, module);
try {
TransactionUtil.rollback(beganTransaction, errMsg, e);
} catch (GenericTransactionException gte1) {
Debug.logError(gte1, "Unable to rollback transaction", module);
}
} finally {
try {
TransactionUtil.commit(beganTransaction);
} catch (GenericTransactionException gte2) {
Debug.logError(gte2, "Unable to commit scheduled job", module);
}
}
} catch (GenericTransactionException gte) {
Debug.logError(gte, "Error suspending transaction while scheduling job", module);
} finally {
if (suspendedTransaction != null) {
try {
TransactionUtil.resume(suspendedTransaction);
} catch (GenericTransactionException gte3) {
Debug.logError(gte3, "Error resuming suspended transaction after scheduling job", module);
}
}
}
}