Add timer metrics to {@link DistributedFileSystem#setPermission(Path, FsPermission)}
196139
public void setPermission (Path f, final FsPermission permission) throws IOException {
    try (Closeable context = new TimerContextWithLog(this.setPermissionTimer.time(), "setPermission", f, permission)) {
      super.setPermission(f, permission);
    }
  }
203097
public void setDuration(final LocalTime DURATION) {
        if (null == duration) {
            _duration = DURATION;
            fireTileEvent(REDRAW_EVENT);
        } else {
            duration.set(DURATION);
        }
    }
1171702
public void setSubmissionTime(com.google.api.ads.admanager.axis.v201808.DateTime submissionTime) {
        this.submissionTime = submissionTime;
    }
675124
@Override
    public java.util.concurrent.Future<AddPermissionResult> addPermissionAsync(String queueUrl, String label, java.util.List<String> aWSAccountIds,
            java.util.List<String> actions, com.amazonaws.handlers.AsyncHandler<AddPermissionRequest, AddPermissionResult> asyncHandler) {

        return addPermissionAsync(new AddPermissionRequest().withQueueUrl(queueUrl).withLabel(label).withAWSAccountIds(aWSAccountIds).withActions(actions),
                asyncHandler);
    }
503019
protected void setPermissionStatus(PermissionStatus ps) {
    for (INodeHardLinkFile linkedFile : linkedFiles) {
      linkedFile.setPermissionStatus(ps, false);
    }
  }
394091
public void setCreateVolumePermissions(java.util.Collection<CreateVolumePermission> createVolumePermissions) {
        if (createVolumePermissions == null) {
            this.createVolumePermissions = null;
            return;
        }

        this.createVolumePermissions = new com.amazonaws.internal.SdkInternalList<CreateVolumePermission>(createVolumePermissions);
    }
20825
void updateFileMonitor(Long monitorInterval, String fileMonitorType) {
        if (this.monitorInterval.equals(monitorInterval) && this.monitorType.equals(fileMonitorType)) {
            return;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Updating FileMonitor with a new monitoring interval: " + monitorInterval + " and type: " + fileMonitorType);
        }

        this.monitorInterval = monitorInterval;
        this.monitorType = fileMonitorType;

        Hashtable<String, Object> properties = getFileMonitorProperties();
        serviceRegistration.setProperties(properties);
    }
879127
@SuppressWarnings("unchecked")
  public static void registerTopologyTimerEvents(Map<String, Object> conf,
                                                 String name, Duration interval,
                                                 Runnable task) {
    if (interval.isZero() || interval.isNegative()) {
      throw new IllegalArgumentException("Timer duration needs to be positive");
    }
    if (!conf.containsKey(Config.TOPOLOGY_TIMER_EVENTS)) {
      conf.put(Config.TOPOLOGY_TIMER_EVENTS, new HashMap<String, Pair<Duration, Runnable>>());
    }

    Map<String, Pair<Duration, Runnable>> timers
        = (Map<String, Pair<Duration, Runnable>>) conf.get(Config.TOPOLOGY_TIMER_EVENTS);

    if (timers.containsKey(name)) {
      throw new IllegalArgumentException("Timer with name " + name + " already exists");
    }
    timers.put(name, Pair.of(interval, task));
  }
589493
public static void setPermissions(Path location, Optional<String> owner, Optional<String> group, FileSystem fs,
      FsPermission permission) {
    try {
      if (!owner.isPresent()) {
        return;
      }
      if (!group.isPresent()) {
        return;
      }
      fs.setOwner(location, owner.get(), group.get());
      fs.setPermission(location, permission);
      if (!fs.isDirectory(location)) {
        return;
      }
      for (FileStatus fileStatus : fs.listStatus(location)) {
        setPermissions(fileStatus.getPath(), owner, group, fs, permission);
      }
    } catch (IOException e) {
      log.warn("Exception occurred while trying to change permissions : " + e.getMessage());
    }
  }
338558
public void chmod(String path, int permissions) throws IOException {
        SFTPv3FileAttributes atts = new SFTPv3FileAttributes();
        atts.permissions = permissions;
        setstat(path, atts);
    }
1154726
public void setLaunchPermissions(java.util.Collection<LaunchPermission> launchPermissions) {
        if (launchPermissions == null) {
            this.launchPermissions = null;
            return;
        }

        this.launchPermissions = new com.amazonaws.internal.SdkInternalList<LaunchPermission>(launchPermissions);
    }
926638
private void setFileNotWorldReadablePermissions(File file) {
       file.setReadable(false, false);
       file.setWritable(false, false);
       file.setExecutable(false, false);
       file.setReadable(true, true);
       file.setWritable(true, true);
    }
455706
@Override
  public void setPermission(Path p, FsPermission permission
      ) throws IOException {
    FsAction user = permission.getUserAction();
    FsAction group = permission.getGroupAction();
    FsAction other = permission.getOtherAction();
    
    File f = pathToFile(p);
    
    // Fork chmod if group and other permissions are different...
    if (group != other) {
      execSetPermission(f, permission);
      return;
    }
    
    boolean rv = true;
    
    // read perms
    rv = f.setReadable(group.implies(FsAction.READ), false);
    checkReturnValue(rv, p, permission);
    if (group.implies(FsAction.READ) != user.implies(FsAction.READ)) {
      f.setReadable(user.implies(FsAction.READ), true);
      checkReturnValue(rv, p, permission);
    }

    // write perms
    rv = f.setWritable(group.implies(FsAction.WRITE), false);
    checkReturnValue(rv, p, permission);
    if (group.implies(FsAction.WRITE) != user.implies(FsAction.WRITE)) {
      f.setWritable(user.implies(FsAction.WRITE), true);
      checkReturnValue(rv, p, permission);
    }

    // exec perms
    rv = f.setExecutable(group.implies(FsAction.EXECUTE), false);
    checkReturnValue(rv, p, permission);
    if (group.implies(FsAction.EXECUTE) != user.implies(FsAction.EXECUTE)) {
      f.setExecutable(user.implies(FsAction.EXECUTE), true);
      checkReturnValue(rv, p, permission);
    }
  }
1024745
@Override
    boolean tryObtainPermission() {
        // Thread-safe
        if (clock.instant().isAfter(retryAfterWaitDuration)) {
            stateMachine.transitionToHalfOpenState();
            return true;
        }
        circuitBreakerMetrics.onCallNotPermitted();
        return false;
    }
738477
private void setMonitorAttribute(Long monitorInterval) {
        if (MONITOR_OFF.equals(monitorInterval)) {
            this.fileMonitorProps.remove(FileMonitor.MONITOR_INTERVAL);
        } else {
            this.fileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval);
        }
    }
1153054
private void setRWPermissions(File f) {
    if (!f.setReadable(true, false) || !f.setWritable(true, false)) {
      LOG.info("Could not set permissions for file : "
          + f + " probably because user : " + System.getProperty("user.name")
          + " is not the owner");
    }
  }
396760
@Override public void onPermissionsChecked(final MultiplePermissionsReport report) {
    thread.execute(new Runnable() {
      @Override public void run() {
        listener.onPermissionsChecked(report);
      }
    });
  }