tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bi...@apache.org
Subject git commit: TEZ-886. Add @Nullable annotation at API level (Tsuyoshi OZAWA via bikas)
Date Wed, 30 Apr 2014 00:30:52 GMT
Repository: incubator-tez
Updated Branches:
  refs/heads/master e9b222e9b -> 6ec3580ee


TEZ-886. Add @Nullable annotation at API level (Tsuyoshi OZAWA via bikas)


Project: http://git-wip-us.apache.org/repos/asf/incubator-tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tez/commit/6ec3580e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tez/tree/6ec3580e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tez/diff/6ec3580e

Branch: refs/heads/master
Commit: 6ec3580ee62d92bf2d2f9d51c10fb13761317893
Parents: e9b222e
Author: Bikas Saha <bikas@apache.org>
Authored: Tue Apr 29 17:30:46 2014 -0700
Committer: Bikas Saha <bikas@apache.org>
Committed: Tue Apr 29 17:30:46 2014 -0700

----------------------------------------------------------------------
 pom.xml                                                  |  5 +++++
 tez-api/pom.xml                                          |  4 ++++
 .../main/java/org/apache/tez/client/PreWarmContext.java  | 11 ++++++++++-
 .../apache/tez/dag/api/VertexManagerPluginContext.java   | 10 +++++++---
 .../org/apache/tez/runtime/api/TezProcessorContext.java  |  1 +
 .../java/org/apache/tez/runtime/api/TezTaskContext.java  |  5 ++++-
 .../common/resources/InitialMemoryRequestContext.java    |  4 ++++
 tez-dag/pom.xml                                          |  4 ++++
 .../java/org/apache/tez/dag/app/ContainerContext.java    |  4 +++-
 .../main/java/org/apache/tez/dag/app/DAGAppMaster.java   |  2 ++
 .../src/main/java/org/apache/tez/dag/app/dag/Vertex.java |  5 +++++
 .../java/org/apache/tez/dag/app/dag/impl/VertexImpl.java |  7 ++++++-
 .../org/apache/tez/dag/app/dag/impl/VertexManager.java   |  6 +++++-
 tez-runtime-internals/pom.xml                            |  4 ++++
 .../apache/tez/runtime/api/impl/TezInputContextImpl.java |  3 +++
 .../tez/runtime/api/impl/TezOutputContextImpl.java       |  3 +++
 .../tez/runtime/api/impl/TezProcessorContextImpl.java    |  3 +++
 .../apache/tez/runtime/api/impl/TezTaskContextImpl.java  |  3 +++
 .../library/output/TestOnFileUnorderedKVOutput.java      |  6 +++++-
 19 files changed, 81 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5d9f80a..eec46be 100644
--- a/pom.xml
+++ b/pom.xml
@@ -314,6 +314,11 @@
         <artifactId>jettison</artifactId>
         <version>1.3.4</version>
       </dependency>
+      <dependency>
+        <groupId>com.google.code.findbugs</groupId>
+        <artifactId>jsr305</artifactId>
+        <version>2.0.3</version>
+      </dependency>
     </dependencies>
   </dependencyManagement>
 

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-api/pom.xml
----------------------------------------------------------------------
diff --git a/tez-api/pom.xml b/tez-api/pom.xml
index c73bf53..0bfea9e 100644
--- a/tez-api/pom.xml
+++ b/tez-api/pom.xml
@@ -54,6 +54,10 @@
      <artifactId>junit</artifactId>
     </dependency>
     <dependency>
+      <groupId>com.google.code.findbugs</groupId>
+      <artifactId>jsr305</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-common</artifactId>
       <type>test-jar</type>

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-api/src/main/java/org/apache/tez/client/PreWarmContext.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/client/PreWarmContext.java b/tez-api/src/main/java/org/apache/tez/client/PreWarmContext.java
index ddd117f..4b5ab15 100644
--- a/tez-api/src/main/java/org/apache/tez/client/PreWarmContext.java
+++ b/tez-api/src/main/java/org/apache/tez/client/PreWarmContext.java
@@ -18,6 +18,7 @@
 
 package org.apache.tez.client;
 
