All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.springframework.yarn.am.grid.Grid Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.yarn.am.grid;

import java.util.Collection;

import org.apache.hadoop.yarn.api.records.ContainerId;
import org.springframework.yarn.am.grid.listener.GridListener;
import org.springframework.yarn.am.grid.support.GridMemberInterceptor;

/**
 * Grid allows to track members in a grid.
 *
 * @author Janne Valkealahti
 *
 */
public interface Grid {

	/**
	 * Gets collection of grid members know to the grid system or
	 * empty collection if there are no known members.
	 *
	 * @return Collection of grid members
	 */
	Collection getMembers();

	/**
	 * Gets a grid member.
	 *
	 * @param id the container id identifier
	 * @return Grid member or NULL if member doesn't exist
	 */
	GridMember getMember(ContainerId id);

	/**
	 * Adds a new grid member.
	 * 

* If a grid refuses to add a particular member for any reason * other than that it already contains the member, it must throw * an exception (rather than returning false). This preserves * the invariant that a grid always contains the specified node * after this call returns. * * @param member the grid member * @return true if this grid changed as a result of the call */ boolean addMember(GridMember member); /** * Removes a grid member. *

* Removes a single instance of the specified member from this * grid, if it is present. * * @param id the container id identifier * @return true if a member was removed as a result of this call */ boolean removeMember(ContainerId id); /** * Adds a listener to be notified of grid members events. * * @param listener the grid listener */ void addGridListener(GridListener listener); /** * Adds a grid member interceptor. * * @param interceptor the interceptor */ void addInterceptor(GridMemberInterceptor interceptor); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy