RMI Callback and Threading

Discussion in 'Java' started by H. M?ller, Dec 21, 2004.

  1. H. M?ller

    H. M?ller Guest

    Hello,

    i build a thread pool that computes some kind of jobs. The jobs are
    delivered by a RMI call (one call with jobarray) to the server
    together with a reference to the client (RMI Callback). Each job was
    computed by an own thread. A pool thread gets its jobs from a queue,
    compute it and invokes a method on the client reference.

    Sometimes i get a Connection refused Exception when i do the callback,
    but other callbacks work well. So, i enclose the callback with a
    synchronization block:

    class PoolThread extends Thread {

    public PoolThread(IClient client) {
    this.client = client;
    }

    ....
    run() {
    ....
    synchronized (client) {
    client.returnJob(job);
    }
    ....
    }
    ....
    }

    Now it works, but i do not understand why. Can anybody give me a hint?
    Is it because of several threads doing the callback concurrently? Does
    the RMI framework not handle this case?

    Again, everything worked well without the invokation of a callback
    INSIDE a thead.

    regards
    Mr. Müller
    H. M?ller, Dec 21, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Molochnikov

    RMI callback and firewalls

    Alex Molochnikov, Jul 7, 2003, in forum: Java
    Replies:
    1
    Views:
    500
  2. Buu Nguyen

    RMI, JINI or RMI/IIOP

    Buu Nguyen, Aug 25, 2004, in forum: Java
    Replies:
    1
    Views:
    561
    Sudsy
    Aug 25, 2004
  3. JScoobyCed

    RMI Vs RMI over IIOP

    JScoobyCed, Jan 28, 2005, in forum: Java
    Replies:
    1
    Views:
    736
    Dag Sunde
    Jan 28, 2005
  4. Jan Schulze
    Replies:
    1
    Views:
    569
    Esmond Pitt
    Mar 26, 2005
  5. KDawg44

    RMI and Threading

    KDawg44, Oct 12, 2007, in forum: Java
    Replies:
    2
    Views:
    341
    Daniel Pitts
    Oct 13, 2007
Loading...

Share This Page