Skip to content

Commit

Permalink
Use InetSocketAddress as function param in RpcClientFactory
Browse files Browse the repository at this point in the history
SocketAddress represents a socket address with no protocol attachment.
It is too general to be useful as often the subclass needs to know the
hostname and port info.
  • Loading branch information
yaoshengzhe committed Oct 16, 2015
1 parent 4aefd5b commit 1fb9c7a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.youtube.vitess.client;

import java.net.SocketAddress;
import java.net.InetSocketAddress;

/**
* RpcClientFactory creates a concrete RpcClient.
*/
public interface RpcClientFactory {
RpcClient create(Context ctx, SocketAddress address);
RpcClient create(Context ctx, InetSocketAddress address);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import io.grpc.netty.NegotiationType;
import io.grpc.netty.NettyChannelBuilder;

import java.net.SocketAddress;
import java.net.InetSocketAddress;

/**
* GrpcClientFactory creates RpcClients with the gRPC implemenation.
*/
public class GrpcClientFactory implements RpcClientFactory {
@Override
public RpcClient create(Context ctx, SocketAddress address) {
public RpcClient create(Context ctx, InetSocketAddress address) {
return new GrpcClient(
NettyChannelBuilder.forAddress(address).negotiationType(NegotiationType.PLAINTEXT).build());
}
Expand Down

0 comments on commit 1fb9c7a

Please sign in to comment.