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.19 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.19-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.18 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.18-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.17 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.17-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.16 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.16-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.15 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.15-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.14 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.14-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.13 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.13-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.12 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.12-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.11-java embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.11 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.10 embulk-core/src/main/java/org/embulk/spi/TaskState.java
embulk-0.8.10-java embulk-core/src/main/java/org/embulk/spi/TaskState.java