Re: Intercepting a socket connection from independent JVM

Discussion in 'Java' started by John C. Bollinger, Jul 17, 2003.

  1. Rubel Kanubel wrote:
    > It'd be nice to get some opinions/solutions about the following case:
    > Background:
    > I'm implementing a server application in java. The server is to accept
    > socket connections on a specified port. It is going to experience
    > heavy load and it's therefore desirable to design the server so that
    > it is run using mulitple
    > Java Virtual Machines (JVMs), i.e 2 independent machines each running
    > an instance of the server engine. I've implemented this by always
    > making sure there is at most 1 active listener on the port. The
    > listener accepts incoming connections and starts a new thread for
    > incoming request to do so.

    So why is it that these two instances of the engine need to be in
    different JVMs? Handling heavy load is not a sufficient answer -- it is
    not clear that you could not do the same thing in one JVM that you are
    now doing in two, and there are advantages to keeping things together.
    I'd say that it's desirable to design the server so that it uses
    multiple _threads_, but that doesn't require multiple JVMs.

    > Problem:
    > Now, I'd like to implement the following... A file server running (in
    > its own JVM) independently of the main server. This file server should
    > be able to utilise Socket connection already accepted and bound by the
    > main server listener described above.

    And why does this service also need its own JVM?

    > My question is simply: Is this possible? In other words, given two
    > independent JVMs, JVM1 and JVM2. Is it possible from JVM1 to intercept
    > a bound socket connection that has been established in JVM2?

    It depends on what exactly you mean by that. You haven't mentioned any
    Java classes by name, so I am uncertain whether you intend to try to do
    this at the Java level or at the native level. Either way, it is
    extremely unlikely that you could preemptively snatch (or "intercept") a
    connected socket from another process without the other process'
    cooperation. It would be a massive security hole if that were possible.

    It sounds to me like you are raising artificial (and inconvenient)
    barriers between parts of a single logical application by splitting
    pieces off into different JVMs on the same physical machine. There are
    sometimes reasons to splitting up an application like that, but you
    haven't mentioned any of the ones I recognize. You need to rethink your

    John Bollinger
    John C. Bollinger, Jul 17, 2003
    1. Advertisements

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. Al
    Jul 1, 2003
  2. Kevin Hooke

    Re: Handling both MS JVM and Sun JVM

    Kevin Hooke, Aug 26, 2003, in forum: Java
  3. Lasse
    Jon A. Cruz
    Jan 5, 2004
  4. Young-Jin Lee

    MS JVM and Sun JVM problem

    Young-Jin Lee, Jan 20, 2004, in forum: Java
    Mickey Segal
    Jan 21, 2004
  5. Laszlo Nagy
    Mark Wooding
    Jan 27, 2009

Share This Page