001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.reef.vortex.protocol.workertomaster; 020 021import org.apache.reef.annotations.Unstable; 022import org.apache.reef.annotations.audience.DriverSide; 023import org.apache.reef.annotations.audience.Private; 024 025/** 026 * Report of a tasklet execution result. 027 */ 028@Unstable 029@Private 030@DriverSide 031public final class TaskletResultReport implements WorkerToMasterReport { 032 private int taskletId; 033 private Object result; 034 035 /** 036 * No-arg constructor required for Kryo to serialize/deserialize. 037 */ 038 TaskletResultReport() { 039 } 040 041 /** 042 * @param taskletId of the Tasklet. 043 * @param result of the tasklet execution. 044 */ 045 public TaskletResultReport(final int taskletId, final Object result) { 046 this.taskletId = taskletId; 047 this.result = result; 048 } 049 050 /** 051 * @return the type of this TaskletReport. 052 */ 053 @Override 054 public Type getType() { 055 return Type.TaskletResult; 056 } 057 058 /** 059 * @return the TaskletId of this TaskletReport 060 */ 061 public int getTaskletId() { 062 return taskletId; 063 } 064 065 /** 066 * @return the result of the tasklet execution. 067 */ 068 public Object getResult() { 069 return result; 070 } 071 072}