[Design of JBossCache] - JBCACHE-1001 Discussion Thread
by bstansberry@jboss.com
Discussion related to http://jira.jboss.com/jira/browse/JBCACHE-1001.
"Galder Zamarreno" wrote :
| Brian,
|
| Indeed, Hibernate create the cache instances themselves:
|
| OptimisticTreeCacheProvider:
| ....
| cache = new org.jboss.cache.TreeCache();
| PropertyConfigurator config = new PropertyConfigurator();
| config.configure( cache, resource );
| TransactionManagerLookup transactionManagerLookup =
| ....
|
| so they should call startService()/stopService()
|
| However, if they do this, they've never gonna get this cache
| registered in MBeanServer, even if it runs inside AS.
|
| I guess it would then be customer's responsability to make
| sure that the cache config file ends in *-service.xml and they
| make use of:
|
| hb-cache-service.xml
|
| The downside of all this is that, in my standalone example, I
| would need to code myself the registration of this cache into the an
| MBeanServer so that later I can use JConsole to inspect it, correct?
|
In 1.4.x, the cache registers itself and its interceptors in JMX. (In 2.0 you need to use a wrapper class if you want that; something we need to make sure works right with Hibernate.)
This is why the reported error was javax.management.InstanceNotFoundException. If the cache hadn't been registered in JMX and you called stop(), it would have worked. That's why you needed to use -Dcom.sun.management.jmxremote to see the failure.
Probably in 1.4.x, JBC should override create/start/stop/destroy such that they don't invoke on the ServiceController if it isn't present. One possible way to do that:
| private boolean useServiceController = false;
|
| public void postRegister(Boolean registrationDone)
| {
| super.postRegister(registrationDone);
|
| if (registrationDone.booleanValue())
| {
| // Confirm that the ServiceController is registered; if not, don't
| // use the superclass lifecycle methods
| try
| {
| server.getMBeanInfo(ServiceController.OBJECT_NAME);
| useServiceController = true;
| }
| catch (Throwable t)
| {
| useServiceController = false;
| }
| }
| }
|
| public void create() throws Exception
| {
| if (useServiceController)
| {
| super.create();
| }
| else
| {
| createService();
| }
| }
|
| ... repeat for start()/stop()/destroy()
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026321#4026321
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026321
19 years, 1 month
[Design of EJB 3.0] - Re: IsLocalInterceptor not detecting local container
by bstansberry@jboss.com
No, IsLocalInterceptor only checks whether it itself was created in VM and routes locally if it was. Basically, it's:
| private static final long stamp = System.currentTimeMillis();
| private long marshalledStamp = stamp;
|
| private boolean isLocal()
| {
| return stamp == marshalledStamp;
| }
|
| public Object invoke(Invocation invocation) throws Throwable
| {
| if (isLocal())
| {
| ... bypass remoting; route directly to Container
| return result;
| }
| else
| {
| // continue on to remoting
| return invocation.invokeNext();
| }
| }
|
Now that I think about it, that's definitely not good enough; you have to check for the local bean before routing locally. What if it's been undeployed locally, but some proxy is stored in-VM somewhere (e.g. in a web session)? The way it is now the call will fail.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026256#4026256
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026256
19 years, 1 month