FileDocCategorySizeDatePackage
RemoteProducerFactory.javaAPI DocJBoss 4.2.13819Fri Jul 13 20:53:56 BST 2007org.jboss.ejb3.mdb

RemoteProducerFactory

public class RemoteProducerFactory extends ProducerFactory
comment
author
Bill Burke

Fields Summary
protected javax.jms.ConnectionFactory
factory
Constructors Summary
public RemoteProducerFactory(ConsumerContainer container, Class producer, org.jboss.annotation.ejb.MessageProperties props, javax.jms.Destination dest, InitialContext ctx, Hashtable initialContextProperties)

      super(container, producer, props, dest, ctx, initialContextProperties);
      try
      {
         String factoryName = pImpl.connectionFactory();
         if (factoryName.equals("")) factoryName = "ConnectionFactory";
         factory = (ConnectionFactory) ctx.lookup(factoryName);
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
      }
   
Methods Summary
public java.lang.ObjectcreateProxy()

      Class[] interfaces = {producer, ProducerObject.class};

      ProducerManagerImpl mImpl = null;

      mImpl = new ProducerManagerImpl(pImpl, dest, factory, props.delivery(), props.timeToLive(), props.priority(), methodMap, initialContextProperties);

      Interceptor[] interceptors = {mImpl};
      ProducerProxy ih = new ProducerProxy(mImpl, interceptors);
      return java.lang.reflect.Proxy.newProxyInstance(producer.getClassLoader(), interfaces, ih);
   
public voidsetContainer(org.jboss.ejb3.Container container)

   
public voidstart()

      super.start();
      Class[] interfaces = {ProxyFactory.class};
      Object factoryProxy = Remoting.createPojiProxy(jndiName + PROXY_FACTORY_NAME, interfaces, RemoteProxyFactory.DEFAULT_CLIENT_BINDING);
      try
      {
         Util.rebind(ctx, jndiName + PROXY_FACTORY_NAME, factoryProxy);
      } catch (NamingException e)
      {
         NamingException namingException = new NamingException("Could not bind remote producer factory into JNDI under jndiName: " + ctx.getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
         namingException.setRootCause(e);
         throw namingException;
      }
      Dispatcher.singleton.registerTarget(jndiName + PROXY_FACTORY_NAME, this);
   
public voidstop()

      super.stop();
      Util.unbind(ctx, jndiName + PROXY_FACTORY_NAME);
      Dispatcher.singleton.unregisterTarget(jndiName + PROXY_FACTORY_NAME);