-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
220 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...oogle-grpc-1-42-it/src/test/java/com/navercorp/pinpoint/it/plugin/grpc/ShutdownUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.navercorp.pinpoint.it.plugin.grpc; | ||
|
||
import io.grpc.ManagedChannel; | ||
import io.grpc.Server; | ||
import io.netty.util.concurrent.EventExecutorGroup; | ||
import io.netty.util.concurrent.Future; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
public final class ShutdownUtils { | ||
private ShutdownUtils() { | ||
} | ||
|
||
public static boolean shutdownServer(Server server) { | ||
if (server == null) { | ||
return false; | ||
} | ||
try { | ||
return server.shutdown().awaitTermination(5, TimeUnit.SECONDS); | ||
} catch (InterruptedException e) { | ||
Thread.currentThread().interrupt(); | ||
} | ||
return false; | ||
} | ||
|
||
public static boolean shutdownEventExecutor(EventExecutorGroup eventExecutors) { | ||
if (eventExecutors == null) { | ||
return false; | ||
} | ||
try { | ||
Future<?> future = eventExecutors.shutdownGracefully(500, 500, TimeUnit.MILLISECONDS); | ||
future.await(3000); | ||
return future.isSuccess(); | ||
} catch (InterruptedException e) { | ||
Thread.currentThread().interrupt(); | ||
} | ||
return false; | ||
} | ||
|
||
public static boolean shutdownChannel(ManagedChannel channel) { | ||
if (channel == null) { | ||
return false; | ||
} | ||
try { | ||
channel.shutdown().awaitTermination(5, TimeUnit.SECONDS); | ||
} catch (InterruptedException e) { | ||
Thread.currentThread().interrupt(); | ||
} | ||
return false; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.