I命令調度器
public interface ICommandScheduler
com.android.tradefed.command.ICommandScheduler |
用於執行 TradeFederation 指令的調度程式。
概括
嵌套類 | |
---|---|
interface | ICommandScheduler.IScheduledInvocationListener 呼叫完成時呼叫事件的偵聽器。 |
公共方法 | |
---|---|
abstract boolean | addCommand (String[] args) 在調度程序中新增命令。 |
abstract void | addCommandFile (String cmdFile, extraArgs) addCommandFile (String cmdFile, extraArgs) 將給定檔案中的所有命令新增至調度程序 |
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 () 傳回處於執行狀態的命令數。 |
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) 停止正在運行的呼叫。 |
公共方法
新增命令
public abstract boolean addCommand (String[] args)
在調度程序中新增命令。
命令本質上是要運行的配置及其關聯參數的實例。如果指定了「--help」參數,則配置的說明文字將輸出到標準輸出。否則,配置將被加入到佇列中運行。參數 | |
---|---|
args | String :配置參數。 |
退貨 | |
---|---|
boolean | true 如果指令加入成功 |
投擲 | |
---|---|
ConfigurationException | if 指令無法解析 |
新增命令文件
public abstract void addCommandFile (String cmdFile,extraArgs)
將給定檔案中的所有命令新增至調度程序
參數 | |
---|---|
cmdFile | String : 命令檔案的檔案系統路徑 |
extraArgs | String 參數的ERROR(/List) 。可以為空,但不應為空。 |
投擲 | |
---|---|
ConfigurationException | 如果無法解析命令文件 |
也可以看看:
等待
public abstract void await ()
等待調度程序開始運行,包括等待舊 TF 的切換完成(如果適用)。
完成切換
public abstract void completeHandover ()
通知命令調度程序啟動的切換序列已完全完成,並且它應該在預設連接埠上重新初始化其遠端管理器。
顯示命令隊列
public abstract void displayCommandQueue (PrintWriter printWriter)
輸出有關命令執行佇列狀態的詳細偵錯資訊。
顯示命令訊息
public abstract void displayCommandsInfo (PrintWriter printWriter, String regex)
輸出當前命令的列表。
參數 | |
---|---|
printWriter | PrintWriter :要輸出到的ERROR(/PrintWriter) 。 |
regex | String :指令應與其相符才能列印的正規表示式。如果為空,則將列印所有命令。 |
顯示呼叫訊息
public abstract void displayInvocationsInfo (PrintWriter printWriter)
顯示目前呼叫的清單。
參數 | |
---|---|
printWriter | PrintWriter :要輸出到的ERROR(/PrintWriter) 。 |
dumpCommandsXml
public abstract void dumpCommandsXml (PrintWriter printWriter, String regex)
轉儲該命令的擴展 xml 文件,其中包含為所有當前命令指定的所有Option
值。
參數 | |
---|---|
printWriter | PrintWriter :將狀態輸出到的ERROR(/PrintWriter) 。 |
regex | String :命令應與其匹配的正規表示式,以便轉儲 xml 檔案。如果為 null,則所有命令都將被轉儲。 |
執行命令
public abstract void execCommand (IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener, String[] args)
直接分配裝置並執行命令,而不使用現有的IInvocationContext
將其新增至命令佇列。
參數 | |
---|---|
context | IInvocationContext :現有的IInvocationContext 。 |
listener | ICommandScheduler.IScheduledInvocationListener :要通知的ICommandScheduler.IScheduledInvocationListener |
args | String : 指令參數 |
投擲 | |
---|---|
ConfigurationException | 如果命令無效 |
NoDeviceException | 如果沒有設備可以使用 |
執行命令
public abstract void execCommand (ICommandScheduler.IScheduledInvocationListener listener, String[] args)
直接分配設備並執行命令,而不將其添加到命令隊列。
參數 | |
---|---|
listener | ICommandScheduler.IScheduledInvocationListener :要通知的ICommandScheduler.IScheduledInvocationListener |
args | String : 指令參數 |
投擲 | |
---|---|
ConfigurationException | 如果命令無效 |
NoDeviceException | 如果沒有設備可以使用 |
執行命令
public abstract void execCommand (ICommandScheduler.IScheduledInvocationListener listener, ITestDevice device, String[] args)
直接在已指派的設備上執行命令。
參數 | |
---|---|
listener | ICommandScheduler.IScheduledInvocationListener :要通知的ICommandScheduler.IScheduledInvocationListener |
device | ITestDevice :要使用的ITestDevice |
args | String : 指令參數 |
投擲 | |
---|---|
ConfigurationException | 如果命令無效 |
取得命令文件觀察者
public abstract CommandFileWatcher getCommandFileWatcher ()
為該調度程序取得適當的CommandFileWatcher
退貨 | |
---|---|
CommandFileWatcher |
取得執行命令計數
public abstract int getExecutingCommandCount ()
傳回處於執行狀態的命令數。
退貨 | |
---|---|
int |
獲取呼叫訊息
public abstract String getInvocationInfo (int invocationId)
傳回有關指定呼叫 ID 的呼叫的資訊。
參數 | |
---|---|
invocationId | int :調用的追蹤 ID。 |
退貨 | |
---|---|
String | 包含有關呼叫的資訊的String 。 |
取得最後調用退出程式碼
public abstract CommandRunner.ExitCode getLastInvocationExitCode ()
傳回上次運行的呼叫的錯誤代碼。如果尚未運行任何調用,則返回 0(無錯誤)。
退貨 | |
---|---|
CommandRunner.ExitCode |
取得最後一個呼叫Throwable
public abstract Throwable getLastInvocationThrowable ()
返回上次運行的呼叫中的Throwable
。如果沒有可用的 throwable,則傳回 null。
退貨 | |
---|---|
Throwable |
取得就緒命令計數
public abstract int getReadyCommandCount ()
傳回佇列中處於就緒狀態的命令數。
退貨 | |
---|---|
int |
切換啟動完成
public abstract void handoverInitiationComplete ()
通知命令調度器正在使用的設備和命令的初始切換交換已完成,並且可以開始調度操作。
切換關閉
public abstract boolean handoverShutdown (int handoverPort)
啟動shutdown()
並切換到同一主機上的另一個 tradefed 進程。
參數 | |
---|---|
handoverPort | int |
退貨 | |
---|---|
boolean | 如果切換啟動成功則為true ,否則為false |
加入
public abstract void join (long millis)
等待調度程序完成或在指定的持續時間(以毫秒為單位)後逾時。
參數 | |
---|---|
millis | long |
也可以看看:
刪除所有命令
public abstract void removeAllCommands ()
從排程器中刪除所有命令
設定ClearcutClient
public abstract void setClearcutClient (ClearcutClient client)
設定客戶端報告線束數據
參數 | |
---|---|
client | ClearcutClient |
應該ShutdownOnCmdfileError
public abstract boolean shouldShutdownOnCmdfileError ()
如果我們需要在命令錯誤時關閉調度程序,則傳回 true
退貨 | |
---|---|
boolean |
關閉
public abstract void shutdown ()
嘗試正常關閉命令調度程序。
清除等待測試的命令,並請求正常關閉所有正在進行的呼叫。在呼叫 shutdown 後,調度程式主循環將等待所有正在進行的呼叫完成,然後完全退出。硬關機
public abstract void shutdownHard (boolean killAdb)
嘗試強制關閉命令調度程序。
與shutdown()
類似,但也可以選擇終止 adb 連接,以嘗試「激發」正在進行的呼叫更快完成。
參數 | |
---|---|
killAdb | boolean |
硬關機
public abstract void shutdownHard ()
嘗試強制關閉命令調度程序。與 shutdownHard(true) 相同。
空時關閉
public abstract void shutdownOnEmpty ()
與shutdown()
類似,但會等待所有指令執行完畢後再退出。
停止調用
public abstract boolean stopInvocation (int invocationId, String cause)
透過指定其 id 來停止正在運行的呼叫。
參數 | |
---|---|
invocationId | int :調用的追蹤 ID。 |
cause | String :停止呼叫的原因。 |
退貨 | |
---|---|
boolean | 如果呼叫停止則為 true,否則為 false |
投擲 | |
---|---|
UnsupportedOperationException | 如果實現不支持這個 |
停止調用
public boolean stopInvocation (int invocationId)
透過指定其 id 來停止正在運行的呼叫。
參數 | |
---|---|
invocationId | int |
退貨 | |
---|---|
boolean | 如果呼叫停止則為 true,否則為 false |
投擲 | |
---|---|
UnsupportedOperationException | 如果實現不支持這個 |
停止調用
public abstract boolean stopInvocation (ITestInvocation invocation)
停止正在運行的呼叫。
參數 | |
---|---|
invocation | ITestInvocation |
退貨 | |
---|---|
boolean | 如果呼叫停止則為 true,否則為 false |
投擲 | |
---|---|
UnsupportedOperationException | 如果實現不支持這個 |
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2023-12-01 (世界標準時間)。