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.runtime.common.driver.task; 020 021 022import org.apache.reef.annotations.audience.DriverSide; 023import org.apache.reef.annotations.audience.Private; 024import org.apache.reef.driver.context.ActiveContext; 025import org.apache.reef.driver.task.CompletedTask; 026 027/** 028 * Implementation of CompletedTask. 029 */ 030@Private 031@DriverSide 032public final class CompletedTaskImpl implements CompletedTask { 033 034 private final ActiveContext context; 035 private final byte[] message; 036 private final String id; 037 038 public CompletedTaskImpl(final ActiveContext context, final byte[] message, final String id) { 039 this.context = context; 040 this.message = message; 041 this.id = id; 042 } 043 044 @Override 045 public ActiveContext getActiveContext() { 046 return this.context; 047 } 048 049 @Override 050 public byte[] get() { 051 return this.message; 052 } 053 054 @Override 055 public String getId() { 056 return this.id; 057 } 058 059 @Override 060 public String toString() { 061 return "CompletedTask{ID='" + getId() + "'}"; 062 } 063}