Clears this instances cache of aggregated operations.

Is intended to be called by the driver before shutdown.

@return the remaining aggregated {code ReportRequest}s
540535
public ReportRequest[] clear() {
    if (cache == null) {
      return NO_REQUESTS;
    }
    synchronized (cache) {
      ReportRequest[] res = generatedFlushRequests(cache.asMap().values());
      cache.invalidateAll();
      out.clear();
      return res;
    }
  }
424735
@Override
	public void shutdown(IAggregator aggregator) {
		for(IServiceRegistration reg : _serviceRegistrations) {
			reg.unregister();
		}
		_serviceRegistrations.clear();

		// Serialize the cache metadata one last time
		serializeCache();

		// avoid memory leaks caused by circular references
		_aggregator = null;
		_cache.set(null);
	}
1225249
public synchronized int clear() {
    final int count = taskQueue.size();
    for (final TaskEntity task : taskQueue) {
      canceledTasks.add(task);
    }
    taskQueue.clear();
    return count;
  }
1187704
protected function clearAllObjectsFromCacheCluster()
    {
        $nodes = $this->cache->_masters();

        foreach ($nodes as $node) {
            if (!$this->cache->flushDB($node)) {
                return false;
            }
        }

        return true;
    }
157134
protected void aggregateReports() {
    clusterUtil.clear();
    for (String jobId : allJobUtil.keySet()) {
      JobUtilization jobUtil = allJobUtil.get(jobId);
      jobUtil.clear();
      jobUtil.setIsRunning(false);
    }

    for (UtilizationReport report : taskTrackerReports.values()) {
      if (report.isExpired()) {
        continue; // ignore the report if it is older than the timeLimit
      }
      LocalJobUtilization[] localJobUtils = report.getJobUtilization();
      TaskTrackerUtilization ttUtil = report.getTaskTrackerUtilization();

      // Aggregate cluster information
      double cpuUsageGHz = clusterUtil.getCpuUsageGHz();
      double cpuTotalGHz = clusterUtil.getCpuTotalGHz();
      double memUsageGB = clusterUtil.getMemUsageGB();
      double memTotalGB = clusterUtil.getMemTotalGB();
      int numCpu = clusterUtil.getNumCpu();
      int numTaskTrackers = clusterUtil.getNumTaskTrackers();

      cpuUsageGHz += ttUtil.getCpuUsageGHz();
      cpuTotalGHz += ttUtil.getCpuTotalGHz();
      memUsageGB += ttUtil.getMemUsageGB();
      memTotalGB += ttUtil.getMemTotalGB();
      numCpu += ttUtil.getNumCpu();
      numTaskTrackers += 1;

      clusterUtil.setCpuUsageGHz(cpuUsageGHz);
      clusterUtil.setCpuTotalGHz(cpuTotalGHz);
      clusterUtil.setMemUsageGB(memUsageGB);
      clusterUtil.setMemTotalGB(memTotalGB);
      clusterUtil.setNumCpu(numCpu);
      clusterUtil.setNumTaskTrackers(numTaskTrackers);

      // Aggregate Job based information
      if ( localJobUtils == null) {
        continue;
      }

      for (LocalJobUtilization localJobUtil : localJobUtils) {
        String jobId = localJobUtil.getJobId();
        if (jobId == null) {
          continue;
        }

        if (!allJobUtil.containsKey(jobId)) {
          JobUtilization jobUtil = new JobUtilization();
          jobUtil.setJobId(jobId);
          allJobUtil.put(jobId, jobUtil);
        }
        JobUtilization jobUtil = allJobUtil.get(jobId);
        jobUtil.setIsRunning(true);
        double maxCpu = jobUtil.getCpuMaxPercentageOnBox();
        double cpu = jobUtil.getCpuPercentageOnCluster();
        double cpuGigaCycles = jobUtil.getCpuGigaCycles();
        double maxMem = jobUtil.getMemMaxPercentageOnBox();
        double mem = jobUtil.getMemPercentageOnCluster();

        cpu += localJobUtil.getCpuUsageGHz(); // will be normalized later
        mem += localJobUtil.getMemUsageGB(); // will be normalized later
        cpuGigaCycles += localJobUtil.getCpuUsageGHz() *
                         (double)aggregatePeriod * 1e6D / 1e9D;
        // GHz * ms = 1e6. To convert to Giga, divide by 1e9

        double localCpuPercentage =
                localJobUtil.getCpuUsageGHz() / ttUtil.getCpuTotalGHz() * 100;
        double localMemPercentage =
                localJobUtil.getMemUsageGB() / ttUtil.getMemTotalGB() * 100;

        if (maxCpu < localCpuPercentage) {
          maxCpu = localCpuPercentage;
        }
        if (maxMem < localMemPercentage) {
          maxMem = localMemPercentage;
        }
        jobUtil.setCpuMaxPercentageOnBox(maxCpu);
        jobUtil.setCpuGigaCycles(cpuGigaCycles);
        jobUtil.setCpuPercentageOnCluster(cpu); // will be normalized later
        jobUtil.setMemMaxPercentageOnBox(maxMem); // will be normalized later
        jobUtil.setMemPercentageOnCluster(mem);
        if (maxMem > jobUtil.getMemMaxPercentageOnBoxAllTime()) {
          jobUtil.setMemMaxPercentageOnBoxAllTime(maxMem);
        }
      }
    }

    // Normalization and clean up finished jobs
    for (Iterator<String>
            it = allJobUtil.keySet().iterator(); it.hasNext();) {
      String jobId = it.next();
      JobUtilization jobUtil = allJobUtil.get(jobId);
 	 	  if (!jobUtil.getIsRunning()) {
        long stoppedTime = jobUtil.getStoppedTime();
        stoppedTime += aggregatePeriod;
        jobUtil.setStoppedTime(stoppedTime);
        jobUtil.setIsRunning(false);

        if (stoppedTime > stopTimeLimit) {
          // These are finished jobs
          // We may store the information of finished jobs to some place
          double cpuTime = jobUtil.getCpuCumulatedUsageTime() / 1000D;
          double memTime = jobUtil.getMemCumulatedUsageTime() / 1000D;
          double peakMem = jobUtil.getMemMaxPercentageOnBoxAllTime();
          double cpuGigaCycles = jobUtil.getCpuGigaCycles();
          it.remove();
          LOG.info(String.format( 
                "Job done: [JobID,CPU(sec),Mem(sec),Peak Mem(%%),CPU gigacycles]" +
                " = [%s,%f,%f,%f,%f]",
                jobId, cpuTime, memTime, peakMem, cpuGigaCycles));
        }
        continue;
			}

      long runningTime = jobUtil.getRunningTime();
      runningTime += aggregatePeriod; // millisecond to second
      jobUtil.setRunningTime(runningTime);
      jobUtil.setStoppedTime(0);
      jobUtil.setIsRunning(true);

      int numJobs = clusterUtil.getNumRunningJobs();
      numJobs += 1;
      clusterUtil.setNumRunningJobs(numJobs);

      double cpu = jobUtil.getCpuPercentageOnCluster();
      double mem = jobUtil.getMemPercentageOnCluster();
      double cpuTime = jobUtil.getCpuCumulatedUsageTime();
      double memTime = jobUtil.getMemCumulatedUsageTime();
      cpu = cpu / clusterUtil.getCpuTotalGHz() * 100;
      mem = mem / clusterUtil.getMemTotalGB() * 100;
      cpuTime += cpu / 100 * aggregatePeriod;  // in milliseconds
      memTime += mem / 100 * aggregatePeriod;  // in milliseconds
      jobUtil.setCpuPercentageOnCluster(cpu);
      jobUtil.setMemPercentageOnCluster(mem);
      jobUtil.setCpuCumulatedUsageTime(cpuTime);
      jobUtil.setMemCumulatedUsageTime(memTime);
    }
  }
