Announcement Announcement Module
Collapse
No announcement yet.
How remote invocation works? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How remote invocation works?

    Am using acegi's ContextPropagatingRemoteInvocationFactory to propagate context from client to server. Just out of curiosity I would like to know how this context is propagated? Basically the function of remote invocation factory is not clear to me. I have noticed that if my service extends the Remote interface, the custom invocation factory is not called and in my case context is not propagated from client to server.
    Thanks,
    Kapil

  • #2
    What are you using to invoke the remote service? RmiProxyFactoryBean has a remoteInvocationFactory property which you set to an instance of ContextPropagatingRemoteInvocationFactory.

    Comment


    • #3
      Yes, am using the remoteInvocationFactory property of RmiProxyFactoryBean and assigning it an instance of ContextPropagatingRemoteInvocation Factory.

      My question was how the context is propagated? Does it make two remote calls, first to set the context and then the original method call.
      My second query was if my service extends the Remote interface, then the context is not propagated infact the property remoteInvocationFactory has no effect, may be because there is a check in the RmiClientInterceptor class for the type of stub
      Code:
      if (stub instanceof RmiInvocationHandler) {
      			// RMI invoker
      	try {
      		return doInvoke(invocation, (RmiInvocationHandler) stub);
      	}...
              else {
                 try {
      	      return RmiClientInterceptorUtils.doInvoke(invocation, stub);
               }
      }

      Comment


      • #4
        You may need to just download the source and read it yourself

        This is what I like about open source! You can just download the source code and read the guts of it yourself.

        I was very interested in subclassing SecurityContext so I could embed my own custom attributes and pass them through remote procedure calls to the server. I had to download their source code to understood how this mechanism works. Once I saw, I realized it isn't that complicated.

        P.S. No, it doesn't make two remote calls. That would be too expensive!

        Comment


        • #5
          Could you please elaborate a bit on how context is passed from one JVM to other?
          Thanks,
          Kapil

          Comment


          • #6
            Which part of "download the source code" do you not understand?

            1. Download the source
            Code:
            svn co https://svn.sourceforge.net/svnroot/acegisecurity/trunk/acegisecurity
            2. Find the class you are curious about
            Code:
            find . -name 'ContextPropagatingRemoteMethodInvocationFactory.java' -print
            3. Read it!

            4. And then find who else uses either the class or the interface, to see where this gets "plugged in". (Another hint, read the test cases to see how it is utilized).
            Code:
            find . -name '*.java' -exec grep ContextPropagatingRemoteMethodInvocationFactory {} \; -print
            find . -name '*.java' -exec grep RemoteInvocationFactory {} \; -print
            BTW: Shouldn't this really be on Acegi's forum (like the other time you brought up this issue?)
            BTW2: Have you searched this site using the keyword "ContextPropagatingRemoteMethodInvocationFacto ry"?

            Comment

            Working...
            X