I have:
Map<String, ExtractData> extractMap = new HashMap<String, ExtractData>();
Why would the following method not get return data from the method it calls?
private void fetchExtractData(CentralExportSession exportSession) throws RemoteException {
System.out.println("Fetching Extract Data");
extractMap = exportSession.getExtractData(consDB);
System.out.printLn("Extract Data Fetched");
}
This calls into:
public Map<String, ExtractData> getExtractData(DataSourceInfo ds) throws RemoteException {
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
Map<String, ExtractData> extractMap = new HashMap<String, ExtractData>();
String qry = "...select statement that returns about 500k rows...;"
try {
conn = getConnection();
ps = conn.PrepareStatment(qry);
rs = ps.executeQuery();
while (rs.next()) {
String dataKey = rs.getString("key");
ExtractData data = new ExtractData();
...code that builds up the 'data' object from the result...
extractMap.put(dataKey, data);
System.out.println("Added key : " + dataKey);
}
} catch (SQLException e) {
e.printStackTrace();
throw new EJBException(e);
} finally {
System.out.println("Cleaning up...");
cleanup(conn, ps, rs);
System.out.println("Returning Map extractMap...");
return extractMap;
}
}
The "Fetching Extract Data" prints, as do the "Added Key :", "Cleaning up..." and "Returning Map extractMap..." but not the "Extract Data Fetched" in the calling method. I get no visible exceptions, control just is never passed back to the calling method and my CPU usage goes through the roof until I kill it.
Edit: I've tried moving the "return" statement to both inside the "try" block (after the "while") and after the "finally" block with no difference. The location of the return statement does not affect the (lack of) outcome.
It seems to be a memory issue as artificially limiting the resultset to 200k rows allows it to run, but once I go much past that...