Skip to content

Commit

Permalink
Remove jsr dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangkun83 committed Sep 2, 2016
1 parent fe95db0 commit ec8a385
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
1 change: 0 additions & 1 deletion context/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ plugins {
description = 'gRPC: Context'

dependencies {
compile libraries.jsr305
testCompile project(':grpc-testing')
}

Expand Down
15 changes: 5 additions & 10 deletions context/src/main/java/io/grpc/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -380,7 +378,6 @@ public boolean isCancelled() {
* <p>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;
Expand All @@ -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);
}
Expand Down Expand Up @@ -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) {
Expand All @@ -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 {
Expand All @@ -742,7 +738,6 @@ public boolean isCancelled() {
return false;
}

@Nullable
@Override
public Throwable cancellationCause() {
if (isCancelled()) {
Expand Down Expand Up @@ -840,7 +835,7 @@ public void cancelled(Context context) {
}
}

private static <T> T checkNotNull(T reference, @Nullable Object errorMessage) {
private static <T> T checkNotNull(T reference, Object errorMessage) {
if (reference == null) {
throw new NullPointerException(String.valueOf(errorMessage));
}
Expand Down
4 changes: 1 addition & 3 deletions context/src/main/java/io/grpc/Deadline.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

import javax.annotation.Nullable;

/**
* An absolute deadline in system time.
*/
Expand Down Expand Up @@ -179,7 +177,7 @@ public long read() {
}
}

private static <T> T checkNotNull(T reference, @Nullable Object errorMessage) {
private static <T> T checkNotNull(T reference, Object errorMessage) {
if (reference == null) {
throw new NullPointerException(String.valueOf(errorMessage));
}
Expand Down

0 comments on commit ec8a385

Please sign in to comment.