Package org.jboss.ha.framework.interfaces

Examples of org.jboss.ha.framework.interfaces.HAPartition


/*     */
/*     */   public static ClassProxy clusterObject(Object objectId, Object obj, String partitionName, LoadBalancePolicy lb, InvokerLocator locator)
/*     */     throws Exception
/*     */   {
/*  58 */     String proxyFamilyName = objectId.toString() + locator.getProtocol() + partitionName;
/*  59 */     HAPartition partition = (HAPartition)new InitialContext().lookup("/HAPartition/" + partitionName);
/*     */
/*  61 */     HATarget target = null;
/*  62 */     Map families = null;
/*  63 */     InstanceAdvisor advisor = null;
/*     */     Class clazz;
View Full Code Here


/*     */   {
/*  98 */     String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.binding);
/*  99 */     this.locator = new InvokerLocator(clientBindUrl);
/* 100 */     String partitionName = ((SessionContainer)getContainer()).getPartitionName();
/* 101 */     this.proxyFamilyName = (((SessionContainer)getContainer()).getDeploymentQualifiedName() + this.locator.getProtocol() + partitionName);
/* 102 */     HAPartition partition = (HAPartition)getContainer().getInitialContext().lookup("/HAPartition/" + partitionName);
/* 103 */     this.hatarget = new HATarget(partition, this.proxyFamilyName, this.locator, 2);
/* 104 */     ClusteringTargetsRepository.initTarget(this.proxyFamilyName, this.hatarget.getReplicants());
/* 105 */     ((SessionContainer)getContainer()).getClusterFamilies().put(this.proxyFamilyName, this.hatarget);
/* 106 */     if ((this.clustered.loadBalancePolicy() == null) || (this.clustered.loadBalancePolicy().equals(LoadBalancePolicy.class)))
/*     */     {
/* 108 */       this.lbPolicy = new FirstAvailable();
/*     */     }
/*     */     else
/*     */     {
/* 112 */       this.lbPolicy = ((LoadBalancePolicy)this.clustered.loadBalancePolicy().newInstance());
/*     */     }
/* 114 */     this.wrapper = new FamilyWrapper(this.proxyFamilyName, this.hatarget.getReplicants());
/*     */
/* 116 */     this.drm = partition.getDistributedReplicantManager();
/* 117 */     this.drm.registerListener(this.proxyFamilyName, this);
/*     */
/* 119 */     super.start();
/*     */
/* 121 */     Class[] interfaces = { ProxyFactory.class };
View Full Code Here

      RemoteBinding binding = this.getBinding();
      InvokerLocator locator = this.getLocator();
      SessionContainer container = this.getContainer();
      String partitionName = container.getPartitionName();
      proxyFamilyName = container.getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
      HAPartition partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, container.getInitialContextProperties());
      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());
     
      this.drm = partition.getDistributedReplicantManager();
      drm.registerListener(proxyFamilyName, this);
     
      super.start();
     
      Class<?>[] interfaces = {ProxyFactory.class};
View Full Code Here

      String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
      locator = new InvokerLocator(clientBindUrl);
      StatelessContainer container = (StatelessContainer) getContainer();
      String partitionName = container.getPartitionName();
      proxyFamilyName = container.getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
      HAPartition partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, container.getInitialContextProperties());
      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 RandomRobin();
      }
      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());
     
      this.drm = partition.getDistributedReplicantManager();
      drm.registerListener(proxyFamilyName, this);
     
      super.start();
   }
View Full Code Here

    *
    * @throws IllegalStateException if no matching partition can be found
    */
   public HAPartition getHAPartition(String partitionName, Hashtable jndiProperties)
   {
      HAPartition partition = findInRegistry(partitionName);
      if (partition == null)
      {
         try
         {
            partition = findInJndi(partitionName, jndiProperties);
View Full Code Here

      {
         map = new HashMap<Server, TimestampDiscrepancy>(discrepancies);
      }
     
      final RemoteDiscrepancies arg = new RemoteDiscrepancies(partition.getClusterNode(), map);
      final HAPartition haPartition = this.partition;
      Runnable r = new Runnable()
      {
         public void run()
         {
            try
            {
               haPartition.callMethodOnCluster(getServiceHAName(),
                                               "pushDiscrepancyMap",
                                               new Object[] { arg },
                                               PUSH_DISCREPANCY_MAP_TYPES, true);
            }
            catch (Exception e)
View Full Code Here

    * @return an invoker proxy
    * @throws Exception
    */
   protected Invoker createInvoker() throws Exception
   {
      HAPartition partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, null);

      /* Create a HATarget for the local invoker mbean stub. The name passed
      to the HATarget must be the wrappedJmxInvokerName so that different
      more than one HttpProxyFactoryHA may be configured for the same
      realJmxInvokerName.
View Full Code Here

   }
  
   protected void setupInvokers() throws Exception
   {
      String partitionName = container.getBeanMetaData().getClusterConfigMetaData().getPartitionName();
      HAPartition partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, null);
      this.drm = partition.getDistributedReplicantManager ();
     
      replicantName = jmxName.toString ();
     
      ObjectName oname = new ObjectName(invokerMetaData.getInvokerMBean());
      jrmp = (InvokerHA)Registry.lookup(oname);
View Full Code Here

   {
      try
      {
         InitialContext ctx = new InitialContext();
         String jndiName = "/HAPartition/" + this.partitionName;
         HAPartition partition = (HAPartition) ctx.lookup(jndiName);
         return partition.getCurrentView();
      }
      catch (Exception e)
      {
         this.log.error("Failed to access HAPartition state", e);
         return null;
View Full Code Here

   /** Initializes the cache for use. Prior to this the cache has no store.
    */
   public void create()
   {
      // Lookup the parition
      HAPartition partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(this.partitionName, null);
      this.entryMap = partition.getDistributedStateService();
      log.debug("Obtained DistributedState from partition=" + this.partitionName);
      this.now = System.currentTimeMillis();
   }
View Full Code Here

TOP

Related Classes of org.jboss.ha.framework.interfaces.HAPartition

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.