Populates domainMap from allDomains
@throws IOException
321009
private void indexDomains() throws IOException {
		domainsFileLock.writeLock().lock();
		logger.trace("LOCK writelock");
		try {
			if( allDomains == null) {
				ensureDomainsFileInstalled();
			}

			// Leave enough space for all PDBs as of 2015
			domainMap = new HashMap<String, List<EcodDomain>>((int) (150000/.85),.85f);

			// Index with domainMap
			for(EcodDomain d : allDomains) {
				// Get the PDB ID, either directly or from the domain ID
				String pdbId = d.getPdbId();
				if( pdbId == null ) {
					String ecodId = d.getDomainId();
					if( ecodId != null && !ecodId.isEmpty() ) {
						Matcher match = ECOD_RE.matcher(ecodId);
						pdbId = match.group(1);
					}
				}

				// Add current domain to the map
				List<EcodDomain> currDomains;
				if( domainMap.containsKey(pdbId) ) {
					currDomains = domainMap.get(pdbId);
				} else {
					currDomains = new LinkedList<EcodDomain>();
					domainMap.put(pdbId,currDomains);
				}
				currDomains.add(d);
			}
		} finally {
			logger.trace("UNLOCK writelock");
			domainsFileLock.writeLock().unlock();
		}

	}
1199231
public DnsNameResolverBuilder searchDomains(Iterable<String> searchDomains) {
        checkNotNull(searchDomains, "searchDomains");

        final List<String> list = new ArrayList<String>(4);

        for (String f : searchDomains) {
            if (f == null) {
                break;
            }

            // Avoid duplicate entries.
            if (list.contains(f)) {
                continue;
            }

            list.add(f);
        }

        this.searchDomains = list.toArray(new String[0]);
        return this;
    }
