Jason Chaffee wrote:
> OK, Let's assume that I insatiate the class and register it with the
> MBeanServer in my code.  For example,
>
> LoggingMBean l = new Logging();
> ObjectName oName = new
> ObjectName("tvworks:app=test,name=Logging,type=Logging");
> MangementServer.registerMBean(l, oName);
>
> Would there be a way to do it then?
>   
  That is what Tim suggested. You can do something like this:

  private Map clusteredLoggings = new HashMap();

  ...
  String key = "tvworks:app=test,name=Logging,type=Logging"
  synchronize(this) {
    LoggingMBean l = (Logging) clusteredLoggings.get(key);
    if(l==null) {
      l = new Logging();
      MangementServer.registerMBean(l, new ObjectName(key));
      if(isClistered(oName)) {
        clusteredLoggings.put(key, l);
      }
    }
  }
  ...

  then you would mark clusteredLoggings as a Root in DSO and specify 
includes for your clustered classes.

  regards,
  Eugene

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Jason
> Chaffee
> Sent: Tuesday, October 23, 2007 3:35 PM
> To: [email protected]; [EMAIL PROTECTED]
> Subject: Re: [tc-users] [tc-dev] How to cluster MBeans
>
> That is the entire point of JMX, that you never directly have a handle
> on the object.  You can query and get a proxy, but you can't ever get
> the actual object from the MBeanServer. 
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Eugene
> Kuleshov
> Sent: Tuesday, October 23, 2007 3:32 PM
> To: [EMAIL PROTECTED]
> Cc: [email protected]
> Subject: Re: [tc-dev] [tc-users] How to cluster MBeans
>
>  
>   If I understand it correctly, objects returned from the 
> MLet.getMBeansFromURL() call are just object names, but you need to get 
> your hands and cluster the actual instances that are proxied by JMX. If 
> you completely delegate object creation to JMX factories (MLet, 
> MBeanServer, etc), then it will be hard to get the objects. I took a 
> quick look at Sun's JMX implementation included into Java 5 and later. 
> Its javax.management.MBeanServer.createMBean() implementation (which is 
> called by MLet) delegates to some internal classes and only those 
> internal classes have collections of the real objects.
>
>   regards,
>   Eugene
>
>
> Jason Chaffee wrote:
>   
>> I have attached the LoggingMBean interface and the javadoc should be
>> self-explanatory.  We have a custom mlet (see beolow), that we load
>>     
> and
>   
>> figure out the class and ObjectName and then we use the MBeanServer
>> api's to instantiate and register the MBean.  We use the container's
>> MBeanServer for deployed apps in that instance, in this case it is
>> Tomcat.  For example,
>>
>> <MLET archive="dummy.jar" code="com.foo.Logging"
>> name="tvworks:app=test,name=Logging,type=Logging"/>
>>
>> javax.management.loading.MLet.getMBeansFromURL(String url);
>>
>> -----Original Message-----
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of Eugene
>> Kuleshov
>> Sent: Tuesday, October 23, 2007 2:25 PM
>> To: [email protected]
>> Cc: [EMAIL PROTECTED]
>> Subject: Re: [tc-dev] [tc-users] How to cluster MBeans
>>
>>
>>   Most likely yes. Would you mind to create a small app that will show
>>     
>
>   
>> how you create and use Logging
>> and LoggingMBean? It will be easier to figure out what could be done
>> then.
>>
>>   regards,
>>   Eugene
>>
>>
>>   
>>     
>
> _______________________________________________
> tc-dev mailing list
> [email protected]
> http://lists.terracotta.org/mailman/listinfo/tc-dev
> _______________________________________________
> tc-users mailing list
> [EMAIL PROTECTED]
> http://lists.terracotta.org/mailman/listinfo/tc-users
> _______________________________________________
> tc-users mailing list
> [EMAIL PROTECTED]
> http://lists.terracotta.org/mailman/listinfo/tc-users
>   

_______________________________________________
tc-dev mailing list
[email protected]
http://lists.terracotta.org/mailman/listinfo/tc-dev

Reply via email to