use of org.apache.ofbiz.base.config.GenericConfigException in project ofbiz-framework by apache.
the class JmsListenerFactory method loadListeners.
// Load the JMS listeners
private void loadListeners() {
try {
List<JmsService> jmsServices = ServiceConfigUtil.getServiceEngine().getJmsServices();
if (Debug.verboseOn())
Debug.logVerbose("Loading JMS Listeners.", module);
for (JmsService service : jmsServices) {
StringBuilder serverKey = new StringBuilder();
for (Server server : service.getServers()) {
try {
if (server.getListen()) {
// create a server key
serverKey.append(server.getJndiServerName() + ":");
serverKey.append(server.getJndiName() + ":");
serverKey.append(server.getTopicQueue());
// store the server element
servers.put(serverKey.toString(), server);
// load the listener
GenericMessageListener listener = loadListener(serverKey.toString(), server);
// store the listener w/ the key
if (serverKey.length() > 0 && listener != null)
listeners.put(serverKey.toString(), listener);
}
} catch (GenericServiceException gse) {
Debug.logInfo("Cannot load message listener " + serverKey + " error: (" + gse.toString() + ").", module);
} catch (Exception e) {
Debug.logError(e, "Uncaught exception.", module);
}
}
}
} catch (GenericConfigException e) {
Debug.logError(e, "Exception thrown while loading JMS listeners: ", module);
}
}
use of org.apache.ofbiz.base.config.GenericConfigException in project ofbiz-framework by apache.
the class PersistedServiceJob method failed.
@Override
protected void failed(Throwable t) throws InvalidJobException {
super.failed(t);
// if the job has not been re-scheduled; we need to re-schedule and run again
if (nextRecurrence == -1) {
if (this.canRetry()) {
// create a recurrence
Calendar cal = Calendar.getInstance();
try {
cal.add(Calendar.MINUTE, ServiceConfigUtil.getServiceEngine().getThreadPool().getFailedRetryMin());
} catch (GenericConfigException e) {
Debug.logWarning(e, "Unable to get retry minutes for job [" + getJobId() + "], defaulting to now: ", module);
}
long next = cal.getTimeInMillis();
try {
createRecurrence(next, true);
} catch (GenericEntityException e) {
Debug.logError(e, "Unable to re-schedule job [" + getJobId() + "]: ", module);
}
Debug.logInfo("Persisted Job [" + getJobId() + "] Failed. Re-Scheduling : " + next, module);
} else {
Debug.logWarning("Persisted Job [" + getJobId() + "] Failed. Max Retry Hit, not re-scheduling", module);
}
}
// set the failed status
jobValue.set("statusId", "SERVICE_FAILED");
jobValue.set("finishDateTime", UtilDateTime.nowTimestamp());
jobValue.set("jobResult", StringUtils.substring(t.getMessage(), 0, 255));
try {
jobValue.store();
} catch (GenericEntityException e) {
Debug.logError(e, "Cannot update the JobSandbox entity", module);
}
}
Aggregations