I have written the following agent. At the end of the agent run (which is successful), I am seeing, in the console, “Error cleaning up agent threads”. What can I do to ensure that any open threads are properly closed in this agent?import lotus.domino.*;
import java.sql.*;
import java.io.*;
public class JavaAgent extends AgentBase {
String server = "BSYS";
String lib = "ISPRDDTA";
String file1 = "STORTBL00";
String file2 = "DISTTBL00";
String storenum = "";
public void NotesMain() {
String tmpDist = "";
String tmpDistManager = "";
String qry = "";
String storenum = "1";
try {
System.out.println("Starting....");
Session session = getSession();
DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver());
Connection conn = DriverManager.getConnection("jdbc:as400://" + server, "ODBCUSER", "odbcsmrt");
Statement stmt = conn.createStatement(); //error coming up here
qry = "Select DISTRICT FROM " + lib + "." + file1 + " WHERE location = '" + storenum + "'";
ResultSet rs1 = stmt.executeQuery(qry);
// ResultSet rs1 = stmt.executeQuery(“Select DISTRICT FROM ISPRDDTA.STORTBL00 WHERE location = ‘1’”);
System.out.println("ResultSet1 created");
while (rs1.next()) {
System.out.println("populate the variable");
tmpDist = rs1.getString(1).trim();
System.out.println("String object tmpDist created");
}
System.out.println("close the result set");
rs1.close();
System.out.println("First result returned = " + tmpDist);
ResultSet rs2 = stmt.executeQuery("Select dstmgr FROM " + lib + "." + file2 + " WHERE district = '" + tmpDist + "'");
// ResultSet rs2 = stmt.executeQuery(“Select dstmgr FROM ISPRDDTA.DISTTBL00 WHERE district = ‘1’”);
System.out.println("ResultSet2 created");
while (rs2.next()) {
System.out.println("populate the variable");
tmpDistManager = rs2.getString(1).trim();
System.out.println("String object tmpDistManager created");
}
System.out.println("close the result set");
rs2.close();
System.out.println("Second result returned = " + tmpDistManager);
rs1 = null;
rs2 = null;
stmt = null;
conn = null;
session.recycle();
}catch(Exception e){
//e.printStackTrace();
System.err.println("ERROR: " + e.getMessage());
System.gc();
}
}
}