1061170
synchronized int removeOldConnections() {
        long now = System.currentTimeMillis();
        long expirationTime = now - idleTransportTimeout.millis();

        List<PooledTransport> removeFromIdle = new ArrayList<PooledTransport>();
        for (Map.Entry<PooledTransport, Long> idleEntry : idle.entrySet()) {
            long lastUsed = idleEntry.getValue();
            if (lastUsed < expirationTime) {
                PooledTransport removed = idleEntry.getKey();
                if (log.isTraceEnabled()) {
                    log.trace("Expiring idle transport for job [" + jobPoolingKey + "], transport: ["
                            + removed.toString() + "]. Last used [" + new TimeValue(now-lastUsed) + "] ago. Expired ["
                            + idleTransportTimeout + "] ago.");
                }
                release(removed);
                removeFromIdle.add(removed);
            }
        }

        for (PooledTransport toRemove : removeFromIdle) {
            idle.remove(toRemove);
        }

        return idle.size() + leased.size();
    }
415901
public static void clear() {
		for (int i = 0; i < ByteBufPool.NUMBER_OF_SLABS; i++) {
			slabs[i].clear();
			created[i].set(0);
			reused[i].set(0);
		}
		synchronized (registry) {
			registry.clear();
		}
	}
822592
public void clear()
    {
        Iterator it = cachesByClass.values().iterator();
        while (it.hasNext())
        {
            ObjectCache cache = (ObjectCache) it.next();
            if (cache != null)
            {
                cache.clear();
            }
        }
    }
