Search in sources :

Example 1 with CheckpointListener

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;
}
Also used : CheckpointListener(org.apache.ignite.spi.checkpoint.CheckpointListener) AmazonClientException(com.amazonaws.AmazonClientException)

Example 2 with CheckpointListener

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;
}
Also used : CheckpointListener(org.apache.ignite.spi.checkpoint.CheckpointListener) SQLException(java.sql.SQLException) Connection(java.sql.Connection) PreparedStatement(java.sql.PreparedStatement)

Example 3 with CheckpointListener

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;
}
Also used : CheckpointListener(org.apache.ignite.spi.checkpoint.CheckpointListener) File(java.io.File)

Example 4 with CheckpointListener

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());
}
Also used : CheckpointListener(org.apache.ignite.spi.checkpoint.CheckpointListener) CheckpointSpi(org.apache.ignite.spi.checkpoint.CheckpointSpi)

Example 5 with CheckpointListener

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());
}
Also used : CheckpointListener(org.apache.ignite.spi.checkpoint.CheckpointListener) CheckpointSpi(org.apache.ignite.spi.checkpoint.CheckpointSpi)

Aggregations

CheckpointListener (org.apache.ignite.spi.checkpoint.CheckpointListener)7 File (java.io.File)2 PreparedStatement (java.sql.PreparedStatement)2 CheckpointSpi (org.apache.ignite.spi.checkpoint.CheckpointSpi)2 AmazonClientException (com.amazonaws.AmazonClientException)1 IOException (java.io.IOException)1 Connection (java.sql.Connection)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 Time (java.sql.Time)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1