This project has retired. For details please refer to its Attic page.
Source code
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.javabridge;
020
021import org.apache.reef.annotations.audience.Interop;
022import org.apache.reef.annotations.audience.Private;
023import org.apache.reef.driver.task.SuspendedTask;
024import org.apache.reef.io.Message;
025import org.apache.reef.io.naming.Identifiable;
026
027/**
028 * The Java-CLR bridge object for {@link org.apache.reef.driver.task.SuspendedTask}.
029 */
030@Private
031@Interop(
032    CppFiles = { "Clr2JavaImpl.h", "SuspendedTaskClr2Java.cpp" },
033    CsFiles = { "ISuspendedTaskClr2Java.cs", "SuspendedTask.cs" })
034public final class SuspendedTaskBridge extends NativeBridge implements Identifiable, Message {
035
036  private final SuspendedTask jsuspendedTask;
037  private final String taskId;
038  private final ActiveContextBridge jactiveContext;
039
040  public SuspendedTaskBridge(final SuspendedTask suspendedTask,
041                             final ActiveContextBridgeFactory activeContextBridgeFactory) {
042    jsuspendedTask = suspendedTask;
043    taskId = suspendedTask.getId();
044    jactiveContext = activeContextBridgeFactory.getActiveContextBridge(jsuspendedTask.getActiveContext());
045  }
046
047  public ActiveContextBridge getActiveContext() {
048    return jactiveContext;
049  }
050
051  @Override
052  public void close() {
053  }
054
055  @Override
056  public String getId() {
057    return taskId;
058  }
059
060  @Override
061  public byte[] get() {
062    return jsuspendedTask.get();
063  }
064}