コード例 #1
0
ファイル: DomainController.java プロジェクト: pkozikow/hank
 private void doUpdateDomain(HttpServletRequest req, HttpServletResponse resp) throws IOException {
   final String domainName = req.getParameter("name");
   final String storageEngineOptions = req.getParameter("storageEngineOptions");
   final Domain domain = coordinator.getDomain(domainName);
   if (domain == null) {
     throw new IOException("Could not get Domain '" + domainName + "' from Configurator.");
   } else {
     coordinator.updateDomain(
         domainName,
         domain.getNumParts(),
         domain.getStorageEngineFactoryClass().getName(),
         storageEngineOptions,
         domain.getPartitioner().getClass().getName());
   }
   resp.sendRedirect("/domains.jsp");
 }
コード例 #2
0
 // Compute, for each domain, the number of _domain partitions_ (unique partitions)
 // that are fully (all copies) served and up to date
 public ServingStatus computeUniquePartitionsServingStatus(DomainGroup domainGroup)
     throws IOException {
   ServingStatus result = new ServingStatus();
   for (DomainGroupDomainVersion dgvdv : domainGroup.getDomainVersions()) {
     Domain domain = dgvdv.getDomain();
     Map<Integer, ServingStatus> partitionToServingStatus =
         domainToPartitionToPartitionServingStatus.get(domain);
     int partitionsServedAndUpToDate = 0;
     if (partitionToServingStatus != null) {
       for (ServingStatus servingStatus : partitionToServingStatus.values()) {
         // A unique partition is served and up to date if all host corresponding domain partitions
         // are
         // served and up to date
         if (servingStatus.getNumPartitionsServedAndUpToDate()
             == servingStatus.getNumPartitions()) {
           partitionsServedAndUpToDate += 1;
         }
       }
     }
     result.aggregate(
         domain.getNumParts(), partitionToServingStatus == null ? 0 : partitionsServedAndUpToDate);
   }
   return result;
 }