1332103
public static void main(String[] args){
		PDBDomainProvider dom = new PDBDomainProvider();
		String name;
		name = "2CDG";

		SortedSet<String> domains = dom.getDomainNames(name);

		System.out.println("Domains for "+name+":");
		for(String s : domains) {
			System.out.println(s);
		}

		SortedSet<String> reprs = dom.getRepresentativeDomains();
		System.out.format("%nFound %d clusters.%n",reprs.size());

		try {
			File outfile  = new File("/Users/blivens/Downloads/representativeDomainsJava.xml");
			Writer out = new BufferedWriter(new FileWriter(outfile));

			for(String repr : reprs) {
				out.write(String.format("  <representative name=\"%s\"/>%n", repr));
			}
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
1021741
public void setDomainEntries(java.util.Collection<DomainEntry> domainEntries) {
        if (domainEntries == null) {
            this.domainEntries = null;
            return;
        }

        this.domainEntries = new java.util.ArrayList<DomainEntry>(domainEntries);
    }
716574
public static Iterator getDomainData() throws JMException
   {
      MBeanServer server = getMBeanServer();
      TreeMap<String, DomainData> domainData = new TreeMap<String, DomainData>();

      if (server != null)
      {
         Set objectNames = server.queryNames(null, null);
         Iterator objectNamesIter = objectNames.iterator();

         while (objectNamesIter.hasNext())
         {
            ObjectName name = (ObjectName)objectNamesIter.next();
            MBeanInfo info = server.getMBeanInfo(name);
            String domainName = name.getDomain();
            MBeanData mbeanData = new MBeanData(name, info);
            DomainData data = domainData.get(domainName);

            if (data == null)
            {
               data = new DomainData(domainName);
               domainData.put(domainName, data);
            }

            data.addData(mbeanData);
         }
      }

      return domainData.values().iterator();
   }
629108
private synchronized void load() {
    Map<String, HadoopServer> map = new TreeMap<String, HadoopServer>();
    for (File file : saveDir.listFiles()) {
      try {
        HadoopServer server = new HadoopServer(file);
        map.put(server.getLocationName(), server);

      } catch (Exception exn) {
        System.err.println(exn);
      }
    }
    this.servers = map;
  }
972270
public void setDomains(@NonNull EnumSet<LogDomain> domains) {
        if (domains == null) { throw new IllegalArgumentException("domains cannot be null."); }

        logDomains = domains;
    }
1014896
public void setDomainsAlwaysInScope(List<DomainAlwaysInScopeMatcher> domainsAlwaysInScope) {
        if (domainsAlwaysInScope == null || domainsAlwaysInScope.isEmpty()) {
            ((HierarchicalConfiguration) getConfig()).clearTree(ALL_DOMAINS_ALWAYS_IN_SCOPE_KEY);

            this.domainsAlwaysInScope = Collections.emptyList();
            this.domainsAlwaysInScopeEnabled = Collections.emptyList();
            return;
        }

        this.domainsAlwaysInScope = new ArrayList<>(domainsAlwaysInScope);

        ((HierarchicalConfiguration) getConfig()).clearTree(ALL_DOMAINS_ALWAYS_IN_SCOPE_KEY);

        int size = domainsAlwaysInScope.size();
        ArrayList<DomainAlwaysInScopeMatcher> enabledExcludedDomains = new ArrayList<>(size);
        for (int i = 0; i < size; ++i) {
            String elementBaseKey = ALL_DOMAINS_ALWAYS_IN_SCOPE_KEY + "(" + i + ").";
            DomainAlwaysInScopeMatcher excludedDomain = domainsAlwaysInScope.get(i);

            getConfig().setProperty(elementBaseKey + DOMAIN_ALWAYS_IN_SCOPE_VALUE_KEY, excludedDomain.getValue());
            getConfig().setProperty(elementBaseKey + DOMAIN_ALWAYS_IN_SCOPE_REGEX_KEY, excludedDomain.isRegex());
            getConfig().setProperty(elementBaseKey + DOMAIN_ALWAYS_IN_SCOPE_ENABLED_KEY, excludedDomain.isEnabled());

            if (excludedDomain.isEnabled()) {
                enabledExcludedDomains.add(excludedDomain);
            }
        }

        enabledExcludedDomains.trimToSize();
        this.domainsAlwaysInScopeEnabled = enabledExcludedDomains;
    }
401492
private void createAllWebserverConfigs() throws IOException {

        List<CmsSite> sites = OpenCms.getSiteManager().getAvailableSites(getCms(), true);
        for (CmsSite site : sites) {
            if ((site.getSiteMatcher() != null) && site.isWebserver()) {

                String filename = m_targetPath
                    + m_filePrefix
                    + "_"
                    + generateWebserverConfigName(site.getSiteMatcher(), "_");
                getReport().println(
                    Messages.get().container(Messages.RPT_CREATING_CONFIG_FOR_SITE_2, filename, site),
                    I_CmsReport.FORMAT_OK);
                File newFile = new File(filename);
                if (!newFile.exists()) {
                    newFile.getParentFile().mkdirs();
                    newFile.createNewFile();
                }

                String content = createConfigForSite(site, FileUtils.readFileToString(new File(m_templatePath)));
                if (site.hasSecureServer()) {
                    content += createConfigForSite(site, FileUtils.readFileToString(new File(m_secureTemplate)));
                }

                FileUtils.writeStringToFile(newFile, content);
                m_writtenFiles.add(newFile.getAbsolutePath());
            }
        }
    }
1214233
protected synchronized void initialize(JobConf conf) throws IOException {
    maxRefillQueueSize =
        conf.getInt(MAX_REFILL_QUEUE_SIZE, DEFAULT_MAX_REFILL_QUEUE_SIZE);
    if (maxRefillQueueSize <= 0) {
      throw new RuntimeException("Illegal value for " +
          MAX_REFILL_QUEUE_SIZE + " " + maxRefillQueueSize);
    }
    this.originalConf = conf;
    // use configured nameserver & interface to get local hostname
    this.fConf = new JobConf(conf);
    localFs = FileSystem.getLocal(fConf);
    if (fConf.get("slave.host.name") != null) {
      this.localHostname = fConf.get("slave.host.name");
    }
    if (localHostname == null) {
      this.localHostname =
      DNS.getDefaultHost
      (fConf.get("mapred.tasktracker.dns.interface","default"),
       fConf.get("mapred.tasktracker.dns.nameserver","default"));
    }
  
    try {
      java.net.InetAddress inetAddress = java.net.InetAddress.getByName(this.localHostname);
      if (inetAddress != null) {
        this.localHostAddress = inetAddress.getHostAddress();
      }
      else {
        LOG.info("Unable to get IPaddress for " + this.localHostname);
      }
    } catch (UnknownHostException e) {
      LOG.info("Unable to get IPaddress for " + this.localHostname);
    }

    Class<? extends ResourceCalculatorPlugin> clazz =
        fConf.getClass(MAPRED_TASKTRACKER_MEMORY_CALCULATOR_PLUGIN_PROPERTY,
            null, ResourceCalculatorPlugin.class);
    resourceCalculatorPlugin =
      (ResourceCalculatorPlugin) ResourceCalculatorPlugin
            .getResourceCalculatorPlugin(clazz, fConf);
    LOG.info("Using ResourceCalculatorPlugin : " + resourceCalculatorPlugin);
    int numCpuOnTT = resourceCalculatorPlugin.getNumProcessors();
    maxMapSlots = getMaxSlots(fConf, numCpuOnTT, TaskType.MAP);
    maxReduceSlots = getMaxSlots(fConf, numCpuOnTT, TaskType.REDUCE);
    actualMaxMapSlots =
      getMaxActualSlots(fConf, numCpuOnTT, TaskType.MAP);
    actualMaxReduceSlots =
      getMaxActualSlots(fConf, numCpuOnTT, TaskType.REDUCE);
    LOG.info("Num cpus = " + numCpuOnTT +
             ", max map slots = " + maxMapSlots +
             ", max reduce slots = " + maxReduceSlots +
             ", actual max map slots = " + actualMaxMapSlots +
             ", actual max reduce slots = " + actualMaxReduceSlots);

    // Check local disk, start async disk service, and clean up all
    // local directories.
    checkLocalDirs(getLocalDirsFromConf(this.fConf));
    asyncDiskService = new MRAsyncDiskService(FileSystem.getLocal(fConf),
        getLocalDirsFromConf(fConf), fConf);
    asyncDiskService.cleanupAllVolumes();
    DistributedCache.purgeCache(fConf, asyncDiskService);
    versionBeanName = VersionInfo.registerJMX("TaskTracker");

    // Clear out state tables
    this.tasks.clear();
    this.runningTasks = new LinkedHashMap<TaskAttemptID, TaskInProgress>();
    this.runningJobs = new TreeMap<JobID, RunningJob>();
    this.mapTotal = 0;
    this.reduceTotal = 0;
    this.acceptNewTasks = true;
    this.status = null;

    this.minSpaceStart = this.fConf.getLong("mapred.local.dir.minspacestart", 0L);
    this.minSpaceKill = this.fConf.getLong("mapred.local.dir.minspacekill", 0L);
    //tweak the probe sample size (make it a function of numCopiers)
    probe_sample_size = this.fConf.getInt("mapred.tasktracker.events.batchsize", 500);

    // Set up TaskTracker instrumentation
    this.myInstrumentation = createInstrumentation(this, fConf);

    // bind address
    String address =
      NetUtils.getServerAddress(fConf,
                                "mapred.task.tracker.report.bindAddress",
                                "mapred.task.tracker.report.port",
                                "mapred.task.tracker.report.address");
    InetSocketAddress socAddr = NetUtils.createSocketAddr(address);
    String bindAddress = socAddr.getHostName();
    int tmpPort = socAddr.getPort();

    this.jvmManager = new JvmManager(this);

    // Set service-level authorization security policy
    if (this.fConf.getBoolean(
          ServiceAuthorizationManager.SERVICE_AUTHORIZATION_CONFIG, false)) {
      PolicyProvider policyProvider =
        (PolicyProvider)(ReflectionUtils.newInstance(
            this.fConf.getClass(PolicyProvider.POLICY_PROVIDER_CONFIG,
                MapReducePolicyProvider.class, PolicyProvider.class),
            this.fConf));
      SecurityUtil.setPolicy(new ConfiguredPolicy(this.fConf, policyProvider));
    }

    // RPC initialization
    int max = actualMaxMapSlots > actualMaxReduceSlots ?
                       actualMaxMapSlots : actualMaxReduceSlots;
    //set the num handlers to max*2 since canCommit may wait for the duration
    //of a heartbeat RPC
    int numHandlers = 2 * max;
    LOG.info("Starting RPC server with " + numHandlers + " handlers");
    this.taskReportServer =
      RPC.getServer(this, bindAddress, tmpPort, numHandlers, false, this.fConf);
    this.taskReportServer.start();

    // get the assigned address
    this.taskReportAddress = taskReportServer.getListenerAddress();
    this.fConf.set("mapred.task.tracker.report.address",
        taskReportAddress.getHostName() + ":" + taskReportAddress.getPort());
    LOG.info("TaskTracker up at: " + this.taskReportAddress);

    this.taskTrackerName = "tracker_" + localHostname + ":" + taskReportAddress;
    LOG.info("Starting tracker " + taskTrackerName);

    this.justInited = true;
    this.running = true;

    taskMemoryControlGroupEnabled = fConf.getBoolean(
        MAPRED_TASKTRACKER_CGROUP_MEM_ENABLE_PROPERTY,
        DEFAULT_MAPRED_TASKTRACKER_CGROUP_MEM_ENABLE_PROPERTY);
    if(taskMemoryControlGroupEnabled) {
      ttMemCgroup = new TaskTrackerMemoryControlGroup(fConf);
    }
    
    taskCPUControlGroupEnabled = fConf.getBoolean(
            MAPRED_TASKTRACKER_CGROUP_CPU_ENABLE_PROPERTY,
            DEFAULT_MAPRED_TASKTRACKER_CGROUP_CPU_ENABLE_PROPERTY);
    if(taskCPUControlGroupEnabled)
      ttCPUCgroup = new TaskTrackerCPUControlGroup(fConf, actualMaxMapSlots + actualMaxReduceSlots);
    
    initializeMemoryManagement();
    cgroupMemoryWatcher = new CGroupMemoryWatcher(this);
    cgroupMemoryWatcher.start();

    setTaskLogsMonitor(new TaskLogsMonitor(getMapUserLogRetainSize(),
        getReduceUserLogRetainSize()));
    getTaskLogsMonitor().start();

    this.indexCache = new IndexCache(this.fConf);

    pulseChecker = PulseChecker.create(this, "TaskTracker");

    heartbeatMonitor = new HeartbeatMonitor(this.fConf);
    mapLauncher =
      new TaskLauncher(TaskType.MAP, maxMapSlots, actualMaxMapSlots);
    reduceLauncher =
      new TaskLauncher(TaskType.REDUCE, maxReduceSlots, actualMaxReduceSlots);
    mapLauncher.start();
    reduceLauncher.start();
    Class<? extends TaskController> taskControllerClass
                          = fConf.getClass("mapred.task.tracker.task-controller",
                                            DefaultTaskController.class,
                                            TaskController.class);
    taskController = (TaskController)ReflectionUtils.newInstance(
                                                      taskControllerClass, fConf);

    //setup and create jobcache directory with appropriate permissions
    taskController.setup();

    //Start up node health checker service.
    if (shouldStartHealthMonitor(this.fConf)) {
      startHealthMonitor(this.fConf);
    }

    oobHeartbeatOnTaskCompletion =
      fConf.getBoolean(TT_OUTOFBAND_HEARBEAT, false);
    fastFetch = fConf.getBoolean(TT_FAST_FETCH, false);

    // Setup the launcher if in simulation mode
    simulatedTaskMode = fConf.getBoolean(TT_SIMULATED_TASKS, false);
    LOG.info("simulatedTaskMode = " + simulatedTaskMode);
    long simulatedTaskRunningTime =
        fConf.getLong(TT_SIMULATED_TASK_RUNNING_TIME, 20000);
    if (simulatedTaskMode) {
      simulatedTaskRunner =
        new SimulatedTaskRunner(simulatedTaskRunningTime, this);
      simulatedTaskRunner.start();
    }
    // Setup task completion event store
    useTaskCompletionEventsStore = fConf.getBoolean(
        MAPRED_TASKTRACKER_TCE_STORE_PROPERTY, false);
    profileAllTasks = fConf.getBoolean(TT_PROFILE_ALL_TASKS, false);
  }
1054857
private void parseDomains() throws IOException {
		domainsFileLock.writeLock().lock();
		logger.trace("LOCK writelock");
		try {
			EcodParser parser = new EcodParser(getDomainFile());
			allDomains = parser.getDomains();
			parsedVersion = parser.getVersion();
		} finally {
			logger.trace("UNLOCK writelock");
			domainsFileLock.writeLock().unlock();
		}
	}
973475
@PostConstruct
    public void loadTagDefinitions()
    {
        Map<Addon, List<URL>> addonToResourcesMap = scanner.scanForAddonMap(new FileExtensionFilter("tags.xml"));
        for (Map.Entry<Addon, List<URL>> entry : addonToResourcesMap.entrySet())
        {
            for (URL resource : entry.getValue())
            {
                log.info("Reading tags definitions from: " + resource.toString() + " from addon " + entry.getKey().getId());
                try(InputStream is = resource.openStream())
                {
                    tagService.readTags(is);
                }
                catch( Exception ex )
                {
                    throw new WindupException("Failed reading tags definition: " + resource.toString() + " from addon " + entry.getKey().getId() + ":\n" + ex.getMessage(), ex);
                }
            }
        }
    }
157572
public void setDomainNames(java.util.Collection<String> domainNames) {
        if (domainNames == null) {
            this.domainNames = null;
            return;
        }

        this.domainNames = new com.amazonaws.internal.SdkInternalList<String>(domainNames);
    }
916652
function setDomain(domain) {
    checkIsObject('domain', domain);
    checkIsString('doamin.name', domain.name);
    //test domain, domain.name
    domainsMap = domainsMap.set(domain.name, domain);
}
129614
private static void loadMappings(ConfigServerImpl configServer, ConfigImpl config, Document doc, int mode, Log log) throws IOException {
	try {
	    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_MAPPING);
	    Element el = getChildByName(doc.getDocumentElement(), "mappings");
	    Element[] _mappings = getChildren(el, "mapping");

	    Map<String, Mapping> mappings = MapFactory.<String, Mapping>getConcurrentMap();
	    Mapping tmp;

	    boolean finished = false;

	    if (configServer != null && config instanceof ConfigWeb) {
		Mapping[] sm = configServer.getMappings();
		if (sm != null) {
		    for (int i = 0; i < sm.length; i++) {
			if (!sm[i].isHidden()) {
			    if ("/".equals(sm[i].getVirtual())) finished = true;
			    if (sm[i] instanceof MappingImpl) {
				tmp = ((MappingImpl) sm[i]).cloneReadOnly(config);
				mappings.put(tmp.getVirtualLowerCase(), tmp);

			    }
			    else {
				tmp = sm[i];
				mappings.put(tmp.getVirtualLowerCase(), tmp);
			    }
			}
		    }
		}
	    }

	    if (hasAccess) {
		boolean hasServerContext = false;
		for (int i = 0; i < _mappings.length; i++) {
		    el = _mappings[i];

		    String physical = el.getAttribute("physical");
		    String archive = el.getAttribute("archive");
		    String virtual = getAttr(el, "virtual");
		    String listType = getAttr(el, "listener-type");
		    String listMode = getAttr(el, "listener-mode");

		    boolean readonly = toBoolean(getAttr(el, "readonly"), false);
		    boolean hidden = toBoolean(getAttr(el, "hidden"), false);
		    boolean toplevel = toBoolean(getAttr(el, "toplevel"), true);

		    if (config instanceof ConfigServer && (virtual.equalsIgnoreCase("/lucee-server/") || virtual.equalsIgnoreCase("/lucee-server-context/"))) {
			hasServerContext = true;
		    }

		    // lucee
		    if (virtual.equalsIgnoreCase("/lucee/")) {
			if (StringUtil.isEmpty(listType, true)) listType = "modern";
			if (StringUtil.isEmpty(listMode, true)) listMode = "curr2root";
			toplevel = true;
		    }

		    int listenerMode = ConfigWebUtil.toListenerMode(listMode, -1);
		    int listenerType = ConfigWebUtil.toListenerType(listType, -1);
		    ApplicationListener listener = ConfigWebUtil.loadListener(listenerType, null);
		    if (listener != null || listenerMode != -1) {
			// type
			if (mode == ConfigImpl.MODE_STRICT) listener = new ModernAppListener();
			else if (listener == null) listener = ConfigWebUtil.loadListener(ConfigWebUtil.toListenerType(config.getApplicationListener().getType(), -1), null);
			if (listener == null)// this should never be true
			    listener = new ModernAppListener();

			// mode
			if (listenerMode == -1) {
			    listenerMode = config.getApplicationListener().getMode();
			}
			listener.setMode(listenerMode);

		    }

		    // physical!=null &&
		    if ((physical != null || archive != null)) {

			short insTemp = inspectTemplate(el);
			if ("/lucee/".equalsIgnoreCase(virtual) || "/lucee".equalsIgnoreCase(virtual) || "/lucee-server/".equalsIgnoreCase(virtual)
				|| "/lucee-server-context".equalsIgnoreCase(virtual))
			    insTemp = ConfigImpl.INSPECT_ONCE;

			String primary = getAttr(el, "primary");
			boolean physicalFirst = primary == null || !primary.equalsIgnoreCase("archive");

			tmp = new MappingImpl(config, virtual, physical, archive, insTemp, physicalFirst, hidden, readonly, toplevel, false, false, listener, listenerMode,
				listenerType);
			mappings.put(tmp.getVirtualLowerCase(), tmp);
			if (virtual.equals("/")) {
			    finished = true;
			    // break;
			}
		    }
		}

		// set default lucee-server-context
		if (config instanceof ConfigServer && !hasServerContext) {
		    ApplicationListener listener = ConfigWebUtil.loadListener(ApplicationListener.TYPE_MODERN, null);
		    listener.setMode(ApplicationListener.MODE_CURRENT2ROOT);

		    tmp = new MappingImpl(config, "/lucee-server", "{lucee-server}/context/", null, ConfigImpl.INSPECT_ONCE, true, false, true, true, false, false, listener,
			    ApplicationListener.MODE_CURRENT2ROOT, ApplicationListener.TYPE_MODERN);
		    mappings.put(tmp.getVirtualLowerCase(), tmp);
		}
	    }

	    if (!finished) {

		if ((config instanceof ConfigWebImpl) && ResourceUtil.isUNCPath(config.getRootDirectory().getPath())) {

		    tmp = new MappingImpl(config, "/", config.getRootDirectory().getPath(), null, ConfigImpl.INSPECT_UNDEFINED, true, true, true, true, false, false, null, -1, -1);
		}
		else {

		    tmp = new MappingImpl(config, "/", "/", null, ConfigImpl.INSPECT_UNDEFINED, true, true, true, true, false, false, null, -1, -1);
		}

		mappings.put("/", tmp);
	    }

	    Mapping[] arrMapping = new Mapping[mappings.size()];
	    int index = 0;
	    Iterator it = mappings.keySet().iterator();
	    while (it.hasNext()) {
		arrMapping[index++] = mappings.get(it.next());
	    }
	    config.setMappings(arrMapping);
	    // config.setMappings((Mapping[]) mappings.toArray(new
	    // Mapping[mappings.size()]));
	}
	catch (Exception e) {
	    log(config, log, e);
	}
    }
1289279
public ListDomainNamesResult withDomainNames(java.util.Map<String, String> domainNames) {
        setDomainNames(domainNames);
        return this;
    }
223295
@Override
  public synchronized Map<String, LocalResource> call() throws IOException {
    final Map<String, LocalResource> globalResources = new HashMap<>(1);
    if (!this.isUploaded){
      this.pathToGlobalJar = this.uploader.uploadToJobFolder(makeGlobalJar());
      this.isUploaded = true;
    }

    final LocalResource updatedGlobalJarResource = this.uploader.makeLocalResourceForJarFile(this.pathToGlobalJar);

    if (this.globalJarResource != null
        && this.globalJarResource.getTimestamp() != updatedGlobalJarResource.getTimestamp()) {
      LOG.log(Level.WARNING,
              "The global JAR LocalResource timestamp has been changed from "
              + this.globalJarResource.getTimestamp() + " to " + updatedGlobalJarResource.getTimestamp());
    }

    this.globalJarResource = updatedGlobalJarResource;

    // For now, always rewrite the information due to REEF-348
    globalResources.put(this.fileNames.getGlobalFolderPath(), updatedGlobalJarResource);

    return globalResources;
  }