use of org.quartz.JobPersistenceException in project weicoder by wdcode.
the class JobStoreSupport method releaseAcquiredTrigger.
protected void releaseAcquiredTrigger(Connection conn, OperableTrigger trigger) throws JobPersistenceException {
try {
getDelegate().updateTriggerStateFromOtherState(conn, trigger.getKey(), STATE_WAITING, STATE_ACQUIRED);
getDelegate().updateTriggerStateFromOtherState(conn, trigger.getKey(), STATE_WAITING, STATE_BLOCKED);
getDelegate().deleteFiredTrigger(conn, trigger.getFireInstanceId());
} catch (SQLException e) {
throw new JobPersistenceException("Couldn't release acquired trigger: " + e.getMessage(), e);
}
}
use of org.quartz.JobPersistenceException in project weicoder by wdcode.
the class JobStoreSupport method getConnection.
protected Connection getConnection() throws JobPersistenceException {
Connection conn;
try {
conn = DBConnectionManager.getInstance().getConnection(getDataSource());
} catch (SQLException sqle) {
throw new JobPersistenceException("Failed to obtain DB connection from data source '" + getDataSource() + "': " + sqle.toString(), sqle);
} catch (Throwable e) {
throw new JobPersistenceException("Failed to obtain DB connection from data source '" + getDataSource() + "': " + e.toString(), e);
}
if (conn == null) {
throw new JobPersistenceException("Could not get connection from DataSource '" + getDataSource() + "'");
}
// Protect connection attributes we might change.
conn = getAttributeRestoringConnection(conn);
// Set any connection connection attributes we are to override.
try {
if (!isDontSetAutoCommitFalse()) {
conn.setAutoCommit(false);
}
if (isTxIsolationLevelSerializable()) {
conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
}
} catch (SQLException sqle) {
getLog().warn("Failed to override connection auto commit/transaction isolation.", sqle);
} catch (Throwable e) {
try {
conn.close();
} catch (Throwable ignored) {
}
throw new JobPersistenceException("Failure setting up connection.", e);
}
return conn;
}
use of org.quartz.JobPersistenceException in project weicoder by wdcode.
the class Util method setBeanProps.
public static void setBeanProps(Object obj, String[] propNames, Object[] propValues) throws JobPersistenceException {
if (propNames == null || propNames.length == 0)
return;
if (propNames.length != propValues.length)
throw new IllegalArgumentException("propNames[].lenght != propValues[].length");
String name = null;
try {
BeanInfo bi = Introspector.getBeanInfo(obj.getClass());
PropertyDescriptor[] propDescs = bi.getPropertyDescriptors();
for (int i = 0; i < propNames.length; i++) {
name = propNames[i];
String c = name.substring(0, 1).toUpperCase(Locale.US);
String methName = "set" + c + name.substring(1);
java.lang.reflect.Method setMeth = getSetMethod(methName, propDescs);
if (setMeth == null) {
throw new NoSuchMethodException("No setter for property '" + name + "'");
}
Class<?>[] params = setMeth.getParameterTypes();
if (params.length != 1) {
throw new NoSuchMethodException("No 1-argument setter for property '" + name + "'");
}
setMeth.invoke(obj, new Object[] { propValues[i] });
}
} catch (Exception e) {
throw new JobPersistenceException("Unable to set property named: " + name + " of object of type: " + obj.getClass().getCanonicalName(), e);
}
}
Aggregations