Implement parallel active-active cluster poll processing support

master
Vitaliy Filippov 2015-12-15 02:07:53 +03:00
parent a7841074c5
commit e924b7e033
4 changed files with 293 additions and 377 deletions

View File

@ -32,6 +32,7 @@ package org.glassfish.openesb.databasebc;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ParameterMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collections;
@ -220,7 +221,6 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
dbConnectionInfo = new DBConnectionInfo();
final DocumentBuilderFactory docBuilderFact = DocumentBuilderFactory.newInstance();
mDocBuilder = docBuilderFact.newDocumentBuilder();
//mTxManager = (TransactionManager) context.getTransactionManager();
if(endpoint.isClustered()){
try{
mJDBCClusterManager = new JDBCClusterManager(context);
@ -313,7 +313,6 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
MessageExchangeSupport.addReplyListener(mExchange.getExchangeId(), replyListener, epb);
MessageExchangeSupport.addRedeliveryListener(mExchange.getExchangeId(), this, epb);
Redelivery.setUniqueId(mExchange, exchangeId);
final String status = epb.getValue(EndpointBean.STATUS);
if (! status.equalsIgnoreCase(EndpointBean.STATUS_RUNNING)) {
@ -325,7 +324,6 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
} else if (mLogger.isLoggable(Level.INFO)) {
mLogger.info("DBBC_W00667.IMP_EP_NOT_RUNNING");
}
} else {
switch (ExchangePattern.valueOf(mExchange)) {
@ -384,13 +382,6 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
mPollMilliSeconds = meta.getJDBCSql().getPollMilliSeconds();
mSelectSQL = meta.getJDBCSql().getSql();
/*mPKName = Qualified(meta.getJDBCSql().getPKName());
mMarkColumnName = Qualified(meta.getJDBCSql().getMarkColumnName());
mMarkColumnValue = meta.getJDBCSql().getMarkColumnValue();
mTableName = Qualified(meta.getJDBCSql().getTableName());
mPollingPostProcessing = meta.getJDBCSql().getPollingPostProcessing();
mMoveRowToTableName = Qualified(meta.getJDBCSql().getMoveRowToTableName());
*/
mPKName = meta.getJDBCSql().getPKName();
mMarkColumnName = meta.getJDBCSql().getMarkColumnName();
mMarkColumnValue = meta.getJDBCSql().getMarkColumnValue();
@ -400,14 +391,9 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
mXAEnabled = meta.getJDBCSql().getTransaction();
jndiName = epb.getValue(EndpointBean.JDBC_DATABASE_JNDI_NAME);
// createNewDataSource(mXAEnabled,jndiName,epb);
// Throttle Check
if(throttleConfigurationCheck()) {
if (mXAEnabled.equalsIgnoreCase("XATransaction")) {
// mtxFlag = startTrasaction();
getTransactionManager().begin();
}
@ -429,7 +415,6 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
mJDBCClusterManager.setProductName(prdtName);
}else{
mClusterConnection = getDatabaseConnection(mRuntimeConfig.getProperties().getProperty(RuntimeConfiguration.CONFIG_CLUSTER_DATABASE_JNDINAME));
mClusterConnection.setAutoCommit(true);
mJDBCClusterManager.setJNDIName(mRuntimeConfig.getProperties().getProperty(RuntimeConfiguration.CONFIG_CLUSTER_DATABASE_JNDINAME));
String prdtName = DBMetaData.getDBType(mClusterConnection);
mJDBCClusterManager.setProductName(prdtName);
@ -444,16 +429,6 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
}
Transaction tx = getTransactionManager().getTransaction();
if (isSelectStatement(mSelectSQL)) {
rs = executeInboundSQLSelect(epb, meta, connection, mTableName, mSelectSQL);
if (rs != null) {
final JDBCNormalizer normalizer = new JDBCNormalizer();
Probe normalizationMeasurement = Probe.info(getClass(),
epb.getUniqueName(), JDBCBindingLifeCycle.PERF_CAT_NORMALIZATION);
//if(epb.isClustered() && mClusterConnection != null){
// normalizer.setConnection(mClusterConnection);
// }
if(epb.isClustered()){
mJDBCClusterManager.setDataBaseConnection(mClusterConnection);
mJDBCClusterManager.setTableName(mTableName);
@ -461,10 +436,18 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
mJDBCClusterManager.setHeartbeatConfigInterval(mPollMilliSeconds);
mJDBCClusterManager.setPKName(mPKName);
mJDBCClusterManager.doClusterTasks();
mClusterConnection.setAutoCommit(false);
}
rs = executeInboundSQLSelect(epb, meta, connection, mTableName, mSelectSQL);
if (rs != null) {
final JDBCNormalizer normalizer = new JDBCNormalizer();
Probe normalizationMeasurement = Probe.info(getClass(),
epb.getUniqueName(), JDBCBindingLifeCycle.PERF_CAT_NORMALIZATION);
normalizer.setInboundExchangeProcessRecordsMap(mMapInboundExchangesProcessRecords);
normalizer.setRecordsProcessedList(mProcessedList);
normalizer.setJDBCClusterManager(mJDBCClusterManager);
inMsg = normalizer.normalizeSelectInbound(rs, exchange, meta, epb, mPKName,mDbName);
mRowCount = normalizer.mRowCount;
@ -472,10 +455,14 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
normalizationMeasurement.end();
}
final List tempList = epb.getProcessList();
if (!(tempList.isEmpty())) {
// mTxHelper.handleInbound(exchange);
if (!(tempList.isEmpty()))
{
if (epb.isClustered())
{
mJDBCClusterManager.addInstances(tempList);
mClusterConnection.setAutoCommit(true);
}
//set JNDI name on NormalizedMessage for dynamic addressing
inMsg.setProperty(JDBCComponentContext.NM_PROP_DATABASEBC_CONNECTION_JNDI_NAME, jndiName);
exchange.setMessage(inMsg, "in");
@ -488,10 +475,8 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
mInboundExchanges.put(exchangeId, new ListenerMeta(
System.currentTimeMillis(), this));
mChannel.send(exchange);
epb.getEndpointStatus().incrementSentRequests();
// mTableExistsFlag = new Object();
if(epb.isClustered()){
//Records already sent to NMR so update the status to "SENT" for owner table
try{
@ -507,6 +492,8 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
}
}
} else {
if (epb.isClustered())
mClusterConnection.setAutoCommit(true);
if (tx != null) {
try {
tx.commit();
@ -524,8 +511,9 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
}
}
}
// mTableExistsFlag = new Object();
}
else if (epb.isClustered())
mClusterConnection.setAutoCommit(true);
}
}
} catch (final Exception ex) {
@ -557,7 +545,7 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
mLogger.log(Level.SEVERE, mMessages.getString("DBBC_E11111.IMP_EXCEPTION_WHILE_CLOSING_THE_CONNECTION"), se);
}
try{
if(epb.isClustered() && mClusterConnection != null){
if (mClusterConnection != null && mClusterConnection != connection){
mClusterConnection.close();
mClusterConnection = null;
}
@ -603,51 +591,48 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
}
}
public ResultSet executeInboundSQLSelect(final EndpointBean eBean,
public ResultSet executeInboundSQLSelect(final EndpointBean epb,
final OperationMetaData opMetaData,
Connection connection,
final String mTableName,
String lSelectSQL) throws MessagingException {
try {
String jndiName = eBean.getValue(EndpointBean.JDBC_DATABASE_JNDI_NAME);
String jndiName = epb.getValue(EndpointBean.JDBC_DATABASE_JNDI_NAME);
mLogger.log(Level.INFO, InboundMessageProcessor.mMessages.getString("DBBC_R00629.OMP_UsedJNDI") + jndiName);
if ((mMarkColumnName == null) || (mMarkColumnName.equals(""))) {
// do nothing
} else {
String where = "";
List<String> bind = new ArrayList<String>();
if (mMarkColumnName != null && !mMarkColumnName.equals("")) {
if (mFlagColumnType != null) {
String whereClause = " where ";
if((lSelectSQL.toUpperCase().contains(whereClause.toUpperCase()))) {
if (mFlagColumnType.equalsIgnoreCase("LONGVARCHAR") || mFlagColumnType.equalsIgnoreCase("CHAR")
|| mFlagColumnType.equalsIgnoreCase("VARCHAR")) {
lSelectSQL = lSelectSQL.concat(" and (" + mMarkColumnName + " != " + "'"
+ mMarkColumnValue + "'" + " or " + mMarkColumnName + " is NULL )");
} else {
lSelectSQL = lSelectSQL.concat(" and (" + mMarkColumnName + " != "
+ mMarkColumnValue + " or " + mMarkColumnName + " is NULL )");
}
}else {
if (mFlagColumnType.equalsIgnoreCase("LONGVARCHAR") || mFlagColumnType.equalsIgnoreCase("CHAR")
|| mFlagColumnType.equalsIgnoreCase("VARCHAR")) {
lSelectSQL = lSelectSQL.concat(" where (" + mMarkColumnName + " != " + "'"
+ mMarkColumnValue + "'" + " or " + mMarkColumnName + " is NULL )");
} else {
lSelectSQL = lSelectSQL.concat(" where (" + mMarkColumnName + " != "
+ mMarkColumnValue + " or " + mMarkColumnName + " is NULL )");
}
}
where = "("+mMarkColumnName+" != ? OR "+mMarkColumnName+" IS NULL)";
bind.add(mMarkColumnValue);
} else {
final String msg = InboundMessageProcessor.mMessages.getString("DBBC_E00638.IMP_Error_IVALID_ColumnName") + mMarkColumnName;
throw new MessagingException(msg, new NamingException());
}
}
if (epb.isClustered()) {
List<String> pkList = mJDBCClusterManager.selectAllProcessed();
if (pkList.size() > 0) {
StringBuilder sb = new StringBuilder();
for (int i = 0, l = pkList.size(); i < l; i++)
sb.append(i < l-1 ? "?," : "?");
where = (where.equals("") ? "" : where+" AND ")+mPKName+" NOT IN ("+sb.toString()+")";
bind.addAll(pkList);
}
}
lSelectSQL = lSelectSQL.replace("$WHERE", where.equals("") ? "1=1" : where);
mLogger.log(Level.INFO, "Executing sql 1. " + lSelectSQL);
ps = connection.prepareStatement(lSelectSQL);
ParameterMetaData paramMetaData = ps.getParameterMetaData();
for (int i = 0, l = bind.size(); i < l; i++)
{
int columnType = java.sql.Types.VARCHAR;
try { columnType = paramMetaData.getParameterType(i+1); } catch(Exception e) {}
ps.setObject(i+1, JDBCUtil.convert(bind.get(i), columnType), columnType);
}
rs = ps.executeQuery();
}
catch (final SQLException ex) {
if (mLogger.isLoggable(Level.FINEST)) {
mLogger.log(Level.FINEST, mMessages.getString("DBBC_E00639.IMP_Failed_Executing_SQL") + lSelectSQL, ex);
} else if (mLogger.isLoggable(Level.FINE)) {
@ -686,10 +671,6 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
rs = connection.getMetaData().getColumns(catalog, mSchemaName, mTableName, "%");
int noofColCounter = -1;
// if(rs==null){
// final String msg = InboundMessageProcessor.mMessages.getString("IMP_Table_NotExist");
// throw new MessagingException(msg, new NamingException());
// }
while (rs.next()) {
noofColCounter++;
final String colName = rs.getString("COLUMN_NAME");
@ -1009,29 +990,28 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
mLogger.log(Level.SEVERE, mMessages.getString("DBBC_E00653.IMP_XA_TX_ROLLBACK_FAILED"), exception);
}
}
}
// for cluster environment
if(epb.isClustered()){
try{
Connection con = null;
try{
List records = (List)mMapInboundExchangesProcessRecords.get(messageId);
if(jndiName.equalsIgnoreCase(mRuntimeConfig.getProperties().getProperty(RuntimeConfiguration.CONFIG_CLUSTER_DATABASE_JNDINAME))){
con = connection;
}else{
con = getDatabaseConnection(mRuntimeConfig.getProperties().getProperty(RuntimeConfiguration.CONFIG_CLUSTER_DATABASE_JNDINAME));
}
mJDBCClusterManager.updateStatusToDone(records, "DONE", con);
mJDBCClusterManager.setDataBaseConnection(con);
mJDBCClusterManager.deleteInstances(records);
mLogger.log(Level.INFO,
"DBBC_R10906.IMP_UPDATED_STATUS_TO_DONE",
"DBBC_R10907.IMP_UPDATED_STATUS_TO_DONE",
new Object[] { records });
}catch(Exception e){
mLogger.log(Level.SEVERE, "Unable to set the status to DOne", e.getLocalizedMessage());
mLogger.log(Level.SEVERE, "Unable to delete processed records", e.getLocalizedMessage());
}finally {
try{
if(con != null){
if(con != null && con != connection){
con.close();
con = null;
}
}catch(SQLException se){
mLogger.log(Level.SEVERE, "Unable to close the connection", se.getLocalizedMessage());
@ -1044,8 +1024,7 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
String pkNameRet = (String) it.next();
mProcessedList.remove(pkNameRet);
}
mLogger.log(Level.SEVERE, "IMP_MXCH_BAD_STATUS", new Object[] { exchange.getStatus().toString(),
messageId });
mLogger.log(Level.SEVERE, "IMP_MXCH_BAD_STATUS", new Object[] { exchange.getStatus().toString(), messageId });
if (isTransacted && exchange instanceof InOnly) {
try {
// As we are the initiator for tx we have to rollback
@ -1081,7 +1060,6 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
if(connection != null) {
connection.close();
}
}catch(SQLException se){
mLogger.log(Level.SEVERE, mMessages.getString("DBBC_E11111.IMP_EXCEPTION_WHILE_CLOSING_THE_CONNECTION"), se);
}
@ -1098,7 +1076,6 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
if (mLogger.isLoggable(Level.FINER)) {
mLogger.log(Level.FINER, " resuing txn ", new Object[] { tx.toString() });
}
}
}
@ -1274,9 +1251,8 @@ public class InboundMessageProcessor implements Runnable, MessageExchangeReplyLi
throw new MessagingException(e);
}
}
/*
* Runtime Config object to cluster JNDI name
*
/* Runtime Config object to cluster JNDI name
*/
public void setRuntimeConfig(RuntimeConfiguration runtimeConfg){
mRuntimeConfig = runtimeConfg;

View File

@ -81,6 +81,8 @@ public class JDBCClusterManager {
private String BASE_INSTANCESTATE_UPDATE_STMT_STR;
private String BASE_OWNERTABLE_SELECTALL_STMT_STR;
private String BASE_OWNERTABLE_INSERT_STMT_STR;
private String BASE_OWNERTABLE_UPDATE_STMT_STR;
@ -464,19 +466,17 @@ public class JDBCClusterManager {
}
/*
* Check if the record is already processed by another instance. @return boolean recordInserted
* if not inserted, insert the record with current instance name and status to "In Progress"
* Insert new rows with the "In Progress" state
*/
public boolean isRecordInsertedByCurrentInstance() {
boolean recordInserted = false;
String insertQuery = BASE_OWNERTABLE_INSERT_STMT_STR;
public int[] addInstances(List pkList) throws Exception {
PreparedStatement ps = null;
ParameterMetaData paramMetaData = null;
int parameters = 0;
Connection con = null;
int[] executedRows = null;
try {
con = getDataBaseConnection();
ps = con.prepareStatement(insertQuery);
ps = con.prepareStatement(BASE_OWNERTABLE_INSERT_STMT_STR);
paramMetaData = ps.getParameterMetaData();
if (paramMetaData != null) {
parameters = paramMetaData.getParameterCount();
@ -486,45 +486,56 @@ public class JDBCClusterManager {
} catch (Exception ex) {
mLogger.log(Level.SEVERE, mMessages.getString("DBBC_W11004.JCM_EXCEPTION_WHILE_GETTING_PS"), ex);
}
try {
if (parameters != 0) {
if ((getPKValue() != null) && !getPKValue().trim().equals("")) {
// set default type.
int columnType = java.sql.Types.VARCHAR;
try {
try{
columnType = paramMetaData.getParameterType(1);
}catch(Exception e){
addBatch(pkList, paramMetaData, ps, "In Progress", true);
}
ps.setObject(1, JDBCUtil.convert(getPKValue(), columnType), columnType);
try{
columnType = paramMetaData.getParameterType(2);
}catch(Exception e){
executedRows = ps.executeBatch();
for (int i = 0; i < executedRows.length; i++) {
if (executedRows[i] == PreparedStatement.EXECUTE_FAILED) {
throw new SQLException(
"One of the Queries in the batch didn't update any rows, Should have updated atleast one row");
}
ps.setObject(2, JDBCUtil.convert(getInstanceName(), columnType), columnType);
try{
columnType = paramMetaData.getParameterType(3);
}catch(Exception e){
mLogger.log(Level.INFO, "Inserted In Progress OWNER record "+pkList.get(i).toString());
}
ps.setObject(3, JDBCUtil.convert("In Progress", columnType), columnType);
int rowsUpdated = ps.executeUpdate();
recordInserted = true;
} catch (final Exception e) {
mLogger.log(Level.WARNING, e.getLocalizedMessage());
mLogger.log(Level.INFO, mMessages.getString("DBBC-R10903.JCM_RECORD_LOCKED", new Object[]{getInstanceName()}));
recordInserted = false;
}finally{
} catch(Exception e) {
if(ps != null){
try{
ps.clearBatch();
ps.close();
} catch(SQLException e){
mLogger.log(Level.SEVERE, mMessages.getString("DBBC_W11002.JCM_EXCEPTION_WHILE_CLOSING_PS"),
e);
} catch(SQLException se){
mLogger.log(Level.SEVERE, mMessages.getString("DBBC_W11002.JCM_EXCEPTION_WHILE_CLOSING_PS"), se);
}
}
throw e;
}
return executedRows;
}
public void deleteInstances(List pkList) throws Exception {
if (pkList.size() <= 0)
return;
PreparedStatement ps = null;
String sql = BASE_OWNERTABLE_DELETE_STMT_STR+" (";
for (int i = 0, l = pkList.size(); i < l; i++)
sql += (i < l-1 ? "?," : "?)");
ParameterMetaData paramMetaData = null;
int parameters = 0;
Connection con = null;
int[] executedRows = null;
try {
con = getDataBaseConnection();
ps = con.prepareStatement(sql);
ps.setString(1, getInstanceName());
for (int i = 0, l = pkList.size(); i < l; i++)
ps.setString(i+2, (String)pkList.get(i));
if (mLogger.isLoggable(Level.FINE))
mLogger.log(Level.FINE, "Executing SQL: "+sql); //$NON-NLS-1$
ps.execute();
} catch (Exception e) {
mLogger.log(Level.SEVERE, mMessages.getString("DBBC_W11004.JCM_EXCEPTION_WHILE_GETTING_PS"), e);
throw e;
}
return recordInserted;
}
/*
@ -554,7 +565,7 @@ public class JDBCClusterManager {
}
try {
if (parameters != 0) {
addBatch(pkList, paramMetaData, ps, status);
addBatch(pkList, paramMetaData, ps, status, false);
}
executedRows = ps.executeBatch();
for (int i = 0; i < executedRows.length; i++) {
@ -564,18 +575,7 @@ public class JDBCClusterManager {
}
;
}
}catch(SQLException e){
if(ps != null){
try{
ps.clearBatch();
ps.close();
}catch(SQLException se){
mLogger.log(Level.SEVERE, mMessages.getString("DBBC_W11002.JCM_EXCEPTION_WHILE_CLOSING_PS"),
e);
}
}
throw e;
}finally {
} catch(Exception e) {
if(ps != null){
try{
ps.clearBatch();
@ -585,12 +585,13 @@ public class JDBCClusterManager {
se);
}
}
throw e;
}
return executedRows;
}
private void addBatch(List pkList, ParameterMetaData parameterMeta, PreparedStatement ps, String status) throws SQLException, Exception {
private void addBatch(List pkList, ParameterMetaData parameterMeta, PreparedStatement ps, String status, boolean forIns) throws Exception {
if (!pkList.isEmpty()) {
for (final Iterator it = pkList.iterator(); it.hasNext();) {
String pkValue = (String) it.next();
@ -598,19 +599,18 @@ public class JDBCClusterManager {
// set default type.
int columnType = java.sql.Types.VARCHAR;
try {
try{
columnType = parameterMeta.getParameterType(1);
}catch(Exception e){
if (forIns)
{
try { columnType = parameterMeta.getParameterType(2); } catch(Exception e) {}
ps.setObject(2, JDBCUtil.convert(getInstanceName(), columnType), columnType);
}
ps.setObject(1, JDBCUtil.convert(status, columnType), columnType);
try{
columnType = parameterMeta.getParameterType(2);
}catch(Exception e){
}
ps.setObject(2, JDBCUtil.convert(pkValue, columnType), columnType);
try { columnType = parameterMeta.getParameterType(forIns ? 3 : 1); } catch(Exception e) {}
ps.setObject(forIns ? 3 : 1, JDBCUtil.convert(status, columnType), columnType);
try { columnType = parameterMeta.getParameterType(forIns ? 1 : 2); } catch(Exception e) {}
ps.setObject(forIns ? 1 : 2, JDBCUtil.convert(pkValue, columnType), columnType);
ps.addBatch();
} catch (SQLException e) {
mLogger.log(Level.WARNING, mMessages.getString("DBBC_W11004.JCM_EXCEPTION_WHILE_ADDING_BATCH_TO_PS"), e);
} catch (Exception e) {
mLogger.log(Level.WARNING, mMessages.getString("DBBC_W11005.JCM_EXCEPTION_WHILE_ADDING_BATCH_TO_PS"), e);
if(ps != null){
try{
ps.clearBatch();
@ -621,68 +621,22 @@ public class JDBCClusterManager {
}
}
throw e;
}catch(Exception ex){
throw ex;
}
}
}
}
}
public int[] updateStatusToDone(List pkList, String status, Connection conn) throws Exception {
String updateQuery = BASE_OWNERTABLE_UPDATE_STMT_STR;
PreparedStatement ps = null;
ParameterMetaData paramMetaData = null;
int parameters = 0;
Connection con = conn;
int[] executedRows = null;
try {
ps = con.prepareStatement(updateQuery);
paramMetaData = ps.getParameterMetaData();
if (paramMetaData != null) {
parameters = paramMetaData.getParameterCount();
}
} catch (SQLException ex) {
mLogger.log(Level.SEVERE, mMessages.getString("DBBC_W11004.JCM_EXCEPTION_WHILE_GETTING_PS"), ex);
} catch (Exception ex) {
mLogger.log(Level.SEVERE, mMessages.getString("DBBC_W11004.JCM_EXCEPTION_WHILE_GETTING_PS"), ex);
}
try{
if (parameters != 0) {
addBatch(pkList, paramMetaData, ps, status);
}
executedRows = ps.executeBatch();
for (int i = 0; i < executedRows.length; i++) {
if (executedRows[i] == PreparedStatement.EXECUTE_FAILED) {
throw new SQLException(
"One of the Queries in the batch didn't update any rows, Should have updated atleast one row");
}
;
}
}catch(SQLException e){
if(ps != null){
try{
ps.clearBatch();
ps.close();
}catch(SQLException se){
mLogger.log(Level.SEVERE, mMessages.getString("DBBC_W11002.JCM_EXCEPTION_WHILE_CLOSING_PS"),
e);
}
}
throw e;
}finally {
if(ps != null){
try{
ps.clearBatch();
ps.close();
}catch(SQLException se){
mLogger.log(Level.SEVERE, mMessages.getString("DBBC_W11002.JCM_EXCEPTION_WHILE_CLOSING_PS"),
se);
}
}
}
return executedRows;
public List selectAllProcessed() throws Exception
{
Connection con = getDataBaseConnection();
List<String> pkList = new ArrayList<String>();
Statement st = con.createStatement();
st.execute(BASE_OWNERTABLE_SELECTALL_STMT_STR);
ResultSet rs = st.getResultSet();
while (rs.next())
pkList.add(rs.getString(1));
return pkList;
}
/*
@ -698,13 +652,17 @@ public class JDBCClusterManager {
BASE_INSTANCESTATE_UPDATE_STMT_STR = "UPDATE INSTANCESTATE" + //$NON-NLS-1$
" SET lastupdatetime = CURRENT_TIMESTAMP " + "WHERE INSTANCEID = ? and TABLENAME = ?"; //$NON-NLS-1$
}
if(BASE_OWNERTABLE_SELECTALL_STMT_STR == null){
BASE_OWNERTABLE_SELECTALL_STMT_STR = "SELECT "+getPKName()+" FROM OWNER_"+getTableName()+
" FOR UPDATE";
}
if(BASE_OWNERTABLE_INSERT_STMT_STR == null){
BASE_OWNERTABLE_INSERT_STMT_STR = "INSERT INTO OWNER_" + getTableName() + //$NON-NLS-1$
" VALUES(?, ?, ?)"; //$NON-NLS-1$
}
if(BASE_OWNERTABLE_DELETE_STMT_STR == null){
BASE_OWNERTABLE_DELETE_STMT_STR = "DELETE FROM OWNER_" + getTableName() + //$NON-NLS-1$
"WHERE INSTANCEID = ? and status= ?"; //$NON-NLS-1$
" WHERE instance_name=? AND "+getPKName()+" IN "; //$NON-NLS-1$
}
if(BASE_OWNERTABLE_UPDATE_STMT_STR == null){
BASE_OWNERTABLE_UPDATE_STMT_STR = "UPDATE OWNER_" + getTableName() + //$NON-NLS-1$

View File

@ -96,7 +96,6 @@ public class JDBCNormalizer {
public ArrayList mProcessedList = new ArrayList();
public Map mInboundExchangeProcessRecordsMap = new HashMap();
public int mRowCount = 0;
private JDBCClusterManager mJDBCClusterManager;
/** Creates a new instance of SoapNormalizer
* @throws javax.jbi.messaging.MessagingException
@ -372,20 +371,7 @@ public class JDBCNormalizer {
pkName) || ("\"" + colName + "\"").
equalsIgnoreCase(
pkName))
if (epb.isClustered()) {
boolean inserted =
false;
mJDBCClusterManager.setPKValue(
colValue);
inserted =
mJDBCClusterManager.
isRecordInsertedByCurrentInstance();
if (!inserted)
record = null;
else
pKeyList.add(
colValue);
} else {
{
boolean processed =
isRecordProcessed(
colValue);
@ -1274,10 +1260,6 @@ public class JDBCNormalizer {
this.mProcessedList = list;
}
public void setJDBCClusterManager(JDBCClusterManager jdbcClusterManager) {
this.mJDBCClusterManager = jdbcClusterManager;
}
private boolean isRecordProcessed(String colValue) {
boolean recordProcessed = true;
if (mProcessedList.isEmpty() || !mProcessedList.contains(colValue)) {

View File

@ -113,12 +113,12 @@ DBBC_R00666.IMP_THROTTLE_NOT_DEFINED=Throttling configuration is not defined on
DBBC_W00667.IMP_EP_NOT_RUNNING=EndPoint \[{0}\] is not in state RUNNING. Ignoring received message.
DBBC_R00668.IMP_THROTTLE_LIMIT_REACHED=The number of messages exceed the throttle limit {0}
DBBC_R00669.IMP_THROTTLE_LIMIT_NOT_REACHED=The number of messages are within the throttle limit {0}
DBBC_R10906.IMP_UPDATED_STATUS_TO_SENT=DBBC_R10906.Update the status to SENT, records sent to BPEL {0}.
DBBC_E11108.IMP_ERROR_UPDATING_STATUS_TO_SENT=DBBC_E11108.Unable to update the status to SENT {0}, exception is {1}
DBBC_R10907.IMP_UPDATED_STATUS_TO_DONE=DBBC_R10907.Updated the status to DONE, records processed {0}
DBBC_E11109.IMP_EXCEPTION_WHILE_CLOSING_THE_RS=DBBC_E11109.Unable to close the result set, exception is {0}
DBBC_E11110.IMP_EXCEPTION_WHILE_CLOSING_THE_PS=DBBC_E11110.Unable to close the statement, exception is {0}
DBBC_E11111.IMP_EXCEPTION_WHILE_CLOSING_THE_CONNECTION=DBBC_E11111.Unable to close the connection, exception is {0}
DBBC_R10906.IMP_UPDATED_STATUS_TO_SENT=Update the status to SENT, records sent to BPEL {0}.
DBBC_E11108.IMP_ERROR_UPDATING_STATUS_TO_SENT=Unable to update the status to SENT {0}, exception is {1}
DBBC_R10907.IMP_UPDATED_STATUS_TO_DONE=Finished processing records {0}, OWNER_ rows deleted.
DBBC_E11109.IMP_EXCEPTION_WHILE_CLOSING_THE_RS=Unable to close the result set, exception is {0}
DBBC_E11110.IMP_EXCEPTION_WHILE_CLOSING_THE_PS=Unable to close the statement, exception is {0}
DBBC_E11111.IMP_EXCEPTION_WHILE_CLOSING_THE_CONNECTION=Unable to close the connection, exception is {0}
############################ resource bundles for OutboundMessageProcessor ################
DBBC_R00606.OMP_Accept_msg=Accepted message with exchange ID {0} in DBBC outbound message processor.