diff --git a/context/build.gradle b/context/build.gradle index d9cef85e8e4b..0566f6a0f319 100644 --- a/context/build.gradle +++ b/context/build.gradle @@ -5,7 +5,6 @@ plugins { description = 'gRPC: Context' dependencies { - compile libraries.jsr305 testCompile project(':grpc-testing') } diff --git a/context/src/main/java/io/grpc/Context.java b/context/src/main/java/io/grpc/Context.java index daa1a2898c9b..27a736750009 100644 --- a/context/src/main/java/io/grpc/Context.java +++ b/context/src/main/java/io/grpc/Context.java @@ -41,8 +41,6 @@ import java.util.logging.Level; import java.util.logging.Logger; -import javax.annotation.Nullable; - /** * A context propagation mechanism which can carry scoped-values across API boundaries and between * threads. Examples of state propagated via context include: @@ -380,7 +378,6 @@ public boolean isCancelled() { *
The cancellation cause is provided for informational purposes only and implementations
* should generally assume that it has already been handled and logged properly.
*/
- @Nullable
public Throwable cancellationCause() {
if (parent == null || !cascadesCancellation) {
return null;
@@ -393,7 +390,6 @@ public Throwable cancellationCause() {
* A context may have an associated {@link Deadline} at which it will be automatically cancelled.
* @return A {@link io.grpc.Deadline} or {@code null} if no deadline is set.
*/
- @Nullable
public Deadline getDeadline() {
return DEADLINE_KEY.get(this);
}
@@ -686,13 +682,13 @@ public boolean isCurrent() {
}
/**
- * Cancel this context and optionally provide a cause for the cancellation. This
- * will trigger notification of listeners.
+ * Cancel this context and optionally provide a cause (can be {@code null}) for the
+ * cancellation. This will trigger notification of listeners.
*
* @return {@code true} if this context cancelled the context and notified listeners,
* {@code false} if the context was already cancelled.
*/
- public boolean cancel(@Nullable Throwable cause) {
+ public boolean cancel(Throwable cause) {
boolean triggeredCancel = false;
synchronized (this) {
if (!cancelled) {
@@ -718,7 +714,7 @@ public boolean cancel(@Nullable Throwable cause) {
* @param toAttach context to make current.
* @param cause of cancellation, can be {@code null}.
*/
- public void detachAndCancel(Context toAttach, @Nullable Throwable cause) {
+ public void detachAndCancel(Context toAttach, Throwable cause) {
try {
detach(toAttach);
} finally {
@@ -742,7 +738,6 @@ public boolean isCancelled() {
return false;
}
- @Nullable
@Override
public Throwable cancellationCause() {
if (isCancelled()) {
@@ -840,7 +835,7 @@ public void cancelled(Context context) {
}
}
- private static