If the ancestry chain length is unreasonably long, then print an error to the log and record the stack trace.
(int generation)
| 1106 | * the stack trace. |
| 1107 | */ |
| 1108 | private static void validateGeneration(int generation) { |
| 1109 | if (generation == CONTEXT_DEPTH_WARN_THRESH) { |
| 1110 | log.log( |
| 1111 | Level.SEVERE, |
| 1112 | "Context ancestry chain length is abnormally long. " |
| 1113 | + "This suggests an error in application code. " |
| 1114 | + "Length exceeded: " + CONTEXT_DEPTH_WARN_THRESH, |
| 1115 | new Exception()); |
| 1116 | } |
| 1117 | } |
| 1118 | |
| 1119 | // Not using the standard com.google.errorprone.annotations.CheckReturnValue because that will |
| 1120 | // introduce dependencies that some io.grpc.Context API consumers may not want. |