+import javax.annotation.Nullable;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.yarn.api.records.LocalResource;
@@ -27,6 +28,8 @@ import org.apache.tez.dag.api.VertexLocationHint;
 
 import java.util.Map;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 /**
  * Context to define how the pre-warm containers should be launched within a
  * session.
@@ -62,7 +65,9 @@ public class PreWarmContext {
   public PreWarmContext(ProcessorDescriptor processorDescriptor,
       Resource resource,
       int numTasks,
-      VertexLocationHint locationHints) {
+      @Nullable VertexLocationHint locationHints) {
+    checkNotNull(processorDescriptor, "processorDescriptor is null");
+    checkNotNull(resource, "resource is null");
     this.processorDescriptor =  processorDescriptor;
     this.resource = resource;
     this.numTasks = numTasks;
@@ -114,18 +119,22 @@ public class PreWarmContext {
     return numTasks;
   }
 
+  @Nullable
   public VertexLocationHint getLocationHints() {
     return locationHints;
   }
 
+  @Nullable
   public Map<String, LocalResource> getLocalResources() {
     return localResources;
   }
 
+  @Nullable
   public Map<String, String> getEnvironment() {
     return environment;
   }
 
+  @Nullable
   public String getJavaOpts() {
     return javaOpts;
   }

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-api/src/main/java/org/apache/tez/dag/api/VertexManagerPluginContext.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/dag/api/VertexManagerPluginContext.java
b/tez-api/src/main/java/org/apache/tez/dag/api/VertexManagerPluginContext.java
index 5d53b60..70cb6d2 100644
--- a/tez-api/src/main/java/org/apache/tez/dag/api/VertexManagerPluginContext.java
+++ b/tez-api/src/main/java/org/apache/tez/dag/api/VertexManagerPluginContext.java
@@ -26,6 +26,7 @@ import javax.annotation.Nullable;
 
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
 import org.apache.hadoop.yarn.api.records.Container;
+import javax.annotation.Nullable;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.tez.dag.api.VertexLocationHint.TaskLocationHint;
 import org.apache.tez.runtime.api.events.RootInputDataInformationEvent;
@@ -72,6 +73,7 @@ public interface VertexManagerPluginContext {
    * Get the payload set for the plugin
    * @return user payload
    */
+  @Nullable
   public byte[] getUserPayload();
   
   /**
@@ -119,8 +121,9 @@ public interface VertexManagerPluginContext {
    * @param sourceEdgeManagers Edge Managers to be updated
    * @return true if the operation was allowed.
    */
-  public boolean setVertexParallelism(int parallelism, VertexLocationHint locationHint,
-      Map<String, EdgeManagerDescriptor> sourceEdgeManagers);
+  public boolean setVertexParallelism(int parallelism,
+      @Nullable VertexLocationHint locationHint,
+      @Nullable Map<String, EdgeManagerDescriptor> sourceEdgeManagers);
   
   /**
    * Allows a VertexManagerPlugin to assign Events for Root Inputs
@@ -139,7 +142,7 @@ public interface VertexManagerPluginContext {
   
   /**
    * Notify the vertex to start the given tasks
-   * @param taskIDs Indices of the tasks to be started
+   * @param tasks Indices of the tasks to be started
    */
   public void scheduleVertexTasks(List<TaskWithLocationHint> tasks);
   
