Sha256: 61f3090108916821c4056027d0ec4ccf1334bd7dd9f36c4191fc691c33b9ddcb

Contents?: true

Size: 1.77 KB

Versions: 104

Compression:

Stored size: 1.77 KB

Contents

package org.embulk.spi;

import com.google.common.base.Optional;
import org.embulk.config.TaskReport;
import org.embulk.config.CommitReport;

public class TaskState
{
    private volatile boolean started = false;
    private volatile boolean finished = false;
    private volatile Optional<TaskReport> taskReport = Optional.absent();
    private volatile Optional<Throwable> exception = Optional.absent();

    public void start()
    {
        this.started = true;
    }

    public void finish()
    {
        this.started = true;
        this.finished = true;
    }

    public void setTaskReport(TaskReport taskReport)
    {
        this.started = true;
        this.taskReport = Optional.of(taskReport);
    }

    @Deprecated
    public void setCommitReport(CommitReport commitReport)
    {
        this.started = true;
        this.taskReport = Optional.<TaskReport>of(commitReport);
    }

    public void setException(Throwable exception)
    {
        this.started = true;
        this.exception = Optional.fromNullable(exception);
    }

    public void resetException()
    {
        this.started = true;
        this.exception = Optional.absent();
    }

    public boolean isStarted()
    {
        return started;
    }

    public boolean isFinished()
    {
        return finished;
    }

    public boolean isCommitted()
    {
        return taskReport.isPresent();
    }

    public Optional<TaskReport> getTaskReport()
    {
        return taskReport;
    }

    @Deprecated
    @SuppressWarnings("unchecked")
    public Optional<CommitReport> getCommitReport()
    {
        return (Optional) taskReport;  // the only implementation of TaskReport is DataSourceImpl which implements CommitReport;
    }

    public Optional<Throwable> getException()
    {
        return exception;
    }
}

Version data entries

104 entries across 104 versions & 1 rubygems

Version Path
embulk-0.8.0 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.0-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.10 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.10-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.9 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.9-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.8 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.8-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.7 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.7-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.6 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.6-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.5 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.5-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.4 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.4-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.3 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.3-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.2 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.7.2-java embulk-core/src/main/java/org/embulk/spi/TaskState.java