RMI blocks until remote method return even when new thread is executing inside : <p>Scenario: I have a server that distributes summation problem to registered calculators. </p>

<p>The problem is that when server starts calculators remotely, he executes them inorder (wait for each one to return) although the calculation inside calculator  should be done in a separate thread (thus it should return immediately).</p>

<p>Moreover, when I try to get type of current executing thread inside the calculator by parsing it to my thread type, I get error... and if I executed <em>wait</em> inside that thread, server thread stops instead. </p>

<p>Here is my code:</p>

<p>method inside server that solves a problem (this method is also called remotely by a client but I don't think this is related to what is happening)</p>

<pre><code>@Override
public void solveProblem(Agent a, IClient client) throws RemoteException {
    Runnable thread = new Runnable(){
        @Override
        public void run()
        {
                //some variable initialization...
                for(int i=0;i&lt;calcs.size();i++)
                {
                    try {
                        calcs.get(i).delegate(a, chosen);
                        System.out.println("delegate to "+i+" done");
                    } catch (RemoteException e) {
                        e.printStackTrace();
                    }
                }
         }
    };
}
</code></pre>

<p>calculator: delegate method initialises new thread and start calculation</p>

<pre><code>@Override
public void delegate(Agent a, ICalculator original) throws RemoteException {
    receivedCount=0;
    thread = new CalculationThread(a, original);
    thread.run();
}
</code></pre>

<p>CalculationThread is an inner class within CalculatorImpl Class</p>

<pre><code>class CalculationThread extends Thread{
    private Agent a;
    private ICalculator original;
    public String name = "Calculation Thread";
    public CalculationThread(Agent a, ICalculator original) {
        this.a=a;
        this.original=original;
    }
    @Override
    public String toString()
    {
        return "Original Calculation Thread";
    }
    @Override
    public void run()
    {
        //start calculation
        System.out.println("----start new query----");
        double result = 0;
        for(double n=a.lowerBound;n&lt;=a.upperBound;n++)
        {
            result += Math.pow(-1, n)/(2*n+1);
        }
        result = result*4;
        System.out.println("Finished with result("+a.lowerBound+","+a.upperBound+"):"+result);

    }
}
</code></pre>

<p>Any body can explain what's the problem here?</p>
