Package org.jboss.ejb3.session

Examples of org.jboss.ejb3.session.SessionContainer


   private Class<?>[] getInterfacesForProxy(ProxyAccessType accessType, SpecificationInterfaceType specType)
   {

      // Initialize
      Set<Class<?>> interfaces = new HashSet<Class<?>>();
      SessionContainer container = this.getContainer();

      // Initialize array of interfaces
      Set<Class<?>> intfs = new HashSet<Class<?>>();

      // If Local
View Full Code Here


   }
  
   protected void validateEjb21Views()
   {
      // Obtain Container
      SessionContainer container = this.getContainer();
     
      // Obtain @RemoteHome
      RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);

      // Ensure that if EJB 2.1 Components are defined, they're complete
      this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
            .getRemoteInterfaces(container));
View Full Code Here

   public void start() throws Exception
   {
      this.init();
     
      InvokerLocator locator = this.getLocator();
      SessionContainer container = this.getContainer();
      partitionName = container.getPartitionName();
      proxyFamilyName = container.getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
      partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, container.getInitialContextProperties());
      drm = partition.getDistributedReplicantManager();
      hatarget = new HATarget(partition, proxyFamilyName, locator, HATarget.ENABLE_INVOCATIONS);
      ClusteringTargetsRepository.initTarget(proxyFamilyName, hatarget.getReplicants());
      container.getClusterFamilies().put(proxyFamilyName, hatarget);
     
      if (clustered.loadBalancePolicy() == null || clustered.loadBalancePolicy().equals(ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT))
      {
         lbPolicy = new FirstAvailable();
      }
      else
      {
         String policyClass = clustered.loadBalancePolicy();
         try
         {
            RemoteProxyFactoryRegistry registry = container.getDeployment().getRemoteProxyFactoryRegistry();
            Class<LoadBalancePolicy> policy = registry.getLoadBalancePolicy(policyClass);
            policyClass = policy.getName();
         }
         catch (LoadBalancePolicyNotRegisteredException e){}
        
         lbPolicy = (LoadBalancePolicy)Thread.currentThread().getContextClassLoader().loadClass(policyClass)
               .newInstance();
      }
      wrapper = new FamilyWrapper(proxyFamilyName, hatarget.getReplicants());
     
      drm.registerListener(proxyFamilyName, this);
     
      super.start();
     
      // Set up the proxy to ourself. Needs to be clustered so it can load
      // balance requests (EJBTHREE-1375). We use the home load balance policy.
     
      LoadBalancePolicy factoryLBP = null;
      if (clustered.homeLoadBalancePolicy() == null || clustered.homeLoadBalancePolicy().equals(ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT))
      {
         factoryLBP = new RoundRobin();
      }
      else
      {
         String policyClass = clustered.homeLoadBalancePolicy();
         try
         {
            RemoteProxyFactoryRegistry registry = container.getDeployment().getRemoteProxyFactoryRegistry();
            Class<LoadBalancePolicy> policy = registry.getLoadBalancePolicy(policyClass);
            policyClass = policy.getName();
         }
         catch (LoadBalancePolicyNotRegisteredException e){}
        
View Full Code Here

      Invocation copy = marshallOrPass(invocation, Invocation.class);
      copy.getMetaData().addMetaData(IS_LOCAL, IS_LOCAL, Boolean.TRUE, PayloadKey.AS_IS);
      try
      {
         // Invoke upon the container
         SessionContainer sc = (SessionContainer) container;
         InvocationResponse response = sc.dynamicInvoke(copy);
         // it could really have been a copy
         invocation.setResponseContextInfo(response.getContextInfo());
         return marshallOrPass(response.getResponse(), Object.class);
      }
      // TODO: Either Throwable (as it used to be) or Exception (which is better)
View Full Code Here

   @Override
   protected void validateEjb21Views()
   {
      // Obtain Container
      SessionContainer container = this.getContainer();
     
      // Obtain @RemoteHome
      RemoteHome remoteHome = container.getAnnotation(RemoteHome.class);

      // Ensure that if EJB 2.1 Components are defined, they're complete
      this.validateEjb21Views(remoteHome == null ? null : remoteHome.value(), ProxyFactoryHelper
            .getRemoteInterfaces(container));
   }
View Full Code Here

   public void stop() throws Exception
   {
      Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
      Dispatcher.singleton.unregisterTarget(getTargetId());
     
      SessionContainer statefulContainer = this.getContainer();
      RemoteHome remoteHome = statefulContainer.getAnnotation(RemoteHome.class);
      if (remoteHome != null && !bindHomeAndBusinessTogether())
      {
         Util.unbind(this.getContainer().getInitialContext(), ProxyFactoryHelper.getHomeJndiName(getContainer()));
      }
      super.stop();
View Full Code Here

      assert beanContext != null : "beanContext is null";
      assert businessInterface != null : "businessInterface is null";
     
      StatefulBeanContext ctx = (StatefulBeanContext) beanContext;
     
      SessionContainer container = ctx.getContainer();
      assert container == this : "beanContext not of this container (" + container + " != " + this + ")";
     
      boolean isRemote = false;
      boolean found = false;
      Class<?>[] remoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(this);
View Full Code Here

            deployment.setPersistenceManagerFactoryRegistry(registry);
            deployment.setCacheFactoryRegistry(cacheFactoryRegistry);
         }

         // Create a Session Container
         SessionContainer container = instanciateContainer(sessionType, cl, beanClassname, smd.getEjbName(), domain,
               ctxProperties, deployment, smd);

         // Deploy and register
         registerContainer(container);
         containers.add(container);

      }

      // make sure the containers are available through lookup
      for(SessionContainer container : containers)
      {
         try
         {
            bootstrap.lookup(container.getObjectName().getCanonicalName(), Object.class);
         }
         catch (RuntimeException e)
         {
            throw e;
         }
View Full Code Here

   private static SessionContainer instanciateContainer(ContainerType type, ClassLoader loader, String beanClassName,
         String ejbName, Domain domain, Hashtable<?, ?> ctxProperties, Ejb3Deployment deployment,
         JBossSessionBeanMetaData md)
   {
      // Initialize
      SessionContainer container = null;

      /*
       * Instanciate the Container, depending upon the type specified
       */
      switch (type)
View Full Code Here

            // Session Containers
            if (container instanceof SessionContainer)
            {
               // Cast
               final SessionContainer sessionContainer = (SessionContainer) container;

               // Get the invocation stats
               final InvocationStatistics stats = sessionContainer.getInvokeStats();
               if (stats == null)
               {
                  throw new IllegalStateException("Invocation statistics was null");
               }
View Full Code Here

TOP

Related Classes of org.jboss.ejb3.session.SessionContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.