Access to the singleton from any node in the cluster is some behaviour we think JBoss needs in general. However, we haven't found a clean generic solution to this problem.
In the meantime, you can do something by adding
the follow to deploy-hasingleton
singleton-jmx-adapter-service.xml
<server> <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory" name="jboss.jmx:type=singletonadaptor,name=Invoker,protocol=jrmp,service=proxyFactory"> <!-- Use the standard JRMPInvoker from conf/jboss-service.xxml --> <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=jrmp</depends> <!-- The target MBean is the InvokerAdaptorService configured below --> <depends optional-attribute-name="TargetName">jboss.jmx:type=adaptor,name=Invoker</depends> <!-- Where to bind the RMIAdaptor proxy --> <attribute name="JndiName">jmx/invoker/SingletonRMIAdaptor</attribute> <!-- The RMI compabitle MBeanServer interface --> <attribute name="ExportedInterfaces">org.jboss.jmx.adaptor.rmi.RMIAdaptor,org.jboss.jmx.adaptor.rmi.RMIAdaptorExt</attribute> <attribute name="ClientInterceptors"> <interceptors> <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor> <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor> <interceptor>org.jboss.jmx.connector.invoker.client.InvokerAdaptorClientInterceptor</interceptor> <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor> </interceptors> </attribute> </mbean> </server>
This will bind an RMIAdapter into jndi at
jmx/invoker/SingletonRMIAdaptor
but because it is in deploy-hasingleton it will only be bound
on the same server as jms.
You can then use HAJNDI to lookup this adapter
and know all requests go to the same server as the jms server.
--Adrian
You can also access the HA Singleton via the actual services interface instead of org.jboss.jmx.adaptor.rmi.RMIAdaptorExt. So for example if we wanted to access a service with the following interface com.platform.management.logging.distributed.RemoteServerLoggerMBean, then we would use something like the following:
<server> <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory" name="jboss.jmx:type=adaptor,name=SingletonInvoker,protocol=jrmp,service=proxyFactory"> <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=pooled</depends> <depends optional-attribute-name="TargetName">my.domain:service=HaRemoteLoggingService</depends> <attribute name="JndiName">jmx/invoker/SingletonRMIAdaptor3< /attribute> <attribute name="InvokeTargetMethod">true</attribute> <attribute name="ExportedInterfaces"> com.platform.management.logging.distributed.RemoteServerLoggerMBean </attribute> <attribute name="ClientInterceptors"> <interceptors> <interceptor>org.jboss.proxy.ClientMethodInterceptor< /interceptor> <interceptor>org.jboss.invocation.InvokerInterceptor< /interceptor> </interceptors> </attribute> </mbean> </server>
-- snoobabk
Related links
related page describing direct object access
Comments