@@ -148,6 +151,7 @@ public interface VertexManagerPluginContext {
    * sources of data.
    * @return Names of inputs to this vertex. Maybe null if there are no inputs
    */
+  @Nullable
   public Set<String> getVertexInputNames();
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-api/src/main/java/org/apache/tez/runtime/api/TezProcessorContext.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/runtime/api/TezProcessorContext.java b/tez-api/src/main/java/org/apache/tez/runtime/api/TezProcessorContext.java
index 913e6df..0e610d6 100644
--- a/tez-api/src/main/java/org/apache/tez/runtime/api/TezProcessorContext.java
+++ b/tez-api/src/main/java/org/apache/tez/runtime/api/TezProcessorContext.java
@@ -20,6 +20,7 @@ package org.apache.tez.runtime.api;
 
 import java.io.IOException;
 import java.util.Collection;
+import javax.annotation.Nullable;
 
 /**
  * Context handle for the Processor to initialize itself.

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-api/src/main/java/org/apache/tez/runtime/api/TezTaskContext.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/runtime/api/TezTaskContext.java b/tez-api/src/main/java/org/apache/tez/runtime/api/TezTaskContext.java
index 6a7154c..f3d34df 100644
--- a/tez-api/src/main/java/org/apache/tez/runtime/api/TezTaskContext.java
+++ b/tez-api/src/main/java/org/apache/tez/runtime/api/TezTaskContext.java
@@ -21,6 +21,7 @@ package org.apache.tez.runtime.api;
 import java.nio.ByteBuffer;
 import java.util.List;
 
+import javax.annotation.Nullable;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.tez.common.counters.TezCounters;
 
@@ -90,6 +91,7 @@ public interface TezTaskContext {
    * Get the User Payload for the Input/Output/Processor
    * @return User Payload
    */
+  @Nullable
   public byte[] getUserPayload();
 
   /**
@@ -112,7 +114,7 @@ public interface TezTaskContext {
    *
    * @param exception an exception representing the error
    */
-  public void fatalError(Throwable exception, String message);
+  public void fatalError(@Nullable Throwable exception, @Nullable String message);
 
   /**
    * Returns meta-data for the specified service. As an example, when the MR
@@ -133,6 +135,7 @@ public interface TezTaskContext {
    *          the name of the service for which provider meta-data is required
    * @return a ByteBuffer representing the meta-data
    */
+  @Nullable
   public ByteBuffer getServiceProviderMetaData(String serviceName);
   
   /**

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-api/src/main/java/org/apache/tez/runtime/common/resources/InitialMemoryRequestContext.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/runtime/common/resources/InitialMemoryRequestContext.java
b/tez-api/src/main/java/org/apache/tez/runtime/common/resources/InitialMemoryRequestContext.java
index 4f3fc46..aec3795 100644
--- a/tez-api/src/main/java/org/apache/tez/runtime/common/resources/InitialMemoryRequestContext.java
+++ b/tez-api/src/main/java/org/apache/tez/runtime/common/resources/InitialMemoryRequestContext.java
@@ -18,6 +18,7 @@
 
 package org.apache.tez.runtime.common.resources;
 
+import com.google.common.base.Preconditions;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 
 
@@ -37,6 +38,9 @@ public class InitialMemoryRequestContext {
 
   public InitialMemoryRequestContext(long requestedSize, String componentClassName,
       ComponentType componentType, String componentVertexName) {
+    Preconditions.checkNotNull(componentClassName, "componentClassName is null");
+    Preconditions.checkNotNull(componentType, "componentType is null");
+    Preconditions.checkNotNull(componentVertexName, "componentVertexName is null");
     this.requestedSize = requestedSize;
     this.componentClassName = componentClassName;
     this.componentType = componentType;

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-dag/pom.xml
----------------------------------------------------------------------
diff --git a/tez-dag/pom.xml b/tez-dag/pom.xml
index 93ed9ef..ae8aabd 100644
--- a/tez-dag/pom.xml
+++ b/tez-dag/pom.xml
@@ -55,6 +55,10 @@
       <type>test-jar</type>
     </dependency>
     <dependency>
+      <groupId>com.google.code.findbugs</groupId>
+      <artifactId>jsr305</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-yarn-common</artifactId>
       <type>test-jar</type>

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-dag/src/main/java/org/apache/tez/dag/app/ContainerContext.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/ContainerContext.java b/tez-dag/src/main/java/org/apache/tez/dag/app/ContainerContext.java
index 7eccb8f..cf688b3 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/ContainerContext.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/ContainerContext.java
@@ -22,6 +22,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
 
+import javax.annotation.Nullable;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.security.Credentials;
@@ -59,7 +60,7 @@ public class ContainerContext {
   
   public ContainerContext(Map<String, LocalResource> localResources,
       Credentials credentials, Map<String, String> environment, String javaOpts,
-      Vertex vertex) {
+      @Nullable Vertex vertex) {
     Preconditions.checkNotNull(localResources,
         "localResources should not be null");
     Preconditions.checkNotNull(credentials, "credentials should not be null");
@@ -93,6 +94,7 @@ public class ContainerContext {
    *         container context.
    */
   public boolean isSuperSet(ContainerContext otherContext) {
+    Preconditions.checkNotNull(otherContext, "otherContext should not null");
     // Assumptions:
     // Credentials are the same for all containers belonging to a DAG.
     // Matching can be added if containers are used across DAGs

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java b/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
index eba41fe..2df3de1 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
@@ -18,6 +18,7 @@
 
 package org.apache.tez.dag.app;
 
+import com.google.common.base.Preconditions;
 import static com.google.common.base.Preconditions.checkNotNull;
 
 import java.io.File;
@@ -1345,6 +1346,7 @@ public class DAGAppMaster extends AbstractService {
 
     @Override
     public void setDAG(DAG dag) {
+      Preconditions.checkNotNull(dag, "dag is null");
       try {
         wLock.lock();
         this.dag = dag;

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-dag/src/main/java/org/apache/tez/dag/app/dag/Vertex.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/Vertex.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/Vertex.java
index 2ff20b8..93f047a 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/Vertex.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/Vertex.java
@@ -22,6 +22,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import javax.annotation.Nullable;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.tez.common.counters.TezCounters;
 import org.apache.tez.dag.api.EdgeManagerDescriptor;
@@ -78,6 +79,7 @@ public interface Vertex extends Comparable<Vertex> {
   ProgressBuilder getVertexProgress();
   VertexStatusBuilder getVertexStatus(Set<StatusGetOpts> statusOptions);
 
+  @Nullable
   TaskLocationHint getTaskLocationHint(TezTaskID taskID);
 
   boolean setParallelism(int parallelism, VertexLocationHint vertexLocationHint,
@@ -96,7 +98,9 @@ public interface Vertex extends Comparable<Vertex> {
   void setAdditionalInputs(List<RootInputLeafOutputProto> inputs);
   void setAdditionalOutputs(List<RootInputLeafOutputProto> outputs);
 
+  @Nullable
   Map<String, RootInputLeafOutputDescriptor<InputDescriptor>> getAdditionalInputs();
+  @Nullable
   Map<String, RootInputLeafOutputDescriptor<OutputDescriptor>> getAdditionalOutputs();
 
   List<InputSpec> getInputSpecList(int taskIndex);
@@ -113,6 +117,7 @@ public interface Vertex extends Comparable<Vertex> {
 
   ProcessorDescriptor getProcessorDescriptor();
   public DAG getDAG();
+  @Nullable
   VertexTerminationCause getTerminationCause();
 
   // TODO remove this once RootInputVertexManager is fixed to not use

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
index f8fab0d..9701be4 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
@@ -35,6 +35,7 @@ import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
+import javax.annotation.Nullable;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
@@ -3238,12 +3239,14 @@ public class VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
     }
 
   }
-  
+
+  @Nullable
   @Override
   public Map<String, OutputCommitter> getOutputCommitters() {
     return outputCommitters;
   }
 
+  @Nullable
   @Private
   @VisibleForTesting
   public OutputCommitter getOutputCommitter(String outputName) {
@@ -3272,11 +3275,13 @@ public class VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
     }
   }
 
+  @Nullable
   @Override
   public Map<String, RootInputLeafOutputDescriptor<InputDescriptor>> getAdditionalInputs()
{
     return this.additionalInputs;
   }
 
+  @Nullable
   @Override
   public Map<String, RootInputLeafOutputDescriptor<OutputDescriptor>> getAdditionalOutputs()
{
     return this.additionalOutputs;

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexManager.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexManager.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexManager.java
index a6289ad..86362c3 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexManager.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexManager.java
@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import javax.annotation.Nullable;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.yarn.api.records.Container;
@@ -75,7 +76,7 @@ public class VertexManager {
     private EventMetaData rootEventSourceMetadata = new EventMetaData(EventProducerConsumerType.INPUT,
         managedVertex.getName(), "NULL_VERTEX", null);
     private Map<String, EventMetaData> destinationEventMetadataMap = Maps.newHashMap();
-    
+
     @Override
     public Map<String, EdgeProperty> getInputVertexEdgeProperties() {
       // TODO Something similar for Initial Inputs - payload etc visible
@@ -109,6 +110,7 @@ public class VertexManager {
       managedVertex.scheduleTasks(tasks);
     }
 
+    @Nullable
     @Override
     public Set<String> getVertexInputNames() {
       Set<String> inputNames = null;
@@ -120,6 +122,7 @@ public class VertexManager {
       return inputNames;
     }
 
+    @Nullable
     @Override
     public byte[] getUserPayload() {
       return payload;
@@ -147,6 +150,7 @@ public class VertexManager {
 
     @Override
     public void setVertexLocationHint(VertexLocationHint locationHint) {
+      Preconditions.checkNotNull(locationHint, "locationHint is null");
       managedVertex.setVertexLocationHint(locationHint);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-runtime-internals/pom.xml
----------------------------------------------------------------------
diff --git a/tez-runtime-internals/pom.xml b/tez-runtime-internals/pom.xml
index 62d1661..722682b 100644
--- a/tez-runtime-internals/pom.xml
+++ b/tez-runtime-internals/pom.xml
@@ -58,6 +58,10 @@
       <artifactId>junit</artifactId>
     </dependency>
     <dependency>
+      <groupId>com.google.code.findbugs</groupId>
+      <artifactId>jsr305</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-all</artifactId>
       <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezInputContextImpl.java
----------------------------------------------------------------------
diff --git a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezInputContextImpl.java
b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezInputContextImpl.java
index 1daf211..53c82f6 100644
--- a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezInputContextImpl.java
+++ b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezInputContextImpl.java
@@ -18,6 +18,7 @@
 
 package org.apache.tez.runtime.api.impl;
 
+import com.google.common.base.Preconditions;
 import static com.google.common.base.Preconditions.checkNotNull;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
@@ -87,6 +88,7 @@ public class TezInputContextImpl extends TezTaskContextImpl
 
   @Override
   public void sendEvents(List<Event> events) {
+    Preconditions.checkNotNull(events, "events are null");
     List<TezEvent> tezEvents = new ArrayList<TezEvent>(events.size());
     for (Event e : events) {
       TezEvent tEvt = new TezEvent(e, sourceInfo);
@@ -95,6 +97,7 @@ public class TezInputContextImpl extends TezTaskContextImpl
     tezUmbilical.addEvents(tezEvents);
   }
 
+  @Nullable
   @Override
   public byte[] getUserPayload() {
     return userPayload;

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezOutputContextImpl.java
----------------------------------------------------------------------
diff --git a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezOutputContextImpl.java
b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezOutputContextImpl.java
index 6ba8581..2b1bbf6 100644
--- a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezOutputContextImpl.java
+++ b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezOutputContextImpl.java
@@ -18,6 +18,7 @@
 
 package org.apache.tez.runtime.api.impl;
 
+import com.google.common.base.Preconditions;
 import static com.google.common.base.Preconditions.checkNotNull;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
@@ -80,6 +81,7 @@ public class TezOutputContextImpl extends TezTaskContextImpl
 
   @Override
   public void sendEvents(List<Event> events) {
+    Preconditions.checkNotNull(events, "events are null");
     List<TezEvent> tezEvents = new ArrayList<TezEvent>(events.size());
     for (Event e : events) {
       TezEvent tEvt = new TezEvent(e, sourceInfo);
@@ -88,6 +90,7 @@ public class TezOutputContextImpl extends TezTaskContextImpl
     tezUmbilical.addEvents(tezEvents);
   }
 
+  @Nullable
   @Override
   public byte[] getUserPayload() {
     return userPayload;

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezProcessorContextImpl.java
----------------------------------------------------------------------
diff --git a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezProcessorContextImpl.java
b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezProcessorContextImpl.java
index 091dbdc..a1005b9 100644
--- a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezProcessorContextImpl.java
+++ b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezProcessorContextImpl.java
@@ -18,6 +18,7 @@
 
 package org.apache.tez.runtime.api.impl;
 
+import com.google.common.base.Preconditions;
 import static com.google.common.base.Preconditions.checkNotNull;
 import java.io.IOException;
 import java.nio.ByteBuffer;
@@ -68,6 +69,7 @@ public class TezProcessorContextImpl extends TezTaskContextImpl implements
TezPr
 
   @Override
   public void sendEvents(List<Event> events) {
+    Preconditions.checkNotNull(events, "events are null");
     List<TezEvent> tezEvents = new ArrayList<TezEvent>(events.size());
     for (Event e : events) {
       TezEvent tEvt = new TezEvent(e, sourceInfo);
@@ -76,6 +78,7 @@ public class TezProcessorContextImpl extends TezTaskContextImpl implements
TezPr
     tezUmbilical.addEvents(tezEvents);
   }
 
+  @Nullable
   @Override
   public byte[] getUserPayload() {
     return userPayload;

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezTaskContextImpl.java
----------------------------------------------------------------------
diff --git a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezTaskContextImpl.java
b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezTaskContextImpl.java
index e041c23..70000d6 100644
--- a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezTaskContextImpl.java
+++ b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/api/impl/TezTaskContextImpl.java
@@ -24,6 +24,7 @@ import java.util.Arrays;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import javax.annotation.Nullable;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.util.StringUtils;
@@ -152,8 +153,10 @@ public abstract class TezTaskContextImpl implements TezTaskContext {
         .asReadOnlyBuffer().rewind();
   }
 
+  @Nullable
   @Override
   public ByteBuffer getServiceProviderMetaData(String serviceName) {
+    Preconditions.checkNotNull(serviceName, "serviceName is null");
     return AuxiliaryServiceHelper.getServiceDataFromEnv(
         serviceName, auxServiceEnv);
   }

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/6ec3580e/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileUnorderedKVOutput.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileUnorderedKVOutput.java
b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileUnorderedKVOutput.java
index 064cbbc..9776055 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileUnorderedKVOutput.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileUnorderedKVOutput.java
@@ -19,6 +19,7 @@
 package org.apache.tez.runtime.library.output;
 
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertFalse;
@@ -120,10 +121,13 @@ public class TestOnFileUnorderedKVOutput {
     AuxiliaryServiceHelper.setServiceDataIntoEnv(ShuffleUtils.SHUFFLE_HANDLER_SERVICE_ID,
bb, auxEnv);
 
 
+    OutputDescriptor outputDescriptor = mock(OutputDescriptor.class);
+    when(outputDescriptor.getClassName()).thenReturn("OutputDescriptor");
+
     TezOutputContext outputContext = new TezOutputContextImpl(conf,
         appAttemptNumber, tezUmbilical, dagName, taskVertexName, destinationVertexName,
         taskAttemptID, counters, 0, userPayload, runtimeTask,
-        null, auxEnv, new MemoryDistributor(1, 1, conf) , mock(OutputDescriptor.class));
+        null, auxEnv, new MemoryDistributor(1, 1, conf) , outputDescriptor);
 
     List<Event> events = null;
 


Mime
View raw message