Skip to content

Commit

Permalink
Issue #477
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrojdeCTL committed Aug 10, 2018
1 parent aa08f7b commit f5a9cfd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private EngineDataAccessCache(boolean forServiceProcess, int performance_level)
}

public DatabaseAccess getDatabaseAccess() {
return edadb.getDatabaseAccess();
return edadb == null ? null : edadb.getDatabaseAccess();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.centurylink.mdw.workflow.activity.process;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand All @@ -38,6 +39,7 @@
import com.centurylink.mdw.constant.WorkAttributeConstant;
import com.centurylink.mdw.container.ThreadPoolProvider;
import com.centurylink.mdw.dataaccess.DataAccessException;
import com.centurylink.mdw.dataaccess.DatabaseAccess;
import com.centurylink.mdw.model.event.EventWaitInstance;
import com.centurylink.mdw.model.event.InternalEvent;
import com.centurylink.mdw.model.variable.DocumentReference;
Expand Down Expand Up @@ -442,10 +444,18 @@ else if (value.startsWith("DOCUMENT:"))

// Clear from this engine's documentCache map (forces getting from DB when next needed)
if (refreshDocCache && value0 instanceof DocumentReference) {
try {
DatabaseAccess db = getEngine().getDatabaseAccess();
if (db != null && db.isMySQL() && db.connectionIsOpen())
db.commit(); // This is so that the current transaction can see newly created/updated documents from other transactions
}
catch (SQLException e) { // If for some reason db is null - Still try to load document below
logger.debug(e.getMessage());
}
try {
getEngine().loadDocument((DocumentReference)value0, false);
}
catch (DataAccessException e) { // In mySQL, New documents created after this activity started its transaction are not findable in DB at this point
catch (DataAccessException e) { // In mySQL, New documents created after this activity started its transaction are not findable in DB at this point, unless performing commit above
logger.debug(e.getMessage());
}
}
Expand Down

0 comments on commit f5a9cfd

Please sign in to comment.