Dear All
    I keep clicking the data to h2 by stmt.addBatch(), after i called 
executeBatch, memory is not free, so finally out of memory, may i know why 
please?


@Override
public void run() {
while (!stopped) {
synchronized (sharedLock) {
try {
// System.out.println("data.size() =" + data.size());
for (int z = 0; z < data.size() && z < 100000; z++) {
Object[] temp;
synchronized (data) {
temp = data.pollLast();
}
int x = 1;
stmt.setLong(x++, (Long) temp[0]);
stmt.setString(x++, (String) temp[1]);
stmt.setString(x++, (String) temp[2]);
stmt.setString(x++, (String) temp[3]);
stmt.setInt(x++, (int) temp[4]);
for (int tempX = 0; tempX < registers.size(); tempX++) {
stmt.setLong(x, ((BigInteger) temp[x - 1]).longValue());
x++;
}
stmt.addBatch();
}
if (data.size() % 100000 == 0 || data.size() < 100000) {
stmt.executeBatch();
conn.commit();
}
} catch (SQLException ex) {
Logger.getLogger(H2Thread.class.getName()).log(Level.SEVERE, null, ex);
}
}
try {
Thread.sleep(500);
} catch (InterruptedException ex) {
Logger.getLogger(H2Thread.class.getName()).log(Level.SEVERE, null, ex);
}
}
}

thanks
Peter (mcheun...@hotmail.com)

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/09011104-d11a-4e5a-b1cf-0d4b59138ad4n%40googlegroups.com.

Reply via email to