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, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.apache.oozie.util;
020
021import java.util.concurrent.Callable;
022
023/**
024 * Extends Callable adding the concept of priority. <p> The priority is useful when queuing callables for later
025 * execution via the {@link org.apache.oozie.service.CallableQueueService}. <p> A higher number means a higher
026 * priority. <p>
027 */
028public interface XCallable<T> extends Callable<T> {
029
030    /**
031     * Return the callable name.
032     *
033     * @return the callable name.
034     */
035    String getName();
036
037    /**
038     * Return the priority of the callable.
039     *
040     * @return the callable priority.
041     */
042    int getPriority();
043
044    /**
045     * Return the callable type. <p> The callable type is used for concurrency throttling in the {@link
046     * org.apache.oozie.service.CallableQueueService}.
047     *
048     * @return the callable type.
049     */
050    String getType();
051
052    /**
053     * Returns the createdTime of the callable in milliseconds
054     *
055     * @return the callable createdTime
056     */
057    long getCreatedTime();
058
059    /**
060     * Return the key of the callable
061     *
062     * @return the callable key
063     */
064    String getKey();
065
066    /**
067     * Return the lock key of the callable
068     *
069     * @return the callable Lock key
070     */
071    String getEntityKey();
072
073    /**
074     * set the mode of execution for the callable. True if in interrupt, false
075     * if not
076     */
077    void setInterruptMode(boolean mode);
078
079    /**
080     * @return the mode of execution. true if it is executed as an Interrupt,
081     *         false otherwise
082     */
083    boolean inInterruptMode();
084
085}