Stopping the method until another execution finished?
<p>I have a for loop which adds 50,000 objects to ArrayList like shown below, so it takes longer time to execute. </p>

<pre><code>public List&lt;GoogleFeedEntry&gt; getEntries(Iterator it) {
    GoogleFeedUtil gfu = new GoogleFeedUtil(host, prefix, domain, serverName);
    List&lt;GoogleFeedEntry&gt; entry = new ArrayList&lt;GoogleFeedEntry&gt;();
    GoogleFeedEntry gfe;
    GoogleFeedEntryShipping shipping;
    while (it.hasNext()) {
        gfe = new GoogleFeedEntry();
        shipping = new GoogleFeedEntryShipping();
        ProductBO product = (ProductBO) it.next();

        entry.add(gfe);
    }
    return entry;
}
</code></pre>

<p>After this method I am calling another method something like </p>

<pre><code>public void doSomething(){
         //some code here
}
</code></pre>

<p>I am calling these two methods inside another method. IF i put limited number of Objects to list then it is working with out any problem. In case of 50,000 objects it is throwing following exception </p>

<pre><code>java.sql.SQLException: Maximum open cursors exceeded ORA-01000
</code></pre>

<p>I felt this is nothing to do with oracle(If i am correct). ofcourse i am loading all the objects from the database. </p>

<p>When i set the break point  at the first method then it is working fine. </p>

<p>How can I stop second method until the first method executes?</p>

<p>What could be the reason? </p>
