use of com.ibm.jbatch.container.persistence.CheckpointData in project Payara by payara.
the class JBatchJDBCPersistenceManager method updateCheckpointData.
/*
* (non-Javadoc)
*
* @see
* com.ibm.jbatch.container.services.impl.AbstractPersistenceManagerImpl
* #updateCheckpointData
* (com.ibm.ws.batch.container.checkpoint.CheckpointDataKey,
* com.ibm.ws.batch.container.checkpoint.CheckpointData)
*/
@Override
public void updateCheckpointData(CheckpointDataKey key, CheckpointData value) {
logger.entering(CLASSNAME, "updateCheckpointData", new Object[] { key, value });
tryObtainTableLock();
CheckpointData data = queryCheckpointData(key.getCommaSeparatedKey());
if (data != null) {
updateCheckpointData(key.getCommaSeparatedKey(), value);
} else {
createCheckpointData(key, value);
}
logger.exiting(CLASSNAME, "updateCheckpointData");
}
use of com.ibm.jbatch.container.persistence.CheckpointData in project Payara by payara.
the class JBatchJDBCPersistenceManager method queryCheckpointData.
/**
* select data from DB table
*
* @param key
* - the IPersistenceDataKey object
* @return List of serializable objects store in the DB table
*
* Ex. select id, obj from tablename where id = ?
*/
protected CheckpointData queryCheckpointData(Object key) {
logger.entering(CLASSNAME, "queryCheckpointData", new Object[] { key, SELECT_CHECKPOINTDATA });
CheckpointData data = null;
try (Connection connection = getConnection()) {
try (PreparedStatement statement = connection.prepareStatement(queryStrings.get(SELECT_CHECKPOINTDATA))) {
statement.setObject(1, key);
ResultSet resultSet = statement.executeQuery();
if (resultSet.next()) {
data = (CheckpointData) deserializeObject(resultSet.getBytes("obj"));
}
}
} catch (SQLException | IOException | ClassNotFoundException e) {
throw new PersistenceException(e);
}
logger.exiting(CLASSNAME, "queryCheckpointData");
return data;
}
use of com.ibm.jbatch.container.persistence.CheckpointData in project Payara by payara.
the class JBatchJDBCPersistenceManager method getCheckpointData.
/*
* (non-Javadoc)
*
* @see
* com.ibm.jbatch.container.services.impl.AbstractPersistenceManagerImpl
* #getCheckpointData
* (com.ibm.ws.batch.container.checkpoint.CheckpointDataKey)
*/
@Override
public CheckpointData getCheckpointData(CheckpointDataKey key) {
logger.entering(CLASSNAME, "getCheckpointData", key == null ? "<null>" : key);
tryObtainTableLock();
CheckpointData checkpointData = queryCheckpointData(key.getCommaSeparatedKey());
logger.exiting(CLASSNAME, "getCheckpointData", checkpointData == null ? "<null>" : checkpointData);
return checkpointData;
}
Aggregations