1311159
@Override
	public long lastModified() {
		// return the latest of each of the resources in this aggregated
		// resource
		long result = -1;
		for (IResource resource : resources) {
			result = Math.max(result, resource.lastModified());
		}
		return result;
	}
823440
public static base_responses clear(nitro_service client, Interface resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			Interface clearresources[] = new Interface[resources.length];
			for (int i=0;i<resources.length;i++){
				clearresources[i] = new Interface();
				clearresources[i].id = resources[i].id;
			}
			result = perform_operation_bulk_request(client, clearresources,"clear");
		}
		return result;
	}
953071
public java.util.List<AggregateComplianceCount> getAggregateComplianceCounts() {
        if (aggregateComplianceCounts == null) {
            aggregateComplianceCounts = new com.amazonaws.internal.SdkInternalList<AggregateComplianceCount>();
        }
        return aggregateComplianceCounts;
    }
452408
@Override
	final protected long getLastModified(HttpServletRequest req) {
		lastModifiedCount.incrementAndGet();
		try {
			return reportingGetLastModified(req);
		} catch (ThreadDeath err) {
			throw err;
		} catch (RuntimeException err) {
			getLogger().log(Level.SEVERE, null, err);
			throw err;
		} catch (IOException | SQLException err) {
			getLogger().log(Level.SEVERE, null, err);
			throw new RuntimeException(err);
		}
	}
596542
public void clearAllCaches() {
        logger.warn("beginning request to clear all caches");
        for (final String cacheName : this.cacheManager.getCacheNames()) {
            clearCache(cacheName);
        }
        logger.warn("completed request to clear all caches");
    }
667951
@Override
    public void removeAllResourses() throws Exception {
        synchronized (this) {
            if (!this.started) {
                throw new Exception(String.format("Management=%s not started", this.name));
            }

            if (this.associations.size() == 0 && this.servers.size() == 0)
                // no resources allocated - nothing to do
                return;

            if (logger.isInfoEnabled()) {
                logger.info(String.format("Removing allocated resources: Servers=%d, Associations=%d", this.servers.size(),
                        this.associations.size()));
            }

            // Remove all associations
            ArrayList<String> lst = new ArrayList<String>();
            for (FastMap.Entry<String, Association> n = this.associations.head(), end = this.associations.tail(); (n = n
                    .getNext()) != end;) {
                lst.add(n.getKey());
            }
            for (String n : lst) {
                this.stopAssociation(n);
                this.removeAssociation(n);
            }

            // Remove all servers
            lst.clear();
            for (FastList.Node<Server> n = this.servers.head(), end = this.servers.tail(); (n = n.getNext()) != end;) {
                lst.add(n.getValue().getName());
            }
            for (String n : lst) {
                this.stopServer(n);
                this.removeServer(n);
            }

            // We store the cleared state
            this.store();

            for (ManagementEventListener lstr : managementEventListeners) {
                try {
                    lstr.onRemoveAllResources();
                } catch (Throwable ee) {
                    logger.error("Exception while invoking onRemoveAllResources", ee);
                }
            }
        }

    }
160773
public List<TimeUnit> clearUnits()
   {
      List<TimeUnit> result = getUnits();
      cachedUnits = null;
      units.clear();
      return result;
   }
617168
public static void clear() {
		for (int i = 0; i < index; ++i) {
			instances.get(i).clear();
		}
		index = 0;
	}
103601
@Override
    public void clear() {
        Map<String, GroovyRunner> map = getMap();
        writeLock.lock();
        try {
            cachedValues = null;
            map.clear();
            loadDefaultRunners();
        } finally {
            writeLock.unlock();
        }
    }