ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r708803 - /webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/
Date Wed, 29 Oct 2008 06:34:40 GMT
Author: amilas
Date: Tue Oct 28 23:34:40 2008
New Revision: 708803

URL: http://svn.apache.org/viewvc?rev=708803&view=rev
Log:
applying the patch for SANDESHA2-179

Modified:
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/JDBCTransaction.java
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentInvokerBeanMgr.java
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMDBeanMgr.java
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMSBeanMgr.java
    webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentSenderBeanMgr.java

Modified: webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/JDBCTransaction.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/JDBCTransaction.java?rev=708803&r1=708802&r2=708803&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/JDBCTransaction.java
(original)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/JDBCTransaction.java
Tue Oct 28 23:34:40 2008
@@ -43,6 +43,7 @@
 		  this.pmgr = pmgr;
 		  dbConnection = pmgr.dbConnect();
 		  dbConnection.setAutoCommit(false);
+			dbConnection.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
 		  active = true;
 		} catch (Exception ex) {}
 	}

Modified: webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentInvokerBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentInvokerBeanMgr.java?rev=708803&r1=708802&r2=708803&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentInvokerBeanMgr.java
(original)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentInvokerBeanMgr.java
Tue Oct 28 23:34:40 2008
@@ -100,7 +100,7 @@
 		String sql = requestForModel(bean);
 		ArrayList<InvokerBean> lst = new ArrayList<InvokerBean>();
 		try {
-			Statement stmt = getDbConnection().createStatement();
+			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
 			while ( rs.next() ) {
 				lst.add(getInvokerBean(rs));
@@ -138,7 +138,7 @@
 	{
 		InvokerBean invokerBean = null;
 		try {
-			Statement stmt = getDbConnection().createStatement();
+			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery("select * from wsrm_invoker where message_context_ref_key='"
+ key + "'");
 			if ( ! rs.next() ) return invokerBean;
 			invokerBean = getInvokerBean(rs);
@@ -176,7 +176,7 @@
 		String sql = requestForModel(bean);
 		InvokerBean result = null;
 		try {
-			Statement stmt = getDbConnection().createStatement();
+			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
 			while ( rs.next() ) {
 				if ( result == null ) {

Modified: webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMDBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMDBeanMgr.java?rev=708803&r1=708802&r2=708803&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMDBeanMgr.java
(original)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMDBeanMgr.java
Tue Oct 28 23:34:40 2008
@@ -264,7 +264,7 @@
 		String sql = requestForModel(bean);
 		ArrayList<RMDBean> lst = new ArrayList<RMDBean>();
 		try {
-			Statement stmt = getDbConnection().createStatement();
+			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
 			while ( rs.next() ) {
 				lst.add(getBean(rs));
@@ -340,7 +340,7 @@
 	{
 		RMDBean bean = null;
 		try {
-			Statement stmt = getDbConnection().createStatement();
+			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery("select * from wsrm_rmd where sequence_id='" + sequenceID
+ "'");
 			if ( ! rs.next() ) return bean;
 			bean = getBean(rs);
@@ -419,7 +419,7 @@
 		String sql = requestForModel(bean);
 		RMDBean result = null;
 		try {
-			Statement stmt = getDbConnection().createStatement();
+			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
 			while ( rs.next() ) {
 				if ( result == null ) {

Modified: webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMSBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMSBeanMgr.java?rev=708803&r1=708802&r2=708803&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMSBeanMgr.java
(original)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentRMSBeanMgr.java
Tue Oct 28 23:34:40 2008
@@ -264,7 +264,7 @@
 	private RMSBean getBean(ResultSet rs)
 	  throws Exception
 	{
-		RMSBean bean = new RMSBean();
+        RMSBean bean = new RMSBean();
 		bean.setSequenceID(rs.getString("sequence_id"));
 
 		Object obj = getObject(rs,"to_epr");
@@ -324,7 +324,7 @@
 	public boolean delete(String msgId)
 	  throws SandeshaStorageException
 	{
-		if(log.isDebugEnabled()) log.debug("delete RMSBean msgId " + msgId);
+        if(log.isDebugEnabled()) log.debug("delete RMSBean msgId " + msgId);
 		try {
 			Statement stmt = getDbConnection().createStatement();
 			stmt.executeUpdate("delete from wsrm_rms where create_seq_msg_id='" + msgId + "'");
@@ -338,10 +338,10 @@
 	public List find(RMSBean bean)
 	  throws SandeshaStorageException
 	{
-		String sql = requestForModel(bean);
+        String sql = requestForModel(bean);
 		ArrayList<RMSBean> lst = new ArrayList<RMSBean>();
 		try {
-			Statement stmt = getDbConnection().createStatement();
+			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
 			while ( rs.next() ) {
 				lst.add(getBean(rs));
@@ -358,7 +358,7 @@
 	public boolean insert(RMSBean bean)
 	  throws SandeshaStorageException
 	{
-		log.debug("insert RMSBean " + bean);
+        log.debug("insert RMSBean " + bean);
 		try {
 		    PreparedStatement pstmt = getDbConnection().prepareStatement("insert into wsrm_rms("
+
 		    		"create_seq_msg_id,sequence_id,to_epr_addr,to_epr,reply_to_epr_addr,reply_to_epr,acks_to_epr_addr,acks_to_epr,rm_version,security_token_data,"
+
@@ -431,10 +431,10 @@
 	public RMSBean retrieve(String msgId)
 	  throws SandeshaStorageException
 	{
-		log.debug("Retrieve  msdId " + msgId);
+        log.debug("Retrieve  msdId " + msgId);
 		RMSBean bean = null;
 		try {
-			Statement stmt = getDbConnection().createStatement();
+			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery("select * from wsrm_rms where create_seq_msg_id='" +
msgId + "'");
 			if ( rs.next() ) bean = getBean(rs);
 			rs.close();
@@ -450,7 +450,7 @@
 	public boolean update(RMSBean bean)
 	  throws SandeshaStorageException
 	{
-		if ( log.isDebugEnabled()) {
+        if ( log.isDebugEnabled()) {
 		  log.debug("Update bean : " + bean);
 		}
 			try {
@@ -525,10 +525,10 @@
 	public RMSBean findUnique(RMSBean bean)
 	  throws SandeshaStorageException
 	{
-		String sql = requestForModel(bean);
+        String sql = requestForModel(bean);
 		RMSBean result = null;
 		try {
-			Statement stmt = getDbConnection().createStatement();
+			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
 			while ( rs.next() ) {
 				if ( result == null ) {
@@ -558,9 +558,10 @@
         String sql = requestForModel(dummyBean);
 		RMSBean result = null;
 		try {
-			Statement stmt = getDbConnection().createStatement();
+			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
-			while ( rs.next() ) {
+
+            while ( rs.next() ) {
 				if ( result == null ) {
 					result = getBean(rs);
 				} else {
@@ -588,7 +589,7 @@
         String sql = requestForModel(dummyBean);
 		RMSBean result = null;
 		try {
-			Statement stmt = getDbConnection().createStatement();
+			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
 			while ( rs.next() ) {
 				if ( result == null ) {

Modified: webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentSenderBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentSenderBeanMgr.java?rev=708803&r1=708802&r2=708803&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentSenderBeanMgr.java
(original)
+++ webservices/sandesha/trunk/java/modules/persistence/src/main/java/org/apache/sandesha2/storage/jdbc/PersistentSenderBeanMgr.java
Tue Oct 28 23:34:40 2008
@@ -41,7 +41,7 @@
 	{
 		super(pmgr);
 	}
-	
+
 	private String requestForModel(SenderBean bean)
 	{
 		StringBuilder sql = new StringBuilder("select * from wsrm_sender");
@@ -95,56 +95,56 @@
 			sql.append(clause);
 			sql.append("'");
 		}
-		
-		if ( (bean.getFlags() & SenderBean.SEND_FLAG ) != 0 ) { 
+
+		if ( (bean.getFlags() & SenderBean.SEND_FLAG ) != 0 ) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" send=");
 			sql.append(bean.isSend() ? 1:0);
 		}
-		if ( (bean.getFlags() & SenderBean.SEND_COUNT_FLAG ) != 0 ) { 
+		if ( (bean.getFlags() & SenderBean.SEND_COUNT_FLAG ) != 0 ) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" sent_count=");
 			sql.append(bean.getSentCount());
 		}
-		if ( (bean.getFlags() & 0x00000100) != 0 ) { 
+		if ( (bean.getFlags() & 0x00000100) != 0 ) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" message_number=");
 			sql.append(bean.getMessageNumber());
 		}
-		if ( (bean.getFlags() & 0x00001000) != 0 ) { 
+		if ( (bean.getFlags() & 0x00001000) != 0 ) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" resend=");
 			sql.append(bean.isReSend() ? 1:0);
 		}
-		if ( (bean.getFlags() & 0x00010000) != 0 ) { 
+		if ( (bean.getFlags() & 0x00010000) != 0 ) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" time_to_send<=");
 			sql.append(bean.getTimeToSend());
 		}
-		if ( (bean.getFlags() & 0x00100000) != 0 ) { 
+		if ( (bean.getFlags() & 0x00100000) != 0 ) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" message_type=");
 			sql.append(bean.getMessageType());
 		}
-		if ( (bean.getFlags() & 0x01000000) != 0 ) { 
+		if ( (bean.getFlags() & 0x01000000) != 0 ) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" last_message=");
 			sql.append(bean.isLastMessage() ? 1:0);
 		}
-		if ( (bean.getFlags() & 0x10000000) != 0 ) { 
+		if ( (bean.getFlags() & 0x10000000) != 0 ) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" inbound_message_number=");
 			sql.append(bean.getInboundMessageNumber());
 		}
-		if ( (bean.getFlags() & 0x00000002) != 0 ) { 
+		if ( (bean.getFlags() & 0x00000002) != 0 ) {
 			sql.append(op);
 			op = " and ";
 			sql.append(" transport_available=");
@@ -153,7 +153,7 @@
 		log.debug("requestForModel " + sql.toString());
 		return sql.toString();
 	}
-	
+
 	private SenderBean getBean(ResultSet rs)
 	  throws Exception
 	{
@@ -164,16 +164,16 @@
 		bean.setInternalSequenceID(rs.getString("internal_sequence_id"));
 		bean.setToAddress(rs.getString("to_address"));
 		bean.setInboundSequenceId(rs.getString("inbound_sequence_id"));
-				
+
 		bean.setMessageNumber(rs.getLong("message_number"));
 		bean.setTimeToSend(rs.getLong("time_to_send"));
 		bean.setInboundMessageNumber(rs.getLong("inbound_message_number"));
-		
+
 		bean.setSend(rs.getInt("send")!= 0 ? true:false);
 		bean.setReSend(rs.getInt("resend")!= 0 ? true:false);
 		bean.setLastMessage(rs.getInt("last_message")!= 0 ? true:false);
 		bean.setTransportAvailable(rs.getInt("transport_available")!= 0 ? true:false);
-		
+
 		bean.setSentCount(rs.getInt("sent_count"));
 		bean.setMessageType(rs.getInt("message_type"));
 		bean.setFlags(rs.getInt("flags"));
@@ -193,14 +193,14 @@
 		}
 		return true;
 	}
-	
+
 	public List find(SenderBean bean)
 	  throws SandeshaStorageException
 	{
 		String sql = requestForModel(bean);
 		ArrayList<SenderBean> lst = new ArrayList<SenderBean>();
 		try {
-			Statement stmt = getDbConnection().createStatement();
+			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery(sql);
 			while ( rs.next() ) {
 				lst.add(getBean(rs));
@@ -213,13 +213,13 @@
 		return lst;
 	}
 
-	
+
 	public List find(String internalSequenceId)
 	  throws SandeshaStorageException
 		{
 			ArrayList<SenderBean> lst = new ArrayList<SenderBean>();
 			try {
-				Statement stmt = getDbConnection().createStatement();
+				Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 				ResultSet rs = stmt.executeQuery("select * from wsrm_sender where internal_sequence_id='"
+
 						internalSequenceId + "'");
 				while ( rs.next() ) {
@@ -232,7 +232,7 @@
 			}
 			return lst;
 		}
-	
+
 	public SenderBean getNextMsgToSend(String sequenceId)
 	  throws SandeshaStorageException
 	{
@@ -262,7 +262,7 @@
 	  if(log.isDebugEnabled()) log.debug("Exit getNextMessageToSend " + result);
 	  return result;
 	}
-	
+
 	public boolean insert(SenderBean bean)
 	  throws SandeshaStorageException
 	{
@@ -296,13 +296,13 @@
 		}
 		return true;
 	}
-	
+
 	public SenderBean retrieve(String messageID)
 	  throws SandeshaStorageException
 	{
 		SenderBean bean = null;
 		try {
-			Statement stmt = getDbConnection().createStatement();
+			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery("select * from wsrm_sender where message_id='" + messageID
+ "'");
 			if ( ! rs.next() ) return bean;
 			bean = getBean(rs);
@@ -313,7 +313,7 @@
 		}
 		return bean;
 	}
-	
+
 	public boolean update(SenderBean bean)
 	  throws SandeshaStorageException
 	{
@@ -347,7 +347,7 @@
 		}
 		return true;
 	}
-	
+
 	public SenderBean findUnique(SenderBean bean)
 	  throws SandeshaStorageException
 	{
@@ -372,7 +372,7 @@
 			stmt.close();
 		} catch (Exception ex) {
 			throw new SandeshaStorageException(ex);
-		}		
+		}
 		return result;
 	}
 
@@ -380,7 +380,7 @@
 	{
 		SenderBean bean = null;
 		try {
-			Statement stmt = getDbConnection().createStatement();
+			Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
 			ResultSet rs = stmt.executeQuery("select * from wsrm_sender where message_context_ref_key='"
+ messageContextRefKey + "'");
 			if ( ! rs.next() ) return bean;
 			bean = getBean(rs);
@@ -395,7 +395,7 @@
     public SenderBean retrieve(String sequnceId, long messageNumber) throws SandeshaStorageException
{
         SenderBean bean = null;
         try {
-            Statement stmt = getDbConnection().createStatement();
+            Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_UPDATABLE);
             ResultSet rs = stmt.executeQuery("select * from wsrm_sender where sequence_id='"
+ sequnceId + "' " +
                     " and message_number=" + messageNumber);
             if (! rs.next()) return bean;



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Mime
View raw message