Commit e6864acb authored by akhokar's avatar akhokar

Changes done for connection not getting closed

PaymentExpPaid.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@200740 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7470fae6
...@@ -6,14 +6,17 @@ Action : The voucher will be paid.It will update CONFIRMED field of PAYMENT ...@@ -6,14 +6,17 @@ Action : The voucher will be paid.It will update CONFIRMED field of PAYMENT
package ibase.webitm.ejb.fin.adv; package ibase.webitm.ejb.fin.adv;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.*; import java.sql.Connection;
import javax.ejb.*; import java.sql.ResultSet;
import java.sql.Statement;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.system.config.*;
import javax.ejb.Stateless; // added for ejb3 import javax.ejb.Stateless; // added for ejb3
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.utility.ITMException;
@Stateless // added for ejb3 @Stateless // added for ejb3
public class PaymentExpPaid extends ActionHandlerEJB implements PaymentExpPaidLocal,PaymentExpPaidRemote // SessionBean public class PaymentExpPaid extends ActionHandlerEJB implements PaymentExpPaidLocal,PaymentExpPaidRemote // SessionBean
...@@ -45,27 +48,47 @@ public class PaymentExpPaid extends ActionHandlerEJB implements PaymentExpPaidLo ...@@ -45,27 +48,47 @@ public class PaymentExpPaid extends ActionHandlerEJB implements PaymentExpPaidLo
String varValue = ""; String varValue = "";
Connection conn = null; Connection conn = null;
String retString = ""; String retString = "";
ConnDriver connDriver = new ConnDriver(); //Modified by Azhar K. on [13-05-2019][To do changes for connection not getting closed][Start]
//ConnDriver connDriver = new ConnDriver();
//Modified by Azhar K. on [13-05-2019][To do changes for connection not getting closed][End]
try try
{ {
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
//Changes and Commented By Bhushan on 06-06-2016 :START //Changes and Commented By Bhushan on 06-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM"); //conn = connDriver.getConnectDB("DriverITM");
conn = getConnection(); conn = getConnection();
//Changes and Commented By Bhushan on 06-06-2016 :END //Changes and Commented By Bhushan on 06-06-2016 :END
varValue = itmDBAccessEJB.getEnvFin("999999","DIRECT_PAY_PAID",conn); varValue = itmDBAccessEJB.getEnvFin("999999","DIRECT_PAY_PAID",conn);
if (varValue.equalsIgnoreCase("Y")) if (varValue.equalsIgnoreCase("Y"))
{ {
retString = actionPaid(tranID,xtraParams); retString = actionPaid(tranID,xtraParams);
} }
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("Exception :PaymentExp :actionHandler(String xmlString):" + e.getMessage() + ":"); System.out.println("Exception :PaymentExp :actionHandler(String xmlString):" + e.getMessage() + ":");
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
return retString; //Modified by Azhar K. on [13-05-2019][To do changes for connection not getting closed][Start]
finally
{
try
{
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
//Modified by Azhar K. on [13-05-2019][To do changes for connection not getting closed][End]
return retString;
} }
//Default Button //Default Button
private String actionPaid(String tranID, String xtraParams) throws RemoteException,ITMException private String actionPaid(String tranID, String xtraParams) throws RemoteException,ITMException
...@@ -83,9 +106,9 @@ conn = getConnection(); ...@@ -83,9 +106,9 @@ conn = getConnection();
try try
{ {
//Changes and Commented By Bhushan on 06-06-2016 :START //Changes and Commented By Bhushan on 06-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM"); //conn = connDriver.getConnectDB("DriverITM");
conn = getConnection(); conn = getConnection();
//Changes and Commented By Bhushan on 06-06-2016 :END //Changes and Commented By Bhushan on 06-06-2016 :END
sql = "SELECT CASE WHEN CONFIRMED IS NULL THEN 'N' ELSE CONFIRMED END FROM PAYMENT_EXP WHERE TRAN_ID = '"+ tranID +"'"; sql = "SELECT CASE WHEN CONFIRMED IS NULL THEN 'N' ELSE CONFIRMED END FROM PAYMENT_EXP WHERE TRAN_ID = '"+ tranID +"'";
stmt = conn.createStatement(); stmt = conn.createStatement();
rs = stmt.executeQuery(sql); rs = stmt.executeQuery(sql);
...@@ -107,11 +130,11 @@ conn = getConnection(); ...@@ -107,11 +130,11 @@ conn = getConnection();
} }
else if (confirm.equalsIgnoreCase("P")) else if (confirm.equalsIgnoreCase("P"))
{ {
errCode = "VTPAID2"; errCode = "VTPAID2";
} }
else else
{ {
errCode = "VTMCONF1"; errCode = "VTMCONF1";
} }
if (errCode != null && errCode.trim().length() > 0) if (errCode != null && errCode.trim().length() > 0)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment