10 Replies Latest reply on Jul 17, 2006 1:24 AM by Tom Elrod

    Client connections.

    Kurt De Wit Newbie

      Hello everyone,

      A very simple question. Does the JBoss EJB container, or perhaps the naming service or any other service within JBoss, keep track of connected client applications? Does it maintain a reference to for example the client proxy? If so, where does it maintain these references and on what basis are they kept? Can they be accessed from within deployed services?

      Greetings and thanks for your response!!

      Kurt

        • 1. Re: Client connections.
          Tom Elrod Master

          IIRC there is no way to do this with any of the J2EE components (except JMS, but is not a direct reference to the client).

          The JBossRemoting project has a way track failed clients and push callbacks to the client from the server, but this project is not an implementation covered under any standard specification.

          What is the use case for this?

          • 2. Re: Client connections.
            Kurt De Wit Newbie

            Hi Tom,


            I was just wondering if it was possible to write a mechanism that allowed us to trigger all connected J2EE client applications when for example an enterprise javabean was triggered by another client using the same application at server side.

            This way we could create real model view controller up to server level and push changes in the persistent store to all connected clients without forcing our clients to poll the server every now and then. Not a feature defined by any standard specification, I know, but a nice feature if it existed.

            Have there been any attempts within JBoss in the past to provide such functionality? Or is it really a brand new idea that I'm introducing now ;-) As far as I can imagine, people should have been asking this kind of question before. Are there any plans to provide this kind of behaviour?


            Greetings,
            Kurt

            • 3. Re: Client connections.
              Bill Burke Master

              why don't you use JMS for this?

              • 4. Re: Client connections.
                Kurt De Wit Newbie

                I prefer not to use JMS because I want synchronous communication between client and server.
                JMS can create a delay between client request and processing at server level, since it does not specify time constraints in processing requests. I want to prevent those type of delays in my application.

                Otherwise, JMS would solve to problem of course.

                Cheers,
                Kurt

                • 5. Re: Client connections.
                  Kurt De Wit Newbie

                  Is it possible to modify the code to provide this functionality or would it require to much modifications at server level?

                  Greets,
                  Kurt

                  • 6. Re: Client connections.
                    Tom Elrod Master

                    Well, could never be totally synchronous as would have to call on the other clients when one client made an synchronous invocation (basically making those other clients accept callbacks). This is also going to require some server component to be running within each of these client instances. There is also the issue of state synchronizations (i.e. client A makes invocation on server at the same time client B makes an invocation on the server... each could then be pushing different state back to the other client).

                    This *could* be accomplished with JBossRemoting, but is going to require having a callback server in each client. This could also be done via JMS, as already mentioned, or could even setup via JMX Remoting, where state change on server would fire notification and could have clients registered as notification listeners. In the end, is going to require some work to wire up the clients with something to receive the state change from the server via asyn mechanism.

                    • 7. Re: Client connections.
                      Kurt De Wit Newbie

                      Hi Tom,


                      Indeed, the issue about multiple clients invoking the application at the same time could cause some difficulties. The question was rather simple, the answer is not. I'm going to re-evaluate my concept and try to solve it by using JMS as proposed earlier in this discussion.

                      Thank you to all for your input and your time. If I find a way to implement my first proposal (which will be quite a challenge I guess) I'll let you know ;-)

                      Greetings and keep on going JBoss!!!!


                      Regards,
                      Kurt

                      • 8. Re: Client connections.
                        Tom Elrod Master

                        Sure. No problem.

                        If you happen to come across another solution not mentioned that works for you, please let us know (as would be very cool and would love to know how you did it ;) ).

                        • 9. Re: Client connections.
                          Kurt De Wit Newbie

                          Hi everybody,


                          I recently got back working to this matter again and was wondering the following. Is there a way to distinct a call to lets say to a stateless session bean X in the container performed by client A on a certain remote machine A and a similar call to the same method defined in the same EJB X from within client B residing on a separate machine B?

                          As far as I know, this will cause two instances being assigned to the calling client application within the container in their own thread.
                          What I want to do is shift an interceptor in the request chain which can be performed quite easy, and provide a mechanism to distinguish the two method calls from eachother.
                          Does either the InvocationContext, the EnterpriseContext or some other object referenced by the Invocation within this interceptor contain such information or do I have to do something else to make this separation possible?


                          Regards,
                          Kurt

                          • 10. Re: Client connections.
                            Tom Elrod Master

                            Think there are only two ways to do this. First is to create an interceptor on client and server side that embeds client id in the Invocation object. The second would be to modify org.jboss.aspects.remoting.AOPRemotingInvocationHandler. It's invoke() method receives a org.jboss.remoting.InvocationRequest as it's parameter. The InvocationRequest already contains the remoting client id, which can get by calling getSessionId() on it.