HADOOP-9756. Remove the deprecated getServer(..) methods from RPC. Contributed by Junping Du
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1507259 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7723b139d5
commit
a690a215db
@ -493,6 +493,9 @@ Release 2.1.0-beta - 2013-07-02
|
||||
HADOOP-9760. Move GSet and related classes to common from HDFS.
|
||||
(suresh)
|
||||
|
||||
HADOOP-9756. Remove the deprecated getServer(..) methods from RPC.
|
||||
(Junping Du via szetszwo)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
HADOOP-9150. Avoid unnecessary DNS resolution attempts for logical URIs
|
||||
|
@ -2228,7 +2228,7 @@ private synchronized Document asXmlDocument() throws IOException {
|
||||
doc.appendChild(conf);
|
||||
conf.appendChild(doc.createTextNode("\n"));
|
||||
handleDeprecation(); //ensure properties is set and deprecation is handled
|
||||
for (Enumeration e = properties.keys(); e.hasMoreElements();) {
|
||||
for (Enumeration<Object> e = properties.keys(); e.hasMoreElements();) {
|
||||
String name = (String)e.nextElement();
|
||||
Object object = properties.get(name);
|
||||
String value = null;
|
||||
|
@ -646,104 +646,6 @@ public static void stopProxy(Object proxy) {
|
||||
+ proxy.getClass());
|
||||
}
|
||||
|
||||
/** Construct a server for a protocol implementation instance listening on a
|
||||
* port and address.
|
||||
* @deprecated Please use {@link Builder} to build the {@link Server}
|
||||
*/
|
||||
@Deprecated
|
||||
public static Server getServer(final Object instance, final String bindAddress, final int port, Configuration conf)
|
||||
throws IOException {
|
||||
return getServer(instance, bindAddress, port, 1, false, conf);
|
||||
}
|
||||
|
||||
/** Construct a server for a protocol implementation instance listening on a
|
||||
* port and address.
|
||||
* @deprecated Please use {@link Builder} to build the {@link Server}
|
||||
*/
|
||||
@Deprecated
|
||||
public static Server getServer(final Object instance, final String bindAddress, final int port,
|
||||
final int numHandlers,
|
||||
final boolean verbose, Configuration conf)
|
||||
throws IOException {
|
||||
return getServer(instance.getClass(), // use impl class for protocol
|
||||
instance, bindAddress, port, numHandlers, false, conf, null,
|
||||
null);
|
||||
}
|
||||
|
||||
/** Construct a server for a protocol implementation instance.
|
||||
* @deprecated Please use {@link Builder} to build the {@link Server}
|
||||
*/
|
||||
@Deprecated
|
||||
public static Server getServer(Class<?> protocol,
|
||||
Object instance, String bindAddress,
|
||||
int port, Configuration conf)
|
||||
throws IOException {
|
||||
return getServer(protocol, instance, bindAddress, port, 1, false, conf, null,
|
||||
null);
|
||||
}
|
||||
|
||||
/** Construct a server for a protocol implementation instance.
|
||||
* @deprecated Please use {@link Builder} to build the {@link Server}
|
||||
*/
|
||||
@Deprecated
|
||||
public static Server getServer(Class<?> protocol,
|
||||
Object instance, String bindAddress, int port,
|
||||
int numHandlers,
|
||||
boolean verbose, Configuration conf)
|
||||
throws IOException {
|
||||
|
||||
return getServer(protocol, instance, bindAddress, port, numHandlers, verbose,
|
||||
conf, null, null);
|
||||
}
|
||||
|
||||
/** Construct a server for a protocol implementation instance.
|
||||
* @deprecated Please use {@link Builder} to build the {@link Server}
|
||||
*/
|
||||
@Deprecated
|
||||
public static Server getServer(Class<?> protocol,
|
||||
Object instance, String bindAddress, int port,
|
||||
int numHandlers,
|
||||
boolean verbose, Configuration conf,
|
||||
SecretManager<? extends TokenIdentifier> secretManager)
|
||||
throws IOException {
|
||||
return getServer(protocol, instance, bindAddress, port, numHandlers, verbose,
|
||||
conf, secretManager, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Please use {@link Builder} to build the {@link Server}
|
||||
*/
|
||||
@Deprecated
|
||||
public static Server getServer(Class<?> protocol,
|
||||
Object instance, String bindAddress, int port,
|
||||
int numHandlers,
|
||||
boolean verbose, Configuration conf,
|
||||
SecretManager<? extends TokenIdentifier> secretManager,
|
||||
String portRangeConfig)
|
||||
throws IOException {
|
||||
return getProtocolEngine(protocol, conf)
|
||||
.getServer(protocol, instance, bindAddress, port, numHandlers, -1, -1,
|
||||
verbose, conf, secretManager, portRangeConfig);
|
||||
}
|
||||
|
||||
/** Construct a server for a protocol implementation instance.
|
||||
* @deprecated Please use {@link Builder} to build the {@link Server}
|
||||
*/
|
||||
@Deprecated
|
||||
public static <PROTO extends VersionedProtocol, IMPL extends PROTO>
|
||||
Server getServer(Class<PROTO> protocol,
|
||||
IMPL instance, String bindAddress, int port,
|
||||
int numHandlers, int numReaders, int queueSizePerHandler,
|
||||
boolean verbose, Configuration conf,
|
||||
SecretManager<? extends TokenIdentifier> secretManager)
|
||||
throws IOException {
|
||||
|
||||
return getProtocolEngine(protocol, conf)
|
||||
.getServer(protocol, instance, bindAddress, port, numHandlers,
|
||||
numReaders, queueSizePerHandler, verbose, conf, secretManager,
|
||||
null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Class to construct instances of RPC server with specific options.
|
||||
*/
|
||||
|
@ -217,14 +217,14 @@ public ConnectionId getConnectionId() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSerial() throws Exception {
|
||||
public void testSerial() throws IOException, InterruptedException {
|
||||
testSerial(3, false, 2, 5, 100);
|
||||
testSerial(3, true, 2, 5, 10);
|
||||
}
|
||||
|
||||
public void testSerial(int handlerCount, boolean handlerSleep,
|
||||
int clientCount, int callerCount, int callCount)
|
||||
throws Exception {
|
||||
throws IOException, InterruptedException {
|
||||
Server server = new TestServer(handlerCount, handlerSleep);
|
||||
InetSocketAddress addr = NetUtils.getConnectAddress(server);
|
||||
server.start();
|
||||
@ -250,7 +250,7 @@ public void testSerial(int handlerCount, boolean handlerSleep,
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStandAloneClient() throws Exception {
|
||||
public void testStandAloneClient() throws IOException {
|
||||
Client client = new Client(LongWritable.class, conf);
|
||||
InetSocketAddress address = new InetSocketAddress("127.0.0.1", 10);
|
||||
try {
|
||||
@ -350,7 +350,8 @@ private void doErrorTest(
|
||||
Class<? extends LongWritable> clientParamClass,
|
||||
Class<? extends LongWritable> serverParamClass,
|
||||
Class<? extends LongWritable> serverResponseClass,
|
||||
Class<? extends LongWritable> clientResponseClass) throws Exception {
|
||||
Class<? extends LongWritable> clientResponseClass)
|
||||
throws IOException, InstantiationException, IllegalAccessException {
|
||||
|
||||
// start server
|
||||
Server server = new TestServer(1, false,
|
||||
@ -481,7 +482,7 @@ private static void assertExceptionContains(
|
||||
* to the client.
|
||||
*/
|
||||
@Test
|
||||
public void testSocketFactoryException() throws Exception {
|
||||
public void testSocketFactoryException() throws IOException {
|
||||
SocketFactory mockFactory = mock(SocketFactory.class);
|
||||
doThrow(new IOException("Injected fault")).when(mockFactory).createSocket();
|
||||
Client client = new Client(LongWritable.class, conf, mockFactory);
|
||||
@ -503,7 +504,7 @@ public void testSocketFactoryException() throws Exception {
|
||||
* HADOOP-7428.
|
||||
*/
|
||||
@Test
|
||||
public void testRTEDuringConnectionSetup() throws Exception {
|
||||
public void testRTEDuringConnectionSetup() throws IOException {
|
||||
// Set up a socket factory which returns sockets which
|
||||
// throw an RTE when setSoTimeout is called.
|
||||
SocketFactory spyFactory = spy(NetUtils.getDefaultSocketFactory(conf));
|
||||
@ -544,7 +545,7 @@ public Socket answer(InvocationOnMock invocation) throws Throwable {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIpcTimeout() throws Exception {
|
||||
public void testIpcTimeout() throws IOException {
|
||||
// start server
|
||||
Server server = new TestServer(1, true);
|
||||
InetSocketAddress addr = NetUtils.getConnectAddress(server);
|
||||
@ -566,7 +567,7 @@ public void testIpcTimeout() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIpcConnectTimeout() throws Exception {
|
||||
public void testIpcConnectTimeout() throws IOException {
|
||||
// start server
|
||||
Server server = new TestServer(1, true);
|
||||
InetSocketAddress addr = NetUtils.getConnectAddress(server);
|
||||
@ -589,7 +590,7 @@ public void testIpcConnectTimeout() throws Exception {
|
||||
* Check service class byte in IPC header is correct on wire.
|
||||
*/
|
||||
@Test(timeout=60000)
|
||||
public void testIpcWithServiceClass() throws Exception {
|
||||
public void testIpcWithServiceClass() throws IOException {
|
||||
// start server
|
||||
Server server = new TestServer(5, false);
|
||||
InetSocketAddress addr = NetUtils.getConnectAddress(server);
|
||||
@ -616,7 +617,7 @@ public void testIpcWithServiceClass() throws Exception {
|
||||
* Make a call from a client and verify if header info is changed in server side
|
||||
*/
|
||||
private void callAndVerify(Server server, InetSocketAddress addr,
|
||||
int serviceClass, boolean noChanged) throws Exception{
|
||||
int serviceClass, boolean noChanged) throws IOException{
|
||||
Client client = new Client(LongWritable.class, conf);
|
||||
|
||||
client.call(new LongWritable(RANDOM.nextLong()),
|
||||
@ -650,7 +651,7 @@ public void testIpcAfterStopping() throws IOException {
|
||||
* and stopping IPC servers.
|
||||
*/
|
||||
@Test(timeout=60000)
|
||||
public void testSocketLeak() throws Exception {
|
||||
public void testSocketLeak() throws IOException {
|
||||
Assume.assumeTrue(FD_DIR.exists()); // only run on Linux
|
||||
|
||||
long startFds = countOpenFileDescriptors();
|
||||
@ -670,31 +671,31 @@ private long countOpenFileDescriptors() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIpcFromHadoop_0_18_13() throws Exception {
|
||||
public void testIpcFromHadoop_0_18_13() throws IOException {
|
||||
doIpcVersionTest(NetworkTraces.HADOOP_0_18_3_RPC_DUMP,
|
||||
NetworkTraces.RESPONSE_TO_HADOOP_0_18_3_RPC);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIpcFromHadoop0_20_3() throws Exception {
|
||||
public void testIpcFromHadoop0_20_3() throws IOException {
|
||||
doIpcVersionTest(NetworkTraces.HADOOP_0_20_3_RPC_DUMP,
|
||||
NetworkTraces.RESPONSE_TO_HADOOP_0_20_3_RPC);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIpcFromHadoop0_21_0() throws Exception {
|
||||
public void testIpcFromHadoop0_21_0() throws IOException {
|
||||
doIpcVersionTest(NetworkTraces.HADOOP_0_21_0_RPC_DUMP,
|
||||
NetworkTraces.RESPONSE_TO_HADOOP_0_21_0_RPC);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHttpGetResponse() throws Exception {
|
||||
public void testHttpGetResponse() throws IOException {
|
||||
doIpcVersionTest("GET / HTTP/1.0\r\n\r\n".getBytes(),
|
||||
Server.RECEIVED_HTTP_REQ_RESPONSE.getBytes());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConnectionRetriesOnSocketTimeoutExceptions() throws Exception {
|
||||
public void testConnectionRetriesOnSocketTimeoutExceptions() throws IOException {
|
||||
Configuration conf = new Configuration();
|
||||
// set max retries to 0
|
||||
conf.setInt(
|
||||
@ -720,7 +721,7 @@ private static class CallInfo {
|
||||
* (2) the rpc client receives the same call id/retry from the rpc server.
|
||||
*/
|
||||
@Test
|
||||
public void testCallIdAndRetry() throws Exception {
|
||||
public void testCallIdAndRetry() throws IOException {
|
||||
final CallInfo info = new CallInfo();
|
||||
|
||||
// Override client to store the call info and check response
|
||||
@ -772,7 +773,7 @@ private interface DummyProtocol {
|
||||
* Test the retry count while used in a retry proxy.
|
||||
*/
|
||||
@Test
|
||||
public void testRetryProxy() throws Exception {
|
||||
public void testRetryProxy() throws IOException {
|
||||
final Client client = new Client(LongWritable.class, conf);
|
||||
|
||||
final TestServer server = new TestServer(1, false);
|
||||
@ -807,7 +808,7 @@ public void run() {
|
||||
* Test if the rpc server gets the default retry count (0) from client.
|
||||
*/
|
||||
@Test
|
||||
public void testInitialCallRetryCount() throws Exception {
|
||||
public void testInitialCallRetryCount() throws IOException {
|
||||
// Override client to store the call id
|
||||
final Client client = new Client(LongWritable.class, conf);
|
||||
|
||||
@ -838,7 +839,7 @@ public void run() {
|
||||
* Test if the rpc server gets the retry count from client.
|
||||
*/
|
||||
@Test
|
||||
public void testCallRetryCount() throws Exception {
|
||||
public void testCallRetryCount() throws IOException {
|
||||
final int retryCount = 255;
|
||||
// Override client to store the call id
|
||||
final Client client = new Client(LongWritable.class, conf);
|
||||
@ -870,9 +871,11 @@ public void run() {
|
||||
/**
|
||||
* Tests that client generates a unique sequential call ID for each RPC call,
|
||||
* even if multiple threads are using the same client.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Test
|
||||
public void testUniqueSequentialCallIds() throws Exception {
|
||||
public void testUniqueSequentialCallIds()
|
||||
throws IOException, InterruptedException {
|
||||
int serverThreads = 10, callerCount = 100, perCallerCallCount = 100;
|
||||
TestServer server = new TestServer(serverThreads, false);
|
||||
|
||||
@ -937,7 +940,7 @@ private void assertRetriesOnSocketTimeouts(Configuration conf,
|
||||
|
||||
private void doIpcVersionTest(
|
||||
byte[] requestData,
|
||||
byte[] expectedResponse) throws Exception {
|
||||
byte[] expectedResponse) throws IOException {
|
||||
Server server = new TestServer(1, true);
|
||||
InetSocketAddress addr = NetUtils.getConnectAddress(server);
|
||||
server.start();
|
||||
|
@ -115,7 +115,8 @@ public void run() {
|
||||
}
|
||||
}
|
||||
|
||||
public void testResponseBuffer() throws Exception {
|
||||
public void testResponseBuffer()
|
||||
throws IOException, InterruptedException {
|
||||
Server.INITIAL_RESP_BUF_SIZE = 1;
|
||||
conf.setInt(CommonConfigurationKeys.IPC_SERVER_RPC_MAX_RESPONSE_SIZE_KEY,
|
||||
1);
|
||||
@ -123,7 +124,8 @@ public void testResponseBuffer() throws Exception {
|
||||
conf = new Configuration(); // reset configuration
|
||||
}
|
||||
|
||||
public void testServerResponder() throws Exception {
|
||||
public void testServerResponder()
|
||||
throws IOException, InterruptedException {
|
||||
testServerResponder(10, true, 1, 10, 200);
|
||||
}
|
||||
|
||||
@ -131,7 +133,8 @@ public void testServerResponder(final int handlerCount,
|
||||
final boolean handlerSleep,
|
||||
final int clientCount,
|
||||
final int callerCount,
|
||||
final int callCount) throws Exception {
|
||||
final int callCount) throws IOException,
|
||||
InterruptedException {
|
||||
Server server = new TestServer(handlerCount, handlerSleep);
|
||||
server.start();
|
||||
|
||||
|
@ -323,7 +323,7 @@ public int getCloseCalled() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfRpc() throws Exception {
|
||||
public void testConfRpc() throws IOException {
|
||||
Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
|
||||
.setInstance(new TestImpl()).setBindAddress(ADDRESS).setPort(0)
|
||||
.setNumHandlers(1).setVerbose(false).build();
|
||||
@ -350,7 +350,7 @@ public void testConfRpc() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProxyAddress() throws Exception {
|
||||
public void testProxyAddress() throws IOException {
|
||||
Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
|
||||
.setInstance(new TestImpl()).setBindAddress(ADDRESS).setPort(0).build();
|
||||
TestProtocol proxy = null;
|
||||
@ -372,7 +372,7 @@ public void testProxyAddress() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSlowRpc() throws Exception {
|
||||
public void testSlowRpc() throws IOException {
|
||||
System.out.println("Testing Slow RPC");
|
||||
// create a server with two handlers
|
||||
Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
|
||||
@ -418,11 +418,11 @@ public void testSlowRpc() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCalls() throws Exception {
|
||||
public void testCalls() throws IOException {
|
||||
testCallsInternal(conf);
|
||||
}
|
||||
|
||||
private void testCallsInternal(Configuration conf) throws Exception {
|
||||
private void testCallsInternal(Configuration conf) throws IOException {
|
||||
Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
|
||||
.setInstance(new TestImpl()).setBindAddress(ADDRESS).setPort(0).build();
|
||||
TestProtocol proxy = null;
|
||||
@ -540,7 +540,7 @@ public Service[] getServices() {
|
||||
|
||||
}
|
||||
|
||||
private void doRPCs(Configuration conf, boolean expectFailure) throws Exception {
|
||||
private void doRPCs(Configuration conf, boolean expectFailure) throws IOException {
|
||||
Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
|
||||
.setInstance(new TestImpl()).setBindAddress(ADDRESS).setPort(0)
|
||||
.setNumHandlers(5).setVerbose(true).build();
|
||||
@ -599,7 +599,7 @@ public void testServerAddress() throws IOException {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAuthorization() throws Exception {
|
||||
public void testAuthorization() throws IOException {
|
||||
Configuration conf = new Configuration();
|
||||
conf.setBoolean(CommonConfigurationKeys.HADOOP_SECURITY_AUTHORIZATION,
|
||||
true);
|
||||
@ -626,7 +626,7 @@ public void testAuthorization() throws Exception {
|
||||
* Switch off setting socketTimeout values on RPC sockets.
|
||||
* Verify that RPC calls still work ok.
|
||||
*/
|
||||
public void testNoPings() throws Exception {
|
||||
public void testNoPings() throws IOException {
|
||||
Configuration conf = new Configuration();
|
||||
|
||||
conf.setBoolean("ipc.client.ping", false);
|
||||
@ -638,10 +638,10 @@ public void testNoPings() throws Exception {
|
||||
|
||||
/**
|
||||
* Test stopping a non-registered proxy
|
||||
* @throws Exception
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test(expected=HadoopIllegalArgumentException.class)
|
||||
public void testStopNonRegisteredProxy() throws Exception {
|
||||
public void testStopNonRegisteredProxy() throws IOException {
|
||||
RPC.stopProxy(null);
|
||||
}
|
||||
|
||||
@ -650,7 +650,7 @@ public void testStopNonRegisteredProxy() throws Exception {
|
||||
* be stopped without error.
|
||||
*/
|
||||
@Test
|
||||
public void testStopMockObject() throws Exception {
|
||||
public void testStopMockObject() throws IOException {
|
||||
RPC.stopProxy(MockitoUtil.mockProtocol(TestProtocol.class));
|
||||
}
|
||||
|
||||
@ -681,7 +681,7 @@ public void testWrappedStopProxy() throws IOException {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testErrorMsgForInsecureClient() throws Exception {
|
||||
public void testErrorMsgForInsecureClient() throws IOException {
|
||||
Configuration serverConf = new Configuration(conf);
|
||||
SecurityUtil.setAuthenticationMethod(AuthenticationMethod.KERBEROS,
|
||||
serverConf);
|
||||
@ -766,7 +766,7 @@ private static int countThreads(String search) {
|
||||
* Test that server.stop() properly stops all threads
|
||||
*/
|
||||
@Test
|
||||
public void testStopsAllThreads() throws Exception {
|
||||
public void testStopsAllThreads() throws IOException, InterruptedException {
|
||||
int threadsBefore = countThreads("Server$Listener$Reader");
|
||||
assertEquals("Expect no Reader threads running before test",
|
||||
0, threadsBefore);
|
||||
@ -797,7 +797,7 @@ public void testStopsAllThreads() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRPCBuilder() throws Exception {
|
||||
public void testRPCBuilder() throws IOException {
|
||||
// Test mandatory field conf
|
||||
try {
|
||||
new RPC.Builder(null).setProtocol(TestProtocol.class)
|
||||
@ -833,11 +833,13 @@ public void testRPCBuilder() throws Exception {
|
||||
}
|
||||
|
||||
@Test(timeout=90000)
|
||||
public void testRPCInterruptedSimple() throws Exception {
|
||||
public void testRPCInterruptedSimple() throws IOException {
|
||||
final Configuration conf = new Configuration();
|
||||
Server server = RPC.getServer(
|
||||
TestProtocol.class, new TestImpl(), ADDRESS, 0, 5, true, conf, null
|
||||
);
|
||||
Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
|
||||
.setInstance(new TestImpl()).setBindAddress(ADDRESS)
|
||||
.setPort(0).setNumHandlers(5).setVerbose(true)
|
||||
.setSecretManager(null).build();
|
||||
|
||||
server.start();
|
||||
try {
|
||||
InetSocketAddress addr = NetUtils.getConnectAddress(server);
|
||||
@ -866,9 +868,10 @@ TestProtocol.class, new TestImpl(), ADDRESS, 0, 5, true, conf, null
|
||||
@Test(timeout=30000)
|
||||
public void testRPCInterrupted() throws IOException, InterruptedException {
|
||||
final Configuration conf = new Configuration();
|
||||
Server server = RPC.getServer(
|
||||
TestProtocol.class, new TestImpl(), ADDRESS, 0, 5, true, conf, null
|
||||
);
|
||||
Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
|
||||
.setInstance(new TestImpl()).setBindAddress(ADDRESS)
|
||||
.setPort(0).setNumHandlers(5).setVerbose(true)
|
||||
.setSecretManager(null).build();
|
||||
|
||||
server.start();
|
||||
try {
|
||||
@ -929,7 +932,7 @@ public void run() {
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
public static void main(String[] args) throws IOException {
|
||||
new TestRPC().testCallsInternal(conf);
|
||||
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ public void testHashCode() throws Exception {
|
||||
TestProtocol3.class.getMethod("echo_alias", int.class));
|
||||
assertFalse(intEchoHash == intEchoHashAlias);
|
||||
|
||||
// Make sure that methods with the same returninig type and method name but
|
||||
// Make sure that methods with the same returning type and method name but
|
||||
// larger number of parameter types have different hash code
|
||||
int intEchoHash2 = ProtocolSignature.getFingerprint(
|
||||
TestProtocol3.class.getMethod("echo", int.class, int.class));
|
||||
|
@ -35,7 +35,7 @@
|
||||
public class TestSocketFactory {
|
||||
|
||||
@Test
|
||||
public void testSocketFactoryAsKeyInMap() throws Exception {
|
||||
public void testSocketFactoryAsKeyInMap() {
|
||||
Map<SocketFactory, Integer> dummyCache = new HashMap<SocketFactory, Integer>();
|
||||
int toBeCached1 = 1;
|
||||
int toBeCached2 = 2;
|
||||
|
@ -344,7 +344,6 @@ private static <T> Class<FailoverProxyProvider<T>> getFailoverProxyProviderClass
|
||||
}
|
||||
|
||||
/** Creates the Failover proxy provider instance*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T> FailoverProxyProvider<T> createFailoverProxyProvider(
|
||||
Configuration conf, Class<FailoverProxyProvider<T>> failoverProxyProviderClass,
|
||||
Class<T> xface, URI nameNodeUri) throws IOException {
|
||||
@ -354,9 +353,9 @@ private static <T> FailoverProxyProvider<T> createFailoverProxyProvider(
|
||||
try {
|
||||
Constructor<FailoverProxyProvider<T>> ctor = failoverProxyProviderClass
|
||||
.getConstructor(Configuration.class, URI.class, Class.class);
|
||||
FailoverProxyProvider<?> provider = ctor.newInstance(conf, nameNodeUri,
|
||||
FailoverProxyProvider<T> provider = ctor.newInstance(conf, nameNodeUri,
|
||||
xface);
|
||||
return (FailoverProxyProvider<T>) provider;
|
||||
return provider;
|
||||
} catch (Exception e) {
|
||||
String message = "Couldn't create proxy provider " + failoverProxyProviderClass;
|
||||
if (LOG.isDebugEnabled()) {
|
||||
|
@ -63,7 +63,7 @@
|
||||
* This class HAS to be in this package to access package private
|
||||
* methods/classes.
|
||||
*/
|
||||
@SuppressWarnings({"unchecked" , "deprecation"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public class TaskAttemptListenerImpl extends CompositeService
|
||||
implements TaskUmbilicalProtocol, TaskAttemptListener {
|
||||
|
||||
@ -118,11 +118,14 @@ protected void registerHeartbeatHandler(Configuration conf) {
|
||||
protected void startRpcServer() {
|
||||
Configuration conf = getConfig();
|
||||
try {
|
||||
server =
|
||||
RPC.getServer(TaskUmbilicalProtocol.class, this, "0.0.0.0", 0,
|
||||
conf.getInt(MRJobConfig.MR_AM_TASK_LISTENER_THREAD_COUNT,
|
||||
MRJobConfig.DEFAULT_MR_AM_TASK_LISTENER_THREAD_COUNT),
|
||||
false, conf, jobTokenSecretManager);
|
||||
server =
|
||||
new RPC.Builder(conf).setProtocol(TaskUmbilicalProtocol.class)
|
||||
.setInstance(this).setBindAddress("0.0.0.0")
|
||||
.setPort(0).setNumHandlers(
|
||||
conf.getInt(MRJobConfig.MR_AM_TASK_LISTENER_THREAD_COUNT,
|
||||
MRJobConfig.DEFAULT_MR_AM_TASK_LISTENER_THREAD_COUNT))
|
||||
.setVerbose(false).setSecretManager(jobTokenSecretManager)
|
||||
.build();
|
||||
|
||||
// Enable service authorization?
|
||||
if (conf.getBoolean(
|
||||
|
@ -137,11 +137,12 @@ public void ping() {
|
||||
/**
|
||||
* Test {@link AuditLogger} with IP set.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testAuditLoggerWithIP() throws Exception {
|
||||
Configuration conf = new Configuration();
|
||||
// start the IPC server
|
||||
Server server = RPC.getServer(new MyTestRPCServer(), "0.0.0.0", 0, conf);
|
||||
Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
|
||||
.setInstance(new MyTestRPCServer()).setBindAddress("0.0.0.0")
|
||||
.setPort(0).build();
|
||||
server.start();
|
||||
|
||||
InetSocketAddress addr = NetUtils.getConnectAddress(server);
|
||||
|
Loading…
Reference in New Issue
Block a user