Examples of ResourcePool


Examples of com.sun.enterprise.resource.ResourcePool

        return continueWorkerThread;
    }
   
    void gatherStats() {
        Iterator<String> iter = (Iterator<String>)createdPools.keys();
        ResourcePool pool = null;
        String poolName = null;
        long connsInUse = 0;
        while (iter.hasNext()){
            poolName = iter.next();
            pool = Switch.getSwitch().getPoolManager().getPool(poolName);
View Full Code Here

Examples of com.sun.enterprise.resource.ResourcePool

        }
    }
   
    void tuneSteadyPoolSize() {
        Iterator<String> iter = (Iterator<String>)createdPools.keys();
        ResourcePool pool = null;
        String poolName = null;
        int steadyPoolSize = 0;
        while (iter.hasNext()){
            poolName = iter.next();
            pool = Switch.getSwitch().getPoolManager().getPool(poolName);
            steadyPoolSize = (int)createdPools.get(poolName).getApprox90thPercentile();
            if (pool.getSteadyPoolSize() != steadyPoolSize) {
                if(_logger.isLoggable(Level.INFO))
                    _logger.log(Level.INFO, sm.getString("connectionpool.setsteadypoolsize", poolName, pool.getSteadyPoolSize() , steadyPoolSize));
                pool.setSteadyPoolSize(steadyPoolSize);
            }
        }
    }
View Full Code Here

Examples of com.sun.enterprise.resource.ResourcePool

    public void poolCreated(String poolName) {
        if (poolNameMap.get(poolName) == null) {
            return;
        }
        int maxPoolSize = calcMaxPoolSize(poolName);
        ResourcePool pool = Switch.getSwitch().getPoolManager().getPool(poolName);
        pool.setSelfManaged(true);
        pool.setMaxPoolSize(maxPoolSize);
        if(_logger.isLoggable(Level.INFO))
            _logger.log(Level.INFO, sm.getString("connectionpool.setmaxpoolsize", poolName, maxPoolSize));
        if (!pool.isMonitoringEnabled()) {
            pool.setMonitoringEnabledLow();
        }
        createdPools.put(poolName, new BoundedCircularQueue(sampleSize));
    }
View Full Code Here

Examples of com.sun.enterprise.resource.ResourcePool

 
        MonitorableResourcePool[] pools = new MonitorableResourcePool[ jp.length ];
        ConcurrentHashMap poolTable = getPoolManager().getPoolTable();
       
  for( int i = 0 ; i < jp.length; i++ ) {
            ResourcePool p = (ResourcePool) poolTable.get( jp[i].getName() );
            if (p != null && (p instanceof MonitorableResourcePool ) ) {
          pools[i] = (MonitorableResourcePool)p;
            }
  }
 
View Full Code Here

