/** {@inheritDoc} */ @Override public V load(K key) { init(); Transaction tx = transaction(); if (log.isDebugEnabled()) log.debug("Store load [key=" + key + ", tx=" + tx + ']'); Connection conn = null; PreparedStatement stmt = null; try { conn = connection(tx); stmt = conn.prepareStatement(loadQry); stmt.setObject(1, toBytes(key)); ResultSet rs = stmt.executeQuery(); if (rs.next()) return fromBytes(rs.getBytes(2)); } catch (IgniteCheckedException | SQLException e) { throw new CacheLoaderException("Failed to load object: " + key, e); } finally { end(tx, conn, stmt); } return null; }
/** {@inheritDoc} */ @Override public void delete(Object key) { init(); Transaction tx = transaction(); if (log.isDebugEnabled()) log.debug("Store remove [key=" + key + ", tx=" + tx + ']'); Connection conn = null; PreparedStatement stmt = null; try { conn = connection(tx); stmt = conn.prepareStatement(delQry); stmt.setObject(1, toBytes(key)); stmt.executeUpdate(); } catch (IgniteCheckedException | SQLException e) { throw new CacheWriterException("Failed to remove object: " + key, e); } finally { end(tx, conn, stmt); } }
end(tx, conn, stmt);
/** {@inheritDoc} */ @SuppressWarnings({"RedundantTypeArguments"}) @Override public V load(K key) { init(); Transaction tx = transaction(); if (log.isDebugEnabled()) log.debug("Store load [key=" + key + ", tx=" + tx + ']'); Connection conn = null; PreparedStatement stmt = null; try { conn = connection(tx); stmt = conn.prepareStatement(loadQry); stmt.setObject(1, toBytes(key)); ResultSet rs = stmt.executeQuery(); if (rs.next()) return fromBytes(rs.getBytes(2)); } catch (IgniteCheckedException | SQLException e) { throw new CacheLoaderException("Failed to load object: " + key, e); } finally { end(tx, conn, stmt); } return null; }
/** {@inheritDoc} */ @Override public void delete(Object key) { init(); Transaction tx = transaction(); if (log.isDebugEnabled()) log.debug("Store remove [key=" + key + ", tx=" + tx + ']'); Connection conn = null; PreparedStatement stmt = null; try { conn = connection(tx); stmt = conn.prepareStatement(delQry); stmt.setObject(1, toBytes(key)); stmt.executeUpdate(); } catch (IgniteCheckedException | SQLException e) { throw new CacheWriterException("Failed to remove object: " + key, e); } finally { end(tx, conn, stmt); } }
end(tx, conn, stmt);