[jboss-svn-commits] JBL Code SVN: r12424 - labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Jun 8 13:24:00 EDT 2007
Author: tcunning
Date: 2007-06-08 13:24:00 -0400 (Fri, 08 Jun 2007)
New Revision: 12424
Modified:
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/HibernateCourier.java
Log:
bug:JBESB-434
Remove commented out code.
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/HibernateCourier.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/HibernateCourier.java 2007-06-08 17:23:23 UTC (rev 12423)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/HibernateCourier.java 2007-06-08 17:24:00 UTC (rev 12424)
@@ -21,24 +21,17 @@
*/
package org.jboss.internal.soa.esb.couriers;
-import java.io.Serializable;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.List;
import java.util.UUID;
import org.apache.log4j.Logger;
-import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.jboss.soa.esb.addressing.Call;
-import org.jboss.soa.esb.addressing.MalformedEPRException;
import org.jboss.soa.esb.addressing.eprs.HibernateEpr;
import org.jboss.soa.esb.couriers.CourierException;
import org.jboss.soa.esb.couriers.CourierTimeoutException;
-import org.jboss.soa.esb.helpers.persist.HibernateConn;
import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.util.Util;
-import org.xml.sax.SAXParseException;
/**
* Courier which delivers message.
@@ -49,7 +42,6 @@
*/
public class HibernateCourier implements PickUpOnlyCourier, DeliverOnlyCourier {
- protected HibernateConn m_conn = null;
protected HibernateEpr m_epr = null;
protected static Logger m_Logger = Logger.getLogger(HibernateCourier.class);
@@ -82,13 +74,6 @@
}
public void cleanup() {
- if (null != m_conn) {
- try {
- m_conn.release();
- } catch (Exception e) {
- m_Logger.error("Unable to release connection", e);
- }
- }
}
/**
@@ -118,38 +103,7 @@
} catch (URISyntaxException e) {
throw new CourierException("Problems with message header ",e);
}
- /*
- if (null == m_conn) {
- try {
- m_conn = getConn();
- } catch (Exception e) {
- throw new CourierException(e);
- }
- }
-
- while (m_conn != null) {
- try {
- //TODO: Need to get the inserts working
- int iCol = 1;
- Query ins = insertStatement();
- return true;
- } catch (HibernateException e) {
- if (null != m_conn) {
- try {
- m_conn.rollback();
- } catch (Exception roll) {
- m_Logger.error("", roll);
- }
- }
-
- m_Logger.error("Hibernate exception during deliver", e);
- throw new CourierException(e);
- } catch (Exception e) {
- m_Logger.error("", e);
- }
- }
- */
return false;
}
@@ -160,249 +114,15 @@
public Message pickup(long millis) throws CourierException,
CourierTimeoutException {
- Message result = null;
- /*
- long limit = System.currentTimeMillis()
- + ((millis < 100) ? 100 : millis);
- do {
- try {
- List<String> list = getRowList();
-
- if (null != list) {
- for (String messageId : list) {
- if (null == (result = tryToPickup(messageId)))
- continue;
- return result;
- }
- }
- } catch (Exception e) {
- m_Logger.error("Exception during pickup", e);
- return null;
- } finally {
- if (m_conn != null) {
- try {
- m_conn.rollback();
- } catch (HibernateException e) {} //ignore
- }
- }
-
- try {
- long lSleep = limit - System.currentTimeMillis();
- if (m_pollLatency < lSleep)
- lSleep = m_pollLatency;
- if (lSleep > 0)
- Thread.sleep(lSleep);
- } catch (InterruptedException e) {
- return null;
- }
- } while (System.currentTimeMillis() <= limit);
- */
return null;
}
-
- /*
- private List getRowList() throws CourierException
- {
- if (null == m_conn)
- {
- try {
- m_conn = getConn();
- } catch (Exception e) {
- throw new CourierException(e);
- }
- }
- while (m_conn != null)
- {
- try {
- Query query = listStatement();
- return m_conn.execQuery(query);
- } catch (Exception e) {
- m_Logger.error("Problem getting row list", e);
- }
- }
- return null;
- }
- */
-
- /*
- protected Query listStatement()
- {
- if (null == m_prepGetList)
- try {
- String sb = "select x." + m_epr.getMessageField() + ", "
- + "x." + m_epr.getTimestampColumn() + " "
- + "from " + m_epr.getClassName() + " x "
- + "where x." + m_epr.getStatusField() + " = " + State.Pending.getColumnValue();
- m_prepGetList = getConn().getSession().createQuery(sb);
- } catch (Exception e) {
- m_Logger.debug("Unable to prepare list query", e);
- return null;
- }
- return m_prepGetList;
- }
- */
- /*
- private Query insertStatement() {
- if (null == m_prepInsert)
- try
- {
- String[] columns =
- {m_epr.getMessageField(), m_epr.getDataField(),
- m_epr.getStatusField(), m_epr.getTimestampColumn() };
-
- StringBuilder sb = new StringBuilder("insert into ").append(
- m_epr.getClassName()).append("(");
- int i1 = 0;
- for (String col : columns)
- sb.append((i1++ < 1) ? " " : ",").append(col);
- sb.append(") values (?,?,?,?)");
- m_prepInsert = getConn().getSession().createQuery(sb.toString());
- } catch (Exception e) {
- m_Logger.debug("Problem creating insertion query: ", e);
- return null;
- }
- return m_prepInsert;
- }
- */
- /*
- private Message tryToPickup(String messageId) {
- int iParm = 1;
-
- Query updateQuery = selectUpdateStatement();
- updateQuery.setString("messageid", messageId);
- updateQuery.setString("statusid", State.Pending.getColumnValue());
-
- while (m_conn != null) {
- try {
- List<String>list = m_conn.execQuery(updateQuery);
- for (String data : list) {
- Exception courEx = null;
- try {
- Message result = Util.deserialize((Serializable) data);
- deleteMsg(messageId);
- changeStatus(messageId, State.Done);
- return result;
- } catch (ClassCastException e) {
- m_Logger.debug("", e);
- courEx = e;
- } catch (SAXParseException e) {
- m_Logger.debug("", e);
- courEx = e;
- } catch (Exception e) {
- throw new CourierException(e);
- }
- if (null != courEx) {
- deleteMsg(messageId);
- changeStatus(messageId, State.Error);
- continue;
- }
- }
- return null;
- } catch (Exception e) {
- m_Logger.error("", e);
- }
- }
- return null;
- }
- */
-
- /*
- protected Query selectUpdateStatement() {
- if (m_prepSelUpd == null) {
- try {
- String sb = "select x." + m_epr.getDataField() + " "
- + "from " + m_epr.getClassName() + " x "
- + "where x." + m_epr.getMessageField() + " = :messageid "
- + "and x." + m_epr.getStatusField() + "= :statusid";
- Query query = getConn().getSession().createQuery(sb);
- } catch (Exception e) {
- m_Logger.error("Problem creating select statement", e);
- return null;
- }
- }
-
- return m_prepSelUpd;
- }
- */
-
- /*
- private void deleteMsg(String messageId) {
- Query delQuery = deleteStatement();
- delQuery.setString("messageid", messageId);
- m_conn.execQuery(delQuery);
- m_conn.commit();
-
- }
-
- private void changeStatus(String messageId, State to) {
- Query statusQuery = updateStatement();
- statusQuery.setString("statusid", messageId);
- statusQuery.setString("messageid", to.getColumnValue());
- m_conn.execQuery(statusQuery);
- m_conn.commit();
- }
-
- private Query deleteStatement() {
- if (null == m_prepDelete) {
- try
- {
- String delStatement = new String("delete " + m_epr.getClassName()
- + " x where x." + m_epr.getMessageField()
- + " = :messageid");
- m_prepDelete = getConn().getSession().createQuery(delStatement);
- } catch (Exception e) {
- m_Logger.error("Problem creating deletion query: ", e);
- return null;
- }
- }
- return m_prepDelete;
- }
-
- private Query updateStatement() {
- if (null == m_prepUpdate) {
- try {
- String upStatement = new String("update " + m_epr.getClassName() + " x "
- + "set " + m_epr.getStatusField() + " = :statusid"
- + "where x." + m_epr.getStatusField()
- + " = :messageid");
- m_prepUpdate = getConn().getSession().createQuery(upStatement);
- } catch (Exception e) {
- m_Logger.error("Problem creating update query: ", e);
- return null;
- }
- }
- return m_prepUpdate;
- }
-
- private HibernateConn getConn() throws MalformedEPRException
- {
- if (null == m_conn) {
- try {
- m_conn = new HibernateConn(m_epr.getHibernateCfgFile());
- } catch (URISyntaxException ex) {
- throw new MalformedEPRException(ex);
- }
- }
- return m_conn;
- }
-
- public void setPollLatency(Long millis)
- {
- if (millis <= 200)
- m_Logger.error("Poll latency must be >= 200 milliseconds - Keeping old value of "+ m_pollLatency);
- else
- m_pollLatency = millis;
- } // ________________________________
-
-
protected enum State {
Pending, WorkInProgress, Done, Error;
String getColumnValue() {
return toString().substring(0, 1);
}
}
- */
}
More information about the jboss-svn-commits
mailing list