Examples of com.sun.enterprise.resource.ResourcePool

        Map allPools = Switch.getSwitch().getPoolManager().getPoolTable();

        for( int i = 0 ; i < cp.length; i++ ) {
            if (!(cp[i].getName().equalsIgnoreCase(
                            ConnectorConstants.DEFAULT_JMS_ADAPTER))) {
                ResourcePool p = (ResourcePool) allPools.get( cp[i].getName() );

                if (p != null && (p instanceof MonitorableResourcePool )) {
                    poolMap.put(cp[i], (MonitorableResourcePool)p);
                }
            }
View Full Code Here

Examples of com.sun.enterprise.resource.pool.ResourcePool

        debug("[DRC] Pool recreation required");

        final long reconfigWaitTimeout = connConnPool.getDynamicReconfigWaitTimeout();
        PoolInfo poolInfo = new PoolInfo(connConnPool.getName(), connConnPool.getApplicationName(),
                connConnPool.getModuleName());
        final ResourcePool oldPool = runtime.getPoolManager().getPool(poolInfo);

        if (reconfigWaitTimeout > 0) {

            oldPool.blockRequests(reconfigWaitTimeout);

            if (oldPool.getPoolWaitQueue().getQueueLength() > 0 || oldPool.getPoolStatus().getNumConnUsed() > 0) {

                Runnable thread = new Runnable() {
                    public void run() {
                        try {

                            long numSeconds = 5000L ; //poll every 5 seconds
                            long steps = reconfigWaitTimeout/numSeconds;
                            if(steps == 0){
                                waitForCompletion(steps, oldPool, reconfigWaitTimeout);
                            }else{
                                for (long i = 0; i < steps; i++) {
                                    waitForCompletion(steps, oldPool, reconfigWaitTimeout);
                                    if (oldPool.getPoolWaitQueue().getQueueLength() == 0 &&
                                            oldPool.getPoolStatus().getNumConnUsed() == 0) {
                                        debug("wait-queue is empty and num-con-used is 0");
                                        break;
                                    }
                                }
                            }

                            handlePoolRecreationForExistingProxies(connConnPool);

                            PoolWaitQueue reconfigWaitQueue = oldPool.getReconfigWaitQueue();
                            debug("checking reconfig-wait-queue for notification");
                            if (reconfigWaitQueue.getQueueContents().size() > 0) {
                                for (Object o : reconfigWaitQueue.getQueueContents()) {
                                    debug("notifying reconfig-wait-queue object [ " + o + " ]");
                                    synchronized (o) {
                                        o.notify();
                                    }
                                }
                            }
                        } catch (InterruptedException ie) {
                            if(_logger.isLoggable(Level.FINEST)) {
                                _logger.log(Level.FINEST,
                                    "Interrupted while waiting for all existing clients to return connections to pool", ie);
                            }
                        }
                       
                        if(_logger.isLoggable(Level.FINEST)){
                            _logger.finest("woke-up after giving time for in-use connections to return, " +
                                "WaitQueue-Length : ["+oldPool.getPoolWaitQueue().getQueueContents()+"], " +
                                "Num-Conn-Used : ["+oldPool.getPoolStatus().getNumConnUsed()+"]");
                        }
                    }
                };

                Callable c = Executors.callable(thread);
                ArrayList list = new ArrayList();
                list.add(c);
                try{
                    execService.invokeAll(list);
                }catch(Exception e){
                    Object[] params = new Object[]{connConnPool.getName(), e};
                    _logger.log(Level.WARNING,"exception.redeploying.pool.transparently", params);
                }

            }else{
                handlePoolRecreationForExistingProxies(connConnPool);    
            }
        } else if(oldPool.getReconfigWaitTime() > 0){
            //reconfig is being switched off, invalidate proxies
            Collection<BindableResource> resources =
                    JdbcResourcesUtil.getResourcesOfPool(runtime.getResources(oldPool.getPoolInfo()), oldPool.getPoolInfo().getName());
            ConnectorRegistry registry = ConnectorRegistry.getInstance();
            for(BindableResource resource : resources){
                ResourceInfo resourceInfo = ConnectorsUtil.getResourceInfo(resource);
                registry.removeResourceFactories(resourceInfo);
            }
View Full Code Here

Examples of com.vmware.vim.binding.vim.ResourcePool

   @Override
   public String getPath() { return path; }

   @Override
   protected void update(ManagedObject mo) throws Exception {
      ResourcePool rp = (ResourcePool)mo;
      childVMs = Arrays.asList(rp.getVm());
      owner = rp.getOwner();
      parent = rp.getParent();
      name = rp.getName();
      isVApp = (rp instanceof VirtualApp);
      if (isVApp) {
         VirtualApp vapp = (VirtualApp)mo;
         ProductInfo[] pInfo = vapp.getVAppConfig().getProduct();
         version = pInfo[0].getVersion();
         fullVersion = pInfo[0].getFullVersion();
      }
      ResourceConfigSpec config = rp.getConfig();
      cpuAlloc = config.getCpuAllocation();
      memAlloc = config.getMemoryAllocation();

      // XXX: The cpuUsgae and memUsgae should really belong
      // to the runtime info. We putting them into configuration category is
      // to temporarily fix bug 865341 in Borealis. Should be refactorred later.
      ResourcePool.RuntimeInfo runtime = rp.getRuntime();
      cpuUsage = runtime.getCpu();
      memUsage = runtime.getMemory();

      for (ManagedObjectReference vmRef : childVMs) {
         VcCache.putVmRpPair(vmRef, getMoRef());
View Full Code Here

Examples of com.vmware.vim.binding.vim.ResourcePool

      updatePath();
   }

   @Override
   protected void updateRuntime(ManagedObject mo) throws Exception {
      ResourcePool rp = (ResourcePool)mo;
      ResourcePool.RuntimeInfo runtime = rp.getRuntime();
      cpuUsage = runtime.getCpu();
      memUsage = runtime.getMemory();
   }
View Full Code Here

Examples of com.vmware.vim.binding.vim.ResourcePool

      return String.format("RP[%s](cpu:R=%d,L=%d,mem:R=%d,L=%d,#vm=%d)", path,
            cpuReservation, cpuLimit, memReservation, memLimit, childVMs.size());
   }

   private List<ManagedObjectReference> getChildRps() {
      ResourcePool rp = null;
      if (VcContext.isInSession()) {
         rp = getManagedObject();
      } else {
         rp = VcContext.inVcSessionDo(new VcSession<ResourcePool>() {
            @Override
            protected ResourcePool body() throws Exception {
               return getManagedObject();
            }
         });
      }
      return Arrays.asList(rp.getResourcePool());
   }
View Full Code Here

Examples of com.vmware.vim.binding.vim.ResourcePool

         VcContext.getTaskMgr().execPseudoTask("ResourcePool.createResourcePool",
            VcEventType.ResourcePoolCreated, getMoRef(),
            new IVcPseudoTaskBody() {
         @Override
         public final ManagedObjectReference body() throws Exception {
            final ResourcePool rp = getManagedObject();
            ManagedObjectReference child = null;
            //at least execute once
            while (true) {
               try {
                  child = rp.createResourcePool(name, spec);
                  break;
               } catch (DuplicateName ex) {
                  if (force) {
                     //suppress this exception, and remove duplicated RP, then retry.
                     update();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.