protected void createService() throws Exception { // note on design: We need to call it ourselves as opposed to // letting the client InvokerInterceptor look it // up through the use of Registry, the reason being including // the classes in the client. // If we move to a JNDI format (with local calls) for the // registry we could remove the call below InvokerInterceptor.setLocal(this); Registry.bind(serviceName, this); }
/** * 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; }
protected void destroyService() { // Export references to the bean Registry.unbind(serviceName); }
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); }
/** * 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; }
protected void destroyService() { // Export references to the bean Registry.unbind(serviceName); }
protected void jmxBind() { Registry.bind(getServiceName(), proxy); }
/** 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); }
protected void destroyService() { Registry.unbind(serviceName); }
protected void jmxBind() { Registry.bind(getServiceName(), this); }
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; }
protected void startService() throws Exception { // Export the Invoker interface ObjectName name = super.getServiceName(); Registry.bind(name, this); // Make sure the invoker URL is valid super.checkInvokerURL(); log.debug("Bound HttpHA invoker for JMX node"); }
/** * 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) { } }
protected void stopService() { // Unxport the Invoker interface ObjectName name = super.getServiceName(); Registry.unbind(name); log.debug("Unbound HttpHA invoker for JMX node"); }
public void startService () throws Exception { // bind us in system registry // log.debug ("Starting Invalidation Manager " + this.getServiceName ().toString ()); org.jboss.system.Registry.bind (this.getServiceName ().toString (), this); this.hashcode = this.getServiceName ().hashCode (); }
try mbean = (ObjectName) Registry.lookup(invocation.getObjectName());
protected void stopService() { try { Context ctx = new InitialContext(); ctx.unbind(JNDI_NAME); } catch (Exception e) { log.warn("Failed to unbind "+JNDI_NAME, e); } // Remove our ObjectName hash from Registry if the proxy factory had not Registry.unbind(new Integer(serviceName.hashCode())); }
protected void startService() throws Exception { checkInvokerURL(); Invoker delegateInvoker = new HttpInvokerProxy(invokerURL); // Export the Invoker interface ObjectName name = super.getServiceName(); Registry.bind(name, delegateInvoker); log.debug("Bound Http invoker for JMX node"); }