ICommandScheduler
public
interface
ICommandScheduler
com.android.tradefed.command.ICommandScheduler |
用於執行 TradeFederation 指令的排程器。
摘要
巢狀類別 | |
---|---|
interface |
ICommandScheduler.IScheduledInvocationListener
叫用完成時的叫用事件監聽器。 |
公用方法 | |
---|---|
abstract
boolean
|
addCommand(String[] args)
將指令新增至排程器。 |
abstract
void
|
addCommandFile(String cmdFile,
將指定檔案中的所有指令新增至排程器 |
abstract
void
|
await()
等待排程器開始執行,包括等待舊 TF 的移交作業完成 (如適用)。 |
abstract
void
|
completeHandover()
通知指令排程器,已啟動的交接序列已完成,並應在預設通訊埠上重新初始化其遠端管理器。 |
abstract
void
|
displayCommandQueue(PrintWriter printWriter)
輸出指令執行佇列狀態的詳細偵錯資訊。 |
abstract
void
|
displayCommandsInfo(PrintWriter printWriter, String regex)
輸出目前指令清單。 |
abstract
void
|
displayInvocationsInfo(PrintWriter printWriter)
顯示目前叫用作業清單。 |
abstract
void
|
dumpCommandsXml(PrintWriter printWriter, String regex)
針對指令轉儲已展開的 XML 檔案,其中包含所有目前指令指定的 |
abstract
void
|
execCommand(IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener, String[] args)
直接配置裝置並執行指令,不必使用現有的 |
abstract
void
|
execCommand(ICommandScheduler.IScheduledInvocationListener listener, String[] args)
直接配置裝置並執行指令,但不將指令新增至指令佇列。 |
abstract
void
|
execCommand(ICommandScheduler.IScheduledInvocationListener listener, ITestDevice device, String[] args)
直接在已指派的裝置上執行指令。 |
abstract
CommandFileWatcher
|
getCommandFileWatcher()
取得此排程器的適當 |
abstract
int
|
getExecutingCommandCount()
傳回執行狀態的 Command 數量。 |
abstract
String
|
getInvocationInfo(int invocationId)
指定叫用 ID 後,傳回叫用作業的相關資訊。 |
abstract
CommandRunner.ExitCode
|
getLastInvocationExitCode()
傳回上次執行的呼叫的錯誤代碼。 |
abstract
Throwable
|
getLastInvocationThrowable()
從上次執行的叫用作業傳回 |
abstract
int
|
getReadyCommandCount()
傳回佇列中處於就緒狀態的指令數量。 |
abstract
void
|
handoverInitiationComplete()
通知指令排程器,目前使用的裝置和指令已完成初始交接交換作業,並可開始排程作業。 |
abstract
boolean
|
handoverShutdown(int handoverPort)
啟動 |
abstract
void
|
join()
等待排程器完成。 |
abstract
void
|
join(long millis)
等待排程器完成或在指定的時間長度 (以毫秒為單位) 後逾時。 |
abstract
void
|
removeAllCommands()
從排程器中移除所有指令 |
abstract
void
|
setClearcutClient(ClearcutClient client)
設定用戶端以回報束縛資料 |
abstract
boolean
|
shouldShutdownOnCmdfileError()
如果我們需要因指令錯誤而關閉排程器,則傳回 true |
abstract
void
|
shutdown()
嘗試安全關閉指令排程器。 |
abstract
void
|
shutdownHard(boolean killAdb)
嘗試強制關閉指令排程器。 |
abstract
void
|
shutdownHard()
嘗試強制關閉指令排程器。 |
abstract
void
|
shutdownOnEmpty()
與 |
abstract
void
|
start()
|
abstract
boolean
|
stopInvocation(int invocationId, String cause)
指定執行中呼叫的 ID,即可停止該呼叫。 |
default
boolean
|
stopInvocation(int invocationId)
指定 ID 即可停止執行中的叫用作業。 |
abstract
boolean
|
stopInvocation(ITestInvocation invocation)
停止執行中的叫用作業。 |
公用方法
addCommand
public abstract boolean addCommand (String[] args)
將指令新增至排程器。
指令基本上是執行設定的例項,以及相關聯的引數。
如果指定「--help」引數,設定的說明文字就會輸出至 stdout。否則,系統會將設定新增至佇列以便執行。
參數 | |
---|---|
args |
String :設定引數。 |
傳回 | |
---|---|
boolean |
true :指令是否已成功新增 |
擲回 | |
---|---|
ConfigurationException |
如果無法剖析指令 |
addCommandFile
public abstract void addCommandFile (String cmdFile,extraArgs)
將指定檔案中的所有指令新增至排程器
參數 | |
---|---|
cmdFile |
String :指令檔案的檔案系統路徑 |
extraArgs |
:String 引數的 ERROR(/List) ,用於附加至從檔案解析的每個指令。可以留空,但不得為空值。 |
擲回 | |
---|---|
ConfigurationException |
如果無法剖析指令檔案 |
另請參閱:
await
public abstract void await ()
等待排程器開始執行,包括等待舊 TF 的移交作業完成 (如適用)。
completeHandover
public abstract void completeHandover ()
通知指令排程器,已啟動的交接序列已完成,並且應在預設通訊埠上重新初始化其遠端管理器。
displayCommandQueue
public abstract void displayCommandQueue (PrintWriter printWriter)
輸出指令執行佇列狀態的詳細偵錯資訊。
displayCommandsInfo
public abstract void displayCommandsInfo (PrintWriter printWriter, String regex)
輸出目前指令的清單。
參數 | |
---|---|
printWriter |
PrintWriter :要輸出的 ERROR(/PrintWriter) 。 |
regex |
String :指令必須符合的規則運算式,才能進行列印。如果為空值,則會列印所有指令。 |
displayInvocationsInfo
public abstract void displayInvocationsInfo (PrintWriter printWriter)
顯示目前叫用作業清單。
參數 | |
---|---|
printWriter |
PrintWriter :輸出至 ERROR(/PrintWriter) 。 |
dumpCommandsXml
public abstract void dumpCommandsXml (PrintWriter printWriter, String regex)
針對所有目前指令指定的所有 Option
值,轉儲指令的展開 XML 檔案。
參數 | |
---|---|
printWriter |
PrintWriter :要輸出狀態的 ERROR(/PrintWriter) 。 |
regex |
String :指令必須與此規則運算式相符,才能轉儲 XML 檔案。如果為空值,則會轉儲所有指令。 |
execCommand
public abstract void execCommand (IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener, String[] args)
直接配置裝置並執行指令,不必使用現有的 IInvocationContext
將指令新增至指令佇列。
參數 | |
---|---|
context |
IInvocationContext :現有的 IInvocationContext 。 |
listener |
ICommandScheduler.IScheduledInvocationListener :要通知的 ICommandScheduler.IScheduledInvocationListener |
args |
String :指令引數 |
擲回 | |
---|---|
ConfigurationException |
如果指令無效 |
NoDeviceException |
如果沒有可用的裝置 |
execCommand
public abstract void execCommand (ICommandScheduler.IScheduledInvocationListener listener, String[] args)
直接配置裝置並執行指令,但不將指令新增至指令佇列。
參數 | |
---|---|
listener |
ICommandScheduler.IScheduledInvocationListener :要通知的 ICommandScheduler.IScheduledInvocationListener |
args |
String :指令引數 |
擲回 | |
---|---|
ConfigurationException |
如果指令無效 |
NoDeviceException |
如果沒有可用的裝置 |
execCommand
public abstract void execCommand (ICommandScheduler.IScheduledInvocationListener listener, ITestDevice device, String[] args)
直接在已指派的裝置上執行指令。
參數 | |
---|---|
listener |
ICommandScheduler.IScheduledInvocationListener :要通知的 ICommandScheduler.IScheduledInvocationListener |
device |
ITestDevice :要使用的 ITestDevice |
args |
String :指令引數 |
擲回 | |
---|---|
ConfigurationException |
如果指令無效 |
getCommandFileWatcher
public abstract CommandFileWatcher getCommandFileWatcher ()
取得此排程器的適當 CommandFileWatcher
傳回 | |
---|---|
CommandFileWatcher |
getExecutingCommandCount
public abstract int getExecutingCommandCount ()
傳回執行狀態的 Command 數量。
傳回 | |
---|---|
int |
getInvocationInfo
public abstract String getInvocationInfo (int invocationId)
指定叫用 ID 後,傳回叫用作業的相關資訊。
參數 | |
---|---|
invocationId |
int :叫用作業的追蹤 ID。 |
傳回 | |
---|---|
String |
包含叫用作業相關資訊的 String 。 |
getLastInvocationExitCode
public abstract CommandRunner.ExitCode getLastInvocationExitCode ()
傳回上次執行的叫用作業的錯誤代碼。如果尚未執行任何叫用作業,請傳回 0 (沒有錯誤)。
傳回 | |
---|---|
CommandRunner.ExitCode |
getLastInvocationThrowable
public abstract Throwable getLastInvocationThrowable ()
從上次執行的叫用作業傳回 Throwable
。如果沒有可用的 throwable,則傳回空值。
傳回 | |
---|---|
Throwable |
getReadyCommandCount
public abstract int getReadyCommandCount ()
傳回佇列中處於就緒狀態的指令數量。
傳回 | |
---|---|
int |
handoverInitiationComplete
public abstract void handoverInitiationComplete ()
通知指令排程器,目前使用的裝置和指令已完成初始交接交換作業,可以開始排程作業。
handoverShutdown
public abstract boolean handoverShutdown (int handoverPort)
啟動 shutdown()
,並將其交由同一主機上的其他 tradefed 程序處理。
排程器會在裝置釋放後,通知在該通訊埠上監聽的遠端 tradefed 程序。
參數 | |
---|---|
handoverPort |
int |
傳回 | |
---|---|
boolean |
true (如果啟動交接成功),否則為 false |
加入
public abstract void join (long millis)
等待排程器完成或在以毫秒為單位指定的時間長度後逾時。
參數 | |
---|---|
millis |
long |
另請參閱:
removeAllCommands
public abstract void removeAllCommands ()
從排程器中移除所有指令
setClearcutClient
public abstract void setClearcutClient (ClearcutClient client)
設定用戶端以回報束縛資料
參數 | |
---|---|
client |
ClearcutClient |
shouldShutdownOnCmdfileError
public abstract boolean shouldShutdownOnCmdfileError ()
如果我們需要因指令錯誤而關閉排程器,則傳回 true
傳回 | |
---|---|
boolean |
關機
public abstract void shutdown ()
嘗試安全關閉指令排程器。
清除等待測試的指令,並要求所有進行中的叫用作業妥善關閉。
在呼叫關閉作業後,排程器主迴圈會等待所有進行中的叫用作業完成,然後才完全結束。
shutdownHard
public abstract void shutdownHard (boolean killAdb)
嘗試強制關閉指令排程器。
與 shutdown()
類似,但也會選擇終止 ADB 連線,以便「啟動」進行中的叫用作業,讓作業更快完成。
參數 | |
---|---|
killAdb |
boolean |
shutdownHard
public abstract void shutdownHard ()
嘗試強制關閉指令排程器。與 shutdownHard(true) 相同。
shutdownOnEmpty
public abstract void shutdownOnEmpty ()
與 shutdown()
類似,但會等待所有指令執行完畢,再離開。
請注意,如果任何指令處於迴圈模式,排程器就不會結束。
stopInvocation
public abstract boolean stopInvocation (int invocationId, String cause)
指定執行中呼叫的 ID,停止該呼叫。
參數 | |
---|---|
invocationId |
int :叫用作業的追蹤 ID。 |
cause |
String :停止叫用的原因。 |
傳回 | |
---|---|
boolean |
如果已停止叫用,則傳回 true,否則傳回 false |
擲回 | |
---|---|
UnsupportedOperationException |
如果實作不支援此功能 |
stopInvocation
public boolean stopInvocation (int invocationId)
指定執行中呼叫的 ID,停止該呼叫。
參數 | |
---|---|
invocationId |
int |
傳回 | |
---|---|
boolean |
如果已停止叫用,則傳回 true,否則傳回 false |
擲回 | |
---|---|
UnsupportedOperationException |
如果實作不支援此功能 |
stopInvocation
public abstract boolean stopInvocation (ITestInvocation invocation)
停止執行中的叫用作業。
參數 | |
---|---|
invocation |
ITestInvocation |
傳回 | |
---|---|
boolean |
如果已停止叫用,則傳回 true,否則傳回 false |
擲回 | |
---|---|
UnsupportedOperationException |
如果實作不支援此功能 |