Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
grpc_examples
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gabriele Civitarese
grpc_examples
Commits
c67a6f6d
Commit
c67a6f6d
authored
Apr 04, 2019
by
Gabriele Civitarese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small refactoring
parent
4db2957d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
GreetingServiceClient.java
src/main/java/grpchelloserver/GreetingServiceClient.java
+3
-2
No files found.
src/main/java/grpchelloserver/GreetingServiceClient.java
View file @
c67a6f6d
package
grpchelloserver
;
package
grpchelloserver
;
import
com.example.grpc.GreetingServiceGrpc
;
import
com.example.grpc.GreetingServiceGrpc
;
import
com.example.grpc.GreetingServiceGrpc.*
;
import
com.example.grpc.GreetingServiceOuterClass.*
;
import
com.example.grpc.GreetingServiceOuterClass.*
;
import
io.grpc.ManagedChannel
;
import
io.grpc.ManagedChannel
;
import
io.grpc.ManagedChannelBuilder
;
import
io.grpc.ManagedChannelBuilder
;
...
@@ -36,7 +37,7 @@ public class GreetingServiceClient {
...
@@ -36,7 +37,7 @@ public class GreetingServiceClient {
final
ManagedChannel
channel
=
ManagedChannelBuilder
.
forTarget
(
"localhost:8080"
).
usePlaintext
(
true
).
build
();
final
ManagedChannel
channel
=
ManagedChannelBuilder
.
forTarget
(
"localhost:8080"
).
usePlaintext
(
true
).
build
();
//creating a blocking stub on the channel
//creating a blocking stub on the channel
GreetingService
Grpc
.
GreetingService
BlockingStub
stub
=
GreetingServiceGrpc
.
newBlockingStub
(
channel
);
GreetingServiceBlockingStub
stub
=
GreetingServiceGrpc
.
newBlockingStub
(
channel
);
//creating the HelloResponse object which will be provided as input to the RPC method
//creating the HelloResponse object which will be provided as input to the RPC method
HelloRequest
request
=
HelloRequest
.
newBuilder
().
setName
(
"Pippo"
).
build
();
HelloRequest
request
=
HelloRequest
.
newBuilder
().
setName
(
"Pippo"
).
build
();
...
@@ -59,7 +60,7 @@ public class GreetingServiceClient {
...
@@ -59,7 +60,7 @@ public class GreetingServiceClient {
final
ManagedChannel
channel
=
ManagedChannelBuilder
.
forTarget
(
"localhost:8080"
).
usePlaintext
(
true
).
build
();
final
ManagedChannel
channel
=
ManagedChannelBuilder
.
forTarget
(
"localhost:8080"
).
usePlaintext
(
true
).
build
();
//creating an asynchronous stub on the channel
//creating an asynchronous stub on the channel
GreetingService
Grpc
.
GreetingService
Stub
stub
=
GreetingServiceGrpc
.
newStub
(
channel
);
GreetingServiceStub
stub
=
GreetingServiceGrpc
.
newStub
(
channel
);
//creating the HelloResponse object which will be provided as input to the RPC method
//creating the HelloResponse object which will be provided as input to the RPC method
HelloRequest
request
=
HelloRequest
.
newBuilder
().
setName
(
"Pippo"
).
build
();
HelloRequest
request
=
HelloRequest
.
newBuilder
().
setName
(
"Pippo"
).
build
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment