I'm trying to record data in DB. I used IHistory to colect the bars from the latest 3 months for every instruments.
I colect each instrument, record in DB, for BID side then for ASK side.
The system is running some of the following messages show up in console:
"Strategy thread queue overloaded with tasks. Ticks in queue - 35, bars - 0, other tasks - 568"?
After some of this message appears in the console, an error occurs:
java.lang.OutOfMemoryError: Java heap space
at java.nio.HeapByteBuffer.<init>(Unknown Source)
at java.nio.ByteBuffer.allocate(Unknown Source)
at org.apache.mina.common.SimpleByteBufferAllocator.allocate(SimpleByteBufferAllocator.java:45)
at org.apache.mina.common.ByteBuffer.allocate(ByteBuffer.java:225)
at org.apache.mina.common.ByteBuffer.allocate(ByteBuffer.java:214)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.read(SocketIoProcessor.java:210)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.process(SocketIoProcessor.java:198)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.access$400(SocketIoProcessor.java:45)
at org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:485)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
at java.lang.Thread.run(Unknown Source)
I had already tryed to kill every created object that is not in use anymore, but it didn't work.
I thought the range between dates were to long but works for one side and for the beginning of the other one...
What could it be?
Here goes the code I'm running:
String strPeriod = period.name();
List<IBar> barras = history.getBars(instrument, period, side,
dateFrom, dateTo);
if (barras.size() != 0) {
for (int i = 0; i < barras.size(); i++) {
IBar barra = barras.get(i);
boolean isWknd = TrataDiaHora
.IsWeekend(barra.getTime());
if (!isWknd) {
this
.adicionaBar(barra, side, strPeriod,
instrument);
}
barra = null;
}
}
barras = null;
dtNow = null;
dtFrom = null;
dtTo = null;
Please help!
Thanks.
Eduardo.