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