All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netflix.fenzo.queues.Assignable Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
package com.netflix.fenzo.queues;

import com.netflix.fenzo.AssignmentFailure;

/**
 * A wrapper object containing a task, and optionally an assignment failure for this task.
 */
public class Assignable {

    private final T task;
    private final AssignmentFailure assignmentFailure;

    private Assignable(T task, AssignmentFailure assignmentFailure) {
        this.task = task;
        this.assignmentFailure = assignmentFailure;
    }

    public T getTask() {
        return task;
    }

    public boolean hasFailure() {
        return assignmentFailure != null;
    }

    public AssignmentFailure getAssignmentFailure() {
        return assignmentFailure;
    }

    public static  Assignable success(T task) {
        return new Assignable<>(task, null);
    }

    public static  Assignable error(T task, AssignmentFailure assignmentFailure) {
        return new Assignable<>(task, assignmentFailure);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy