Skip to content

Commit 7118c09

Browse files
authored
Java codelab: start_here now builds right after protos defined (#17)
1. With this, `../gradlew build` will work right after the first step - adding proto definitions. 2. Minor indent fixes for the comments
1 parent 7b83a42 commit 7118c09

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

codelabs/grpc-java-getting-started/start_here/src/main/java/io/grpc/examples/routeguide/RouteGuideClient.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ public RouteGuideClient(Channel channel) {
2727
/****************************************************************
2828
* Codelab Hint: Create a blocking stub for your service
2929
* using the code generated from the proto file (RouteGuideGrpc)
30-
*
31-
blockingStub =
3230
****************************************************************/
31+
blockingStub = null; // Replace
3332
}
3433

3534
/**
@@ -44,8 +43,8 @@ public void getFeature(int lat, int lon) {
4443
try {
4544
/****************************************************************
4645
* Codelab Hint: Use the blocking stub to make an RPC call to getFeature
47-
*
4846
****************************************************************/
47+
feature = null; // Replace
4948

5049
} catch (StatusRuntimeException e) {
5150
warning("RPC failed: {0}", e.getStatus());
@@ -64,7 +63,7 @@ public void getFeature(int lat, int lon) {
6463
}
6564

6665
/** Issues several different requests and then exits. */
67-
public static void main(String[] args) {
66+
public static void main(String[] args) throws InterruptedException {
6867
String target = "localhost:8980";
6968
if (args.length > 0) {
7069
if ("--help".equals(args[0])) {
@@ -76,9 +75,9 @@ public static void main(String[] args) {
7675
target = args[0];
7776
}
7877

79-
/***************************************************************
80-
* Codelab Hint: create a channel using target defined above
81-
***************************************************************/
78+
/***************************************************************
79+
* Codelab Hint: create a channel using target defined above
80+
***************************************************************/
8281
ManagedChannel channel = null; // Replace
8382

8483
try {

codelabs/grpc-java-getting-started/start_here/src/main/java/io/grpc/examples/routeguide/RouteGuideServer.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,20 @@ public RouteGuideServer(ServerBuilder<?> serverBuilder, int port, Collection<Fea
3636
this.port = port;
3737
/****************************************************************
3838
* Codelab Hint: Create a server object using the passed in serverBuilder
39-
*
40-
server =
4139
****************************************************************/
40+
server = null;
4241
}
4342

4443
/** Start serving requests. */
4544
public void start() throws IOException {
4645

47-
/****************************************************************
48-
* Codelab Hint: Start the server
49-
****************************************************************/
46+
/****************************************************************
47+
* Codelab Hint: Start the server
48+
****************************************************************/
5049

5150
logger.info("Server started, listening on " + port);
5251

53-
// Always configure a shutdown hook so that you can cleanly stop your server
52+
// Always configure a shutdown hook so that you can cleanly stop your server
5453
Runtime.getRuntime().addShutdownHook(new Thread() {
5554
@Override
5655
public void run() {
@@ -78,9 +77,9 @@ public void stop() throws InterruptedException {
7877
*/
7978
private void blockUntilShutdown() throws InterruptedException {
8079
if (server != null) {
81-
/****************************************************************
82-
* Codelab Hint: wait for server termination
83-
****************************************************************/
80+
/****************************************************************
81+
* Codelab Hint: wait for server termination
82+
****************************************************************/
8483
}
8584
}
8685

@@ -114,11 +113,10 @@ private static class RouteGuideService extends RouteGuideGrpc.RouteGuideImplBase
114113
*/
115114
@Override
116115
public void getFeature(Point request, StreamObserver<Feature> responseObserver) {
117-
/****************************************************************
118-
* Codelab Hint: use checkFeature so send an appropriate response
119-
* and mark the RPC complete
120-
****************************************************************/
121-
116+
/****************************************************************
117+
* Codelab Hint: use checkFeature so send an appropriate response
118+
* and mark the RPC complete
119+
****************************************************************/
122120
}
123121

124122
/**

0 commit comments

Comments
 (0)