[ 
https://issues.apache.org/jira/browse/YARN-4547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rohith Sharma K S updated YARN-4547:
------------------------------------
    Description: 
The below API is read-only interface, but returning reference to the caller. 
This causing caller to modify the orderingPolicy entities. If required 
reference of ordering policy, caller can use 
{{LeagQueue#getOrderingPolicy()#getSchedulableEntities()}}

The returning object should be clone of orderingPolicy.getSchedulableEntities()
{code}
  /**
   * Obtain (read-only) collection of active applications.
   */
  public Collection<FiCaSchedulerApp> getApplications() {
    return orderingPolicy.getSchedulableEntities();
  }
{code}

  was:
The below API is read-only interface, but returning reference to the caller. 
This causing caller to modify the orderingPolicy entities. If required 
reference of ordering policy, caller can use 
{{LeagQueue#getOrderingPolicy()#getSchedulableEntities()}}
{code}
  /**
   * Obtain (read-only) collection of active applications.
   */
  public Collection<FiCaSchedulerApp> getApplications() {
    return orderingPolicy.getSchedulableEntities();
  }
{code}


> LeagQueue#getApplications() is read-only interface, but it provides reference 
> to caller
> ---------------------------------------------------------------------------------------
>
>                 Key: YARN-4547
>                 URL: https://issues.apache.org/jira/browse/YARN-4547
>             Project: Hadoop YARN
>          Issue Type: Bug
>          Components: capacity scheduler
>            Reporter: Rohith Sharma K S
>            Assignee: Rohith Sharma K S
>
> The below API is read-only interface, but returning reference to the caller. 
> This causing caller to modify the orderingPolicy entities. If required 
> reference of ordering policy, caller can use 
> {{LeagQueue#getOrderingPolicy()#getSchedulableEntities()}}
> The returning object should be clone of 
> orderingPolicy.getSchedulableEntities()
> {code}
>   /**
>    * Obtain (read-only) collection of active applications.
>    */
>   public Collection<FiCaSchedulerApp> getApplications() {
>     return orderingPolicy.getSchedulableEntities();
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to