/** * Whether there is a local target * * @param invocation * @return true when in the registry */ public boolean hasLocalTarget(Invocation invocation) { return Registry.lookup(invocation.getObjectName()) != null; }
/** * Lookup the invokers in the object registry. This typically cannot * be done until our start method as the invokers may need to be started * themselves. */ protected void setupInvokers() throws Exception { ObjectName oname = new ObjectName(invokerMetaData.getInvokerMBean()); Invoker invoker = (Invoker) Registry.lookup(oname); if(invoker == null) { throw new RuntimeException("invoker is null: " + oname); } homeInvoker = beanInvoker = invoker; }
/** Create a composite proxy for the given interfaces, invoker. @param id the cache id for the target object if any @param targetName the name of the server side service @param invokerName the name of the server side JMX invoker @param jndiName the JNDI name the proxy will be bound under if not null @param proxyBindingName the invoker-proxy-binding name if not null @param interceptorClasses the Class objects for the interceptors @param loader the ClassLoader to associate the the Proxy @param ifaces the Class objects for the interfaces the Proxy implements */ public Object createProxy(Object id, ObjectName targetName, ObjectName invokerName, String jndiName, String proxyBindingName, ArrayList interceptorClasses, ClassLoader loader, Class[] ifaces) { Invoker invoker = (Invoker) Registry.lookup(invokerName); if (invoker == null) throw new RuntimeException("Failed to find invoker for name: " + invokerName); return createProxy(id, targetName, invoker, jndiName, proxyBindingName, interceptorClasses, loader, ifaces, null); }
private Object createProxy(Object value) throws Exception{ delegateInvoker = (Invoker)Registry.lookup(jmxInvokerName); log.debug("Using delegate: " + delegateInvoker + " for invoker=" + jmxInvokerName); //TODO -- Look at this calculateHashes(value.getClass()); final Class[] targetInterfaces = value.getClass().getInterfaces(); final ArrayList interceptorList = new ArrayList(); Object cacheID = new Integer(value.hashCode()); String proxyBindingName = null; String jndiName = null; interceptorList.add(ClientMethodInterceptor.class); interceptorList.add(InvokerInterceptor.class); ClassLoader loader = Thread.currentThread().getContextClassLoader(); GenericProxyFactory proxyFactory = new GenericProxyFactory(); Object proxy = proxyFactory.createProxy(cacheID, serviceName, delegateInvoker, jndiName, proxyBindingName, interceptorList, loader, targetInterfaces); objectMap.put(cacheID, value); return proxy; }
private void createProxy() throws Exception{ delegateInvoker = (Invoker)Registry.lookup(jmxInvokerName); log.debug("Using delegate: " + delegateInvoker + " for invoker=" + jmxInvokerName); final ObjectName serviceName = getServiceName(); final Integer nameHash = Integer.valueOf(String.valueOf(serviceName.hashCode())); Registry.bind(nameHash, serviceName); Object cacheID = null; String proxyBindingName = null; String jndiName = null; final Class[] connectionFactoryInterface = cf.getClass().getInterfaces(); final ArrayList interceptorList = new ArrayList(); interceptorList.add(ClientMethodInterceptor.class); interceptorList.add(InvokerInterceptor.class); ClassLoader loader = Thread.currentThread().getContextClassLoader(); GenericProxyFactory proxyFactory = new GenericProxyFactory(); theProxy = proxyFactory.createProxy(cacheID, serviceName, delegateInvoker, jndiName, proxyBindingName, interceptorList, loader, connectionFactoryInterface); }
delegateInvoker = (Invoker) Registry.lookup(jmxInvokerName); log.debug("Using delegate: " + delegateInvoker + " for invoker=" + jmxInvokerName);
try mbean = (ObjectName) Registry.lookup(invocation.getObjectName());
/** * create the service, do expensive operations etc */ public void create () throws Exception { BeanMetaData bmd = con.getBeanMetaData(); ClusterConfigMetaData ccmd = bmd.getClusterConfigMetaData (); String partitionName = ccmd.getPartitionName(); String name = "jboss:service=DistributedState,partitionName="+partitionName; ds = (DistributedState)org.jboss.system.Registry.lookup (name); String ejbName = bmd.getEjbName(); this.DS_CATEGORY = "CMPClusteredInMemoryPersistenceManager-" + ejbName; idField = con.getBeanClass ().getField ("id"); try { isModified = con.getBeanClass ().getMethod ("isModified", new Class[0]); if (!isModified.getReturnType ().equals (Boolean.TYPE)) isModified = null; // Has to have "boolean" as return type! } catch (NoSuchMethodException ignored) { } }
/** * Invoke a method. */ public Object invoke(Invocation invocation) throws Exception { ClassLoader oldCl = TCLAction.UTIL.getContextClassLoader(); ObjectName mbean = (ObjectName) Registry.lookup((Integer) invocation.getObjectName()); try { Object[] args = {invocation}; Object rtnValue = serverAction.invoke(mbean, "invoke", args, Invocation.INVOKE_SIGNATURE); return rtnValue; } catch (Exception e) { e = (Exception) JMXExceptionDecoder.decode(e); if (log.isTraceEnabled()) log.trace("Failed to invoke on mbean: " + mbean, e); throw e; } finally { TCLAction.UTIL.setContextClassLoader(oldCl); } }
public void start() throws Exception { super.start(); authenticationObserver = (AuthenticationObserver) Registry.lookup(AuthenticationObserver.KEY); //Take care of hot deployed security domains if (container != null) { securityManager = container.getSecurityManager(); if (securityManager != null) { appSecurityDomain = securityManager.getSecurityDomain(); appSecurityDomain = SecurityUtil.unprefixSecurityDomain(appSecurityDomain); } } }
ObjectName mbean = (ObjectName) Registry.lookup(nameHash);
invokerHA = (InvokerHA) Registry.lookup(getInvokerName()); if (invokerHA == null) throw new RuntimeException("Invoker is not registered: " + getInvokerName());
public void create() throws Exception { super.create (); // Get a reference to the DS service ClusterConfigMetaData config = getContainer().getBeanMetaData().getClusterConfigMetaData(); String partitionName = config.getPartitionName(); String name = "jboss:service=DistributedState,partitionName=" + partitionName; ds = (DistributedState) Registry.lookup (name); if( ds == null ) throw new DeploymentException("Failed to find DistributedState service: "+name); }
org.jboss.system.Registry.lookup (this.invalidationManagerName);
jrmp = (InvokerHA)Registry.lookup(oname); if (jrmp == null) throw new RuntimeException("home JRMPInvokerHA is null: " + oname);
ObjectName mbean = (ObjectName) Registry.lookup(invocation.getObjectName()); long clientViewId = ((Long)invocation.getValue("CLUSTER_VIEW_ID")).longValue();
public void start() throws Exception { super.start(); log.debug("Starting InvalidableEntityInstanceCache..."); EntityMetaData emd = ((EntityMetaData) this.getContainer().getBeanMetaData()); boolean participateInDistInvalidations = emd.doDistributedCacheInvalidations(); byte co = emd.getContainerConfiguration().getCommitOption(); if (participateInDistInvalidations && (co == ConfigurationMetaData.A_COMMIT_OPTION || co == ConfigurationMetaData.D_COMMIT_OPTION) ) { // we are interested in receiving cache invalidation callbacks // String groupName = emd.getDistributedCacheInvalidationConfig().getInvalidationGroupName(); String imName = emd.getDistributedCacheInvalidationConfig().getInvalidationManagerName(); this.invalMgr = (InvalidationManagerMBean) Registry.lookup(imName); this.ig = this.invalMgr.getInvalidationGroup(groupName); this.ig.register(this); this.isTraceEnabled = log.isTraceEnabled(); } }
public void start() throws Exception { org.jboss.metadata.EntityMetaData emd = ((org.jboss.metadata.EntityMetaData)this.getContainer ().getBeanMetaData ()); doCacheInvalidations = emd.doDistributedCacheInvalidations (); if (doCacheInvalidations) { // we are interested in receiving cache invalidation callbacks // String groupName = emd.getDistributedCacheInvalidationConfig ().getInvalidationGroupName (); String imName = emd.getDistributedCacheInvalidationConfig ().getInvalidationManagerName (); this.invalMgr = (org.jboss.cache.invalidation.InvalidationManagerMBean)org.jboss.system.Registry.lookup (imName); this.ig = this.invalMgr.getInvalidationGroup (groupName); } }
try mbean = (ObjectName) Registry.lookup(invocation.getObjectName());
String imName = entityMetaData.getDistributedCacheInvalidationConfig().getInvalidationManagerName(); InvalidationManagerMBean im = (InvalidationManagerMBean) Registry.lookup(imName); InvalidationGroup invalidationGroup = im.getInvalidationGroup(groupName);