Advertisement
andersonalmada2

Untitled

Nov 29th, 2022
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. package server;
  2.  
  3. import java.io.IOException;
  4.  
  5. import io.grpc.Server;
  6. import io.grpc.ServerBuilder;
  7.  
  8. public class UserServer {
  9.  
  10.     public static void main(String[] args) throws IOException, InterruptedException {
  11.         System.out.println("Server start");
  12.         Server server = ServerBuilder.forPort(50051).addService(new Service()).build();
  13.         server.start();
  14.         Runtime.getRuntime().addShutdownHook(new Thread(() -> {
  15.             server.shutdown();
  16.         }));
  17.         server.awaitTermination();
  18.     }
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement