2 Replies Latest reply on Jan 19, 2005 9:34 AM by madeonmoon

    design issue. stuck. please advice!

    madeonmoon

      hello all,

      this might not belong to this forum but i can't find a more appropriate as i am considering using JMX to accomplish the task:

      i have several instances of jboss (app1, app2) and each one has a custom written cache (written as a singleton wrapped within a session bean), i'd like one of the instances (app1) to be able to flush the cache within the other instance (app2). i realize that this will require a remote call from app1 to app2. however, i'd like to be able to read the hostname (in order to make the remote call) for the app2 dynamically by the app1.

      i was thinking of writing an MBean that runs within the app2 and configures hostname, datadir, etc for the app2. but will app1 have access to it? if so, how would it refer to it?

      thanks for any help!
      james

        • 1. Re: design issue. stuck. please advice!
          dimitris

          You need to lookup the Session bean registered to appServer2's JNDI from appServer1. A simple way is to get an InitialNamingContext in appServer1, using appServer2 JNDI settings.

          Another way would be to use HA-JNDI where you can have a unified naming space, thus looking up objects across servers.

          • 2. Re: design issue. stuck. please advice!
            madeonmoon

            Dimitris,

            thanks for your reply. this sounds good. now the second part of the problem is, i'd like to configure a set of properties (hostname, datadir) for the app2 dynamically so that i can deploy the app2 in dev, stage, prod just by running the same ant target (deploy). hence, i was thinking of an MBean whose mymbean-service.xml will contain dev, stage and prod values depending on the environment it is in.

            i assume it's simple for the session bean in the app2 to have access to the values MBean configured.

            can you see a better way of handling this? would i be better off using jbosscache at all?

            thanks again!
            james