[18/74] [abbrv] hadoop git commit: YARN-7050. Post cleanup after YARN-6903, removal of org.apache.slider package. Contributed by Jian He
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b3aff2f/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java deleted file mode 100644 index 2e40a9b..000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java +++ /dev/null @@ -1,270 +0,0 @@ -/* - * 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 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.apache.slider.server.appmaster.rpc; - -import com.google.common.base.Preconditions; -import com.google.protobuf.RpcController; -import com.google.protobuf.ServiceException; -import org.apache.hadoop.ipc.ProtobufHelper; -import org.apache.hadoop.ipc.ProtocolSignature; -import org.apache.hadoop.ipc.RPC; -import org.apache.hadoop.ipc.RemoteException; -import org.apache.hadoop.yarn.exceptions.YarnException; -import org.apache.slider.api.SliderClusterProtocol; -import org.apache.slider.api.proto.Messages; - -import java.io.IOException; -import java.net.InetSocketAddress; - -public class SliderClusterProtocolProxy implements SliderClusterProtocol { - - private static final RpcController NULL_CONTROLLER = null; - private final SliderClusterProtocolPB endpoint; - private final InetSocketAddress address; - - public SliderClusterProtocolProxy(SliderClusterProtocolPB endpoint, - InetSocketAddress address) { -Preconditions.checkArgument(endpoint != null, "null endpoint"); -Preconditions.checkNotNull(address != null, "null address"); -this.endpoint = endpoint; -this.address = address; - } - - @Override - public String toString() { -final StringBuilder sb = -new StringBuilder("SliderClusterProtocolProxy{"); -sb.append("address=").append(address); -sb.append('}'); -return sb.toString(); - } - - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, - int clientMethodsHash) - throws IOException { -if (!protocol.equals(RPC.getProtocolName(SliderClusterProtocolPB.class))) { - throw new IOException("Serverside implements " + -RPC.getProtocolName(SliderClusterProtocolPB.class) + -". The following requested protocol is unknown: " + -protocol); -} - -return ProtocolSignature.getProtocolSignature(clientMethodsHash, -RPC.getProtocolVersion( -SliderClusterProtocol.class), -SliderClusterProtocol.class); - } - - @Override - public long getProtocolVersion(String protocol, long clientVersion) - throws IOException { -return SliderClusterProtocol.versionID; - } - - private IOException convert(ServiceException se) { -IOException ioe = ProtobufHelper.getRemoteException(se); -if (ioe instanceof RemoteException) { - RemoteException remoteException = (RemoteException) ioe; - return remoteException.unwrapRemoteException(); -} -return ioe; - } - - @Override public Messages.StopClusterResponseProto stopCluster( - Messages.StopClusterRequestProto request) - throws IOException, YarnException { -try { - return endpoint.stopCluster(NULL_CONTROLLER, request); -} catch (ServiceException e) { - throw convert(e); -} - } - - @Override - public Messages.UpgradeContainersResponseProto upgradeContainers( - Messages.UpgradeContainersRequestProto request) throws IOException, - YarnException { -try { - return endpoint.upgradeContainers(NULL_CONTROLLER, request); -} catch (ServiceException e) { - throw convert(e); -} - } - -
[18/74] [abbrv] hadoop git commit: YARN-7050. Post cleanup after YARN-6903, removal of org.apache.slider package. Contributed by Jian He
http://git-wip-us.apache.org/repos/asf/hadoop/blob/43277ffd/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java deleted file mode 100644 index 2e40a9b..000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java +++ /dev/null @@ -1,270 +0,0 @@ -/* - * 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 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.apache.slider.server.appmaster.rpc; - -import com.google.common.base.Preconditions; -import com.google.protobuf.RpcController; -import com.google.protobuf.ServiceException; -import org.apache.hadoop.ipc.ProtobufHelper; -import org.apache.hadoop.ipc.ProtocolSignature; -import org.apache.hadoop.ipc.RPC; -import org.apache.hadoop.ipc.RemoteException; -import org.apache.hadoop.yarn.exceptions.YarnException; -import org.apache.slider.api.SliderClusterProtocol; -import org.apache.slider.api.proto.Messages; - -import java.io.IOException; -import java.net.InetSocketAddress; - -public class SliderClusterProtocolProxy implements SliderClusterProtocol { - - private static final RpcController NULL_CONTROLLER = null; - private final SliderClusterProtocolPB endpoint; - private final InetSocketAddress address; - - public SliderClusterProtocolProxy(SliderClusterProtocolPB endpoint, - InetSocketAddress address) { -Preconditions.checkArgument(endpoint != null, "null endpoint"); -Preconditions.checkNotNull(address != null, "null address"); -this.endpoint = endpoint; -this.address = address; - } - - @Override - public String toString() { -final StringBuilder sb = -new StringBuilder("SliderClusterProtocolProxy{"); -sb.append("address=").append(address); -sb.append('}'); -return sb.toString(); - } - - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, - int clientMethodsHash) - throws IOException { -if (!protocol.equals(RPC.getProtocolName(SliderClusterProtocolPB.class))) { - throw new IOException("Serverside implements " + -RPC.getProtocolName(SliderClusterProtocolPB.class) + -". The following requested protocol is unknown: " + -protocol); -} - -return ProtocolSignature.getProtocolSignature(clientMethodsHash, -RPC.getProtocolVersion( -SliderClusterProtocol.class), -SliderClusterProtocol.class); - } - - @Override - public long getProtocolVersion(String protocol, long clientVersion) - throws IOException { -return SliderClusterProtocol.versionID; - } - - private IOException convert(ServiceException se) { -IOException ioe = ProtobufHelper.getRemoteException(se); -if (ioe instanceof RemoteException) { - RemoteException remoteException = (RemoteException) ioe; - return remoteException.unwrapRemoteException(); -} -return ioe; - } - - @Override public Messages.StopClusterResponseProto stopCluster( - Messages.StopClusterRequestProto request) - throws IOException, YarnException { -try { - return endpoint.stopCluster(NULL_CONTROLLER, request); -} catch (ServiceException e) { - throw convert(e); -} - } - - @Override - public Messages.UpgradeContainersResponseProto upgradeContainers( - Messages.UpgradeContainersRequestProto request) throws IOException, - YarnException { -try { - return endpoint.upgradeContainers(NULL_CONTROLLER, request); -} catch (ServiceException e) { - throw convert(e); -} - } - -