Skip to content

Commit

Permalink
Fix “Lock wait timeout exceeded”
Browse files Browse the repository at this point in the history
  • Loading branch information
shoito committed Mar 25, 2017
1 parent db6393b commit 0528c0c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions ff4j-core/src/main/java/org/ff4j/store/JdbcFeatureStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -480,16 +480,21 @@ public void update(Feature fp) {
ps = sqlConn.prepareStatement(getQueryBuilder().deleteAllFeatureCustomProperties());
ps.setString(1, fpExist.getUid());
ps.executeUpdate();
closeStatement(ps);
ps = null;

// CREATE PROPERTIES
createCustomProperties(fp.getUid(), fp.getCustomProperties().values());

} catch (SQLException sqlEX) {
throw new FeatureAccessException(CANNOT_CHECK_FEATURE_EXISTENCE_ERROR_RELATED_TO_DATABASE, sqlEX);
} finally {
// CREATE CUSTOM PROPERTIES
for (Property property : fp.getCustomProperties().values()) {
ps = createCustomProperty(sqlConn, fp.getUid(), property);
closeStatement(ps);
closeConnection(sqlConn);
ps = null;
}
} catch (SQLException sqlEX) {
throw new FeatureAccessException(CANNOT_CHECK_FEATURE_EXISTENCE_ERROR_RELATED_TO_DATABASE, sqlEX);
} finally {
closeStatement(ps);
closeConnection(sqlConn);
}
}

/** {@inheritDoc} */
Expand Down

0 comments on commit 0528c0c

Please sign in to comment.