use of org.apache.ignite.spi.checkpoint.CheckpointListener in project ignite by apache.
the class S3CheckpointSpi method removeCheckpoint.
/**
* {@inheritDoc}
*/
@Override
public boolean removeCheckpoint(String key) {
assert !F.isEmpty(key);
timeoutWrk.remove(key);
boolean rmv = false;
try {
rmv = delete(key);
} catch (AmazonClientException e) {
U.error(log, "Failed to delete data by key: " + key, e);
}
if (rmv) {
CheckpointListener tmpLsnr = lsnr;
if (tmpLsnr != null)
tmpLsnr.onCheckpointRemoved(key);
}
return rmv;
}
use of org.apache.ignite.spi.checkpoint.CheckpointListener in project ignite by apache.
the class JdbcCheckpointSpi method removeCheckpoint.
/**
* {@inheritDoc}
*/
@Override
public boolean removeCheckpoint(String key) {
Connection conn = null;
PreparedStatement st = null;
boolean rmv = false;
try {
conn = getConnection();
st = conn.prepareStatement(delSql);
st.setString(1, key);
if (st.executeUpdate() > 0) {
rmv = true;
CheckpointListener tmp = lsnr;
if (tmp != null)
tmp.onCheckpointRemoved(key);
}
conn.commit();
} catch (SQLException e) {
U.rollbackConnection(conn, log);
U.error(log, "Failed to remove checkpoint [tblName=" + tblName + ", key=" + key + ']', e);
return false;
} finally {
U.close(st, log);
U.close(conn, log);
}
return rmv;
}
use of org.apache.ignite.spi.checkpoint.CheckpointListener in project ignite by apache.
the class SharedFsCheckpointSpi method removeCheckpoint.
/**
* {@inheritDoc}
*/
@Override
public boolean removeCheckpoint(String key) {
assert key != null;
File file = new File(folder, getUniqueFileName(key));
if (timeoutTask != null)
timeoutTask.remove(file);
boolean rmv = file.delete();
if (rmv) {
CheckpointListener lsnr = this.lsnr;
if (lsnr != null)
lsnr.onCheckpointRemoved(key);
}
return rmv;
}
use of org.apache.ignite.spi.checkpoint.CheckpointListener in project ignite by apache.
the class GridCheckpointManager method start.
/** {@inheritDoc} */
@Override
public void start(boolean activeOnStart) throws IgniteCheckedException {
for (CheckpointSpi spi : getSpis()) {
spi.setCheckpointListener(new CheckpointListener() {
@Override
public void onCheckpointRemoved(String key) {
record(EVT_CHECKPOINT_REMOVED, key);
}
});
}
startSpi();
ctx.io().addMessageListener(TOPIC_CHECKPOINT, lsnr);
if (log.isDebugEnabled())
log.debug(startInfo());
}
use of org.apache.ignite.spi.checkpoint.CheckpointListener in project ignite by apache.
the class GridCheckpointManager method start.
/**
* {@inheritDoc}
*/
@Override
public void start() throws IgniteCheckedException {
for (CheckpointSpi spi : getSpis()) {
spi.setCheckpointListener(new CheckpointListener() {
@Override
public void onCheckpointRemoved(String key) {
record(EVT_CHECKPOINT_REMOVED, key);
}
});
}
startSpi();
ctx.io().addMessageListener(TOPIC_CHECKPOINT, lsnr);
if (log.isDebugEnabled())
log.debug(startInfo());
}
Aggregations