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

org.apache.hadoop.yarn.client.AutoRefreshNoHARMFailoverProxyProvider Maven / Gradle / Ivy

There is a newer version: 3.4.1
Show newest version
/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in org.apache.hadoop.shaded.com.liance
 * with the License.  You may obtain a copy of the License at
 * 

* http://www.apache.org.apache.hadoop.shaded.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.apache.hadoop.shaded.org.apache.hadoop.yarn.client; import org.apache.hadoop.shaded.org.slf4j.Logger; import org.apache.hadoop.shaded.org.slf4j.LoggerFactory; import org.apache.hadoop.shaded.org.apache.hadoop.conf.Configuration; import org.apache.hadoop.shaded.org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.shaded.org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.shaded.org.apache.hadoop.ipc.RPC; import org.apache.hadoop.shaded.org.apache.hadoop.yarn.conf.YarnConfiguration; import java.org.apache.hadoop.shaded.io.IOException; import java.org.apache.hadoop.shaded.net.InetSocketAddress; /** * A subclass of {@link RMFailoverProxyProvider} which tries to * resolve the proxy DNS in the event of failover. * This provider doesn't support HA or Federation. */ @InterfaceAudience.Private @InterfaceStability.Unstable public class AutoRefreshNoHARMFailoverProxyProvider extends DefaultNoHARMFailoverProxyProvider { private static final Logger LOG = LoggerFactory.getLogger(AutoRefreshNoHARMFailoverProxyProvider.class); protected RMProxy rmProxy; protected YarnConfiguration conf; @Override public void init(Configuration configuration, RMProxy rmProxy, Class protocol) { this.rmProxy = rmProxy; this.protocol = protocol; this.conf = new YarnConfiguration(configuration); } @Override public synchronized ProxyInfo getProxy() { if (proxy == null) { proxy = getProxyInternal(); } return new ProxyInfo(proxy, null); } protected T getProxyInternal() { try { final InetSocketAddress rmAddress = rmProxy.getRMAddress(conf, protocol); return rmProxy.getProxy(conf, protocol, rmAddress); } catch (IOException org.apache.hadoop.shaded.io.) { LOG.error("Unable to create proxy to the ResourceManager", org.apache.hadoop.shaded.io..getMessage()); return null; } } /** * Stop the current proxy when performFailover. * @param currentProxy */ @Override public synchronized void performFailover(T currentProxy) { RPC.stopProxy(proxy); proxy = null; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy