CommandScheduler
public
class
CommandScheduler
extends Object
implements
ICommandScheduler
java.lang.Object의 클래스 | |
↳ | com.android.tradefed.command.CommandScheduler |
사용 가능한 모든 기기에서 TradeFederation 명령어를 실행하기 위한 스케줄러입니다.
총 실행 횟수를 기반으로 실행할 명령어의 우선순위를 지정하려고 시도합니다. 있습니다. 예: 자주 실행되지 않거나 빠르게 실행되는 명령어가 장기 실행 명령어보다 우선합니다.
종료될 때까지 백그라운드에서 계속 실행됩니다.
요약
중첩된 클래스 | |
---|---|
enum |
CommandScheduler.HostState
호스트의 다양한 상태 열거형 |
공개 생성자 | |
---|---|
CommandScheduler()
|
공개 메서드 | |
---|---|
boolean
|
addCommand(String[] args)
스케줄러에 명령어를 추가합니다. |
void
|
addCommandFile(String cmdFilePath,
지정된 파일의 모든 명령어를 스케줄러에 추가합니다. |
void
|
await()
이전 TF에서 핸드오버가 완료되기를 기다리는 것을 포함하여 스케줄러 실행이 시작되기를 기다립니다. 추가할 수 있습니다. |
static
TradefedDelegator
|
checkDelegation(String[] args)
명령줄을 기반으로 위임자를 만들어 실행을 위임해야 하는지 확인합니다. |
void
|
completeHandover()
시작된 핸드오버 시퀀스가 완전히 완료되었음을 명령어 스케줄러에 알립니다. 기본 포트에서 원격 관리자를 다시 초기화해야 합니다. |
static
|
createReleaseMap(IInvocationContext context, Throwable e)
기기가 적절히 해제될 수 있도록 기기 상태의 맵을 생성합니다. |
ISandbox
|
createSandbox()
호출을 실행하는 데 사용할 |
void
|
displayCommandQueue(PrintWriter printWriter)
명령어 실행 큐의 상태에 대한 자세한 디버그 정보를 출력합니다. |
void
|
displayCommandsInfo(PrintWriter printWriter, String regex)
현재 명령어 목록을 출력합니다. |
void
|
displayInvocationsInfo(PrintWriter printWriter)
현재 호출 목록을 표시합니다. |
void
|
dumpCommandsXml(PrintWriter printWriter, String regex)
다음을 모두 포함하여 명령어의 확장된 xml 파일을 덤프합니다.
모든 현재 명령어에 |
void
|
execCommand(ICommandScheduler.IScheduledInvocationListener listener, ITestDevice device, String[] args)
이미 할당된 기기에서 명령어를 직접 실행합니다. |
void
|
execCommand(IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener, String[] args)
기기를 직접 할당하고 명령어 큐에 추가하지 않고 명령어를 실행합니다.
기존 |
void
|
execCommand(ICommandScheduler.IScheduledInvocationListener listener, String[] args)
기기를 직접 할당하고 명령어 큐에 추가하지 않고 명령어를 실행합니다. |
CommandFileWatcher
|
getCommandFileWatcher()
이 스케줄러에 적절한 |
int
|
getExecutingCommandCount()
실행 상태의 명령어 수를 반환합니다. |
CommandScheduler.HostState
|
getHostState()
|
String
|
getInvocationInfo(int invocationId)
호출 ID를 지정하는 호출 bu의 정보를 반환합니다. |
CommandRunner.ExitCode
|
getLastInvocationExitCode()
마지막으로 실행된 호출의 오류 코드를 반환합니다. |
Throwable
|
getLastInvocationThrowable()
실행된 마지막 호출에서 |
int
|
getReadyCommandCount()
큐에서 준비 상태인 명령어 수를 반환합니다. |
long
|
getShutdownTimeout()
|
void
|
handoverInitiationComplete()
사용 중인 장치 및 명령어의 초기 핸드오버 교환을 명령 스케줄러에 알립니다. 작업이 완료되어 작업 예약을 시작할 수 있습니다. |
boolean
|
handoverShutdown(int handoverPort)
|
void
|
notifyFileChanged(File cmdFile,
|
void
|
removeAllCommands()
스케줄러에서 모든 명령어 삭제 |
void
|
run()
이 스레드의 기본 실행 블록입니다. |
void
|
setClearcutClient(ClearcutClient client)
하네스 데이터를 보고하도록 클라이언트 설정 |
boolean
|
shouldShutdownOnCmdfileError()
명령어 오류 발생 시 스케줄러를 종료해야 하는 경우 true를 반환합니다. |
void
|
shutdown()
명령 스케줄러를 단계적으로 종료해 봅니다. |
void
|
shutdownHard(boolean killAdb)
명령어 스케줄러를 강제 종료해 봅니다. |
void
|
shutdownHard()
명령어 스케줄러를 강제 종료해 봅니다. |
void
|
shutdownOnEmpty()
|
void
|
start()
로깅 설정, |
boolean
|
stopInvocation(ITestInvocation invocation)
실행 중인 호출을 중지합니다. |
boolean
|
stopInvocation(int invocationId, String cause)
ID를 지정하여 실행 중인 호출을 중지합니다. |
보호된 메서드 | |
---|---|
void
|
cleanUp()
로그를 닫고 종료하기 전에 다른 필요한 정리를 수행합니다. |
IConfiguration
|
createConfiguration(String[] args)
|
IInvocationContext
|
createInvocationContext()
|
IConfigurationFactory
|
getConfigFactory()
|
IDeviceManager
|
getDeviceManager()
|
TradefedFeatureServer
|
getFeatureServer()
|
IHostOptions
|
getHostOptions()
|
IKeyStoreClient
|
getKeyStoreClient()
|
void
|
initLogging()
ddmlib 로그를 초기화합니다. |
boolean
|
isShutdown()
|
boolean
|
isShuttingDown()
|
void
|
processReadyCommands(IDeviceManager manager)
|
void
|
waitForAllInvocationThreads()
모든 호출 스레드가 완료될 때까지 기다립니다. |
공개 생성자
공개 메서드
addCommand
public boolean addCommand (String[] args)
스케줄러에 명령어를 추가합니다.
명령어는 기본적으로 실행할 구성 인스턴스 및 연결된 인수입니다.
'--help'인 경우 인수는 에 대한 도움말 텍스트가 구성은 stdout에 출력됩니다. 그렇지 않으면 구성이 다음 명령어로 큐에 추가됩니다. 실행할 수 있습니다
매개변수 | |
---|---|
args |
String : 구성 인수입니다. |
반환 값 | |
---|---|
boolean |
명령어가 성공적으로 추가된 경우 true |
생성 값 | |
---|---|
ConfigurationException |
addCommandFile 클래스의 정적 변수
public void addCommandFile (String cmdFilePath,extraArgs)
지정된 파일의 모든 명령어를 스케줄러에 추가합니다.
매개변수 | |
---|---|
cmdFilePath |
String : 명령어 파일의 파일 시스템 경로 |
extraArgs |
: 파싱된 각 명령어에 추가할 String 인수의 ERROR(/List)
있습니다. 비워둘 수 있지만 null이 아니어야 합니다. |
생성 값 | |
---|---|
ConfigurationException |
기다리다
public void await ()
이전 TF에서 핸드오버가 완료되기를 기다리는 것을 포함하여 스케줄러 실행이 시작되기를 기다립니다. 추가할 수 있습니다.
checkDelegation
public static TradefedDelegator checkDelegation (String[] args)
명령줄을 기반으로 위임자를 만들어 실행을 위임해야 하는지 확인합니다.
매개변수 | |
---|---|
args |
String |
반환 값 | |
---|---|
TradefedDelegator |
생성 값 | |
---|---|
ConfigurationException |
핸드오버 완료
public void completeHandover ()
시작된 핸드오버 시퀀스가 완전히 완료되었음을 명령어 스케줄러에 알립니다. 기본 포트에서 원격 관리자를 다시 초기화해야 합니다.
createReleaseMap
public staticcreateReleaseMap (IInvocationContext context, Throwable e)
기기가 적절히 해제될 수 있도록 기기 상태의 맵을 생성합니다.
매개변수 | |
---|---|
context |
IInvocationContext |
e |
Throwable |
반환 값 | |
---|---|
|
displayCommandQueue
public void displayCommandQueue (PrintWriter printWriter)
명령어 실행 큐의 상태에 대한 자세한 디버그 정보를 출력합니다.
displayCommandsInfo
public void displayCommandsInfo (PrintWriter printWriter, String regex)
현재 명령어 목록을 출력합니다.
매개변수 | |
---|---|
printWriter |
PrintWriter : 출력할 ERROR(/PrintWriter) 입니다. |
regex |
String : 일치되기 위해 명령어가 일치해야 하는 정규 표현식
출력됩니다. null인 경우 모든 명령어가 출력됩니다.
|
displayInvocationsInfo
public void displayInvocationsInfo (PrintWriter printWriter)
현재 호출 목록을 표시합니다.
매개변수 | |
---|---|
printWriter |
PrintWriter : 출력할 ERROR(/PrintWriter) 입니다.
|
dumpCommandsXml
public void dumpCommandsXml (PrintWriter printWriter, String regex)
다음을 모두 포함하여 명령어의 확장된 xml 파일을 덤프합니다.
모든 현재 명령어에 Option
값이 지정되었습니다.
매개변수 | |
---|---|
printWriter |
PrintWriter : 상태를 출력할 ERROR(/PrintWriter) 입니다. |
regex |
String :
xml 파일이 포함됩니다. null이면 모든 명령어가 덤프됩니다.
|
execCommand
public void execCommand (ICommandScheduler.IScheduledInvocationListener listener, ITestDevice device, String[] args)
이미 할당된 기기에서 명령어를 직접 실행합니다.
매개변수 | |
---|---|
listener |
ICommandScheduler.IScheduledInvocationListener : 알림을 받을 ICommandScheduler.IScheduledInvocationListener |
device |
ITestDevice : 사용할 ITestDevice |
args |
String : 명령어 인수 |
생성 값 | |
---|---|
ConfigurationException |
execCommand
public void execCommand (IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener, String[] args)
기기를 직접 할당하고 명령어 큐에 추가하지 않고 명령어를 실행합니다.
기존 IInvocationContext
사용
매개변수 | |
---|---|
context |
IInvocationContext : 기존 IInvocationContext 입니다. |
listener |
ICommandScheduler.IScheduledInvocationListener : 알림을 받을 ICommandScheduler.IScheduledInvocationListener |
args |
String : 명령어 인수 |
생성 값 | |
---|---|
ConfigurationException |
|
NoDeviceException |
execCommand
public void execCommand (ICommandScheduler.IScheduledInvocationListener listener, String[] args)
기기를 직접 할당하고 명령어 큐에 추가하지 않고 명령어를 실행합니다.
매개변수 | |
---|---|
listener |
ICommandScheduler.IScheduledInvocationListener : 알림을 받을 ICommandScheduler.IScheduledInvocationListener |
args |
String : 명령어 인수 |
생성 값 | |
---|---|
ConfigurationException |
|
NoDeviceException |
getCommandFileWatcher
public CommandFileWatcher getCommandFileWatcher ()
이 스케줄러에 적절한 CommandFileWatcher
가져오기
반환 값 | |
---|---|
CommandFileWatcher |
getExecutingCommandCount
public int getExecutingCommandCount ()
실행 상태의 명령어 수를 반환합니다.
반환 값 | |
---|---|
int |
getInvocationInfo
public String getInvocationInfo (int invocationId)
호출 ID를 지정하는 호출 bu의 정보를 반환합니다.
매개변수 | |
---|---|
invocationId |
int : 호출의 추적 ID입니다. |
반환 값 | |
---|---|
String |
호출에 관한 정보가 포함된 String 입니다.
|
getLastInvocationExitCode
public CommandRunner.ExitCode getLastInvocationExitCode ()
마지막으로 실행된 호출의 오류 코드를 반환합니다. 아직 실행된 호출이 없으면 0 (오류 없음)을 반환합니다.
반환 값 | |
---|---|
CommandRunner.ExitCode |
getLastInvocationThrowable
public Throwable getLastInvocationThrowable ()
실행된 마지막 호출에서 Throwable
를 반환합니다.
사용할 수 있는 throwable이 없으면 null을 반환합니다.
반환 값 | |
---|---|
Throwable |
getReadyCommandCount
public int getReadyCommandCount ()
큐에서 준비 상태인 명령어 수를 반환합니다.
반환 값 | |
---|---|
int |
getShutdownTimeout
public long getShutdownTimeout ()
반환 값 | |
---|---|
long |
핸드오버 시작 완료
public void handoverInitiationComplete ()
사용 중인 장치 및 명령어의 초기 핸드오버 교환을 명령 스케줄러에 알립니다. 작업이 완료되어 작업 예약을 시작할 수 있습니다.
핸드오버 종료
public boolean handoverShutdown (int handoverPort)
shutdown()
를 시작하고 동일한 호스트의 다른 tradefed 프로세스로 핸드오버합니다.
스케줄러는 해제된 기기의 포트에서 수신 대기하는 원격 tradefed 프로세스에 알립니다. 확인할 수 있습니다
매개변수 | |
---|---|
handoverPort |
int |
반환 값 | |
---|---|
boolean |
핸드오버 시작에 성공한 경우 true , false
그렇지 않은 경우
|
notificationsFileChanged
public void notifyFileChanged (File cmdFile,extraArgs)
매개변수 | |
---|---|
cmdFile |
File |
extraArgs |
|
removeAllCommands
public void removeAllCommands ()
스케줄러에서 모든 명령어 삭제
실행
public void run ()
이 스레드의 기본 실행 블록입니다.
setClearcutClient
public void setClearcutClient (ClearcutClient client)
하네스 데이터를 보고하도록 클라이언트 설정
매개변수 | |
---|---|
client |
ClearcutClient |
shouldShutdownOnCmdfileError
public boolean shouldShutdownOnCmdfileError ()
명령어 오류 발생 시 스케줄러를 종료해야 하는 경우 true를 반환합니다.
반환 값 | |
---|---|
boolean |
종료
public void shutdown ()
명령 스케줄러를 단계적으로 종료해 봅니다.
테스트 대기 중인 명령어를 지우고 진행 중인 모든 호출을 요청합니다. 종료할 수 있습니다.
종료가 호출되면 스케줄러 메인 루프는 진행 중인 모든 호출을 기다립니다. 완료해야 합니다.
종료하드
public void shutdownHard (boolean killAdb)
명령어 스케줄러를 강제 종료해 봅니다.
shutdown()
와 유사하지만 다음에서 adb 연결을 선택적으로 종료합니다.
'영감'을 주려는 시도 더 빨리 완료할 수 있습니다.
매개변수 | |
---|---|
killAdb |
boolean |
종료하드
public void shutdownHard ()
명령어 스케줄러를 강제 종료해 봅니다. ShutHard(true)와 동일합니다.
셧다운 시
public void shutdownOnEmpty ()
shutdown()
와 유사하지만 모든 명령어가 실행될 때까지 기다립니다.
를 클릭하세요.
명령이 루프 모드에 있으면 스케줄러는 절대 종료되지 않습니다.
호출 중지
public boolean stopInvocation (ITestInvocation invocation)
실행 중인 호출을 중지합니다.
매개변수 | |
---|---|
invocation |
ITestInvocation |
반환 값 | |
---|---|
boolean |
호출이 중지된 경우 true, 그렇지 않은 경우 false |
호출 중지
public boolean stopInvocation (int invocationId, String cause)
ID를 지정하여 실행 중인 호출을 중지합니다.
매개변수 | |
---|---|
invocationId |
int : 호출의 추적 ID입니다. |
cause |
String : 호출을 중지하는 원인입니다. |
반환 값 | |
---|---|
boolean |
호출이 중지된 경우 true, 그렇지 않은 경우 false |
보호된 메서드
정리
protected void cleanUp ()
로그를 닫고 종료하기 전에 다른 필요한 정리를 수행합니다.
단위 테스트를 모의 처리할 수 있도록 노출됩니다.
createConfiguration
protected IConfiguration createConfiguration (String[] args)
매개변수 | |
---|---|
args |
String |
반환 값 | |
---|---|
IConfiguration |
생성 값 | |
---|---|
ConfigurationException |
createInvocationContext
protected IInvocationContext createInvocationContext ()
반환 값 | |
---|---|
IInvocationContext |
getConfigFactory
protected IConfigurationFactory getConfigFactory ()
IConfigurationFactory
참조를 가져오는 팩토리 메서드
반환 값 | |
---|---|
IConfigurationFactory |
사용할 IConfigurationFactory
|
getDeviceManager
protected IDeviceManager getDeviceManager ()
IDeviceManager
참조를 가져오는 팩토리 메서드
반환 값 | |
---|---|
IDeviceManager |
사용할 IDeviceManager
|
getHostOptions
protected IHostOptions getHostOptions ()
반환 값 | |
---|---|
IHostOptions |
getKeyStoreClient
protected IKeyStoreClient getKeyStoreClient ()
IKeyStoreFactory
를 사용하여 IKeyStoreClient
를 가져옵니다.
IGlobalConfiguration
로 선언되거나 정의되지 않은 경우 null로 선언됩니다.
반환 값 | |
---|---|
IKeyStoreClient |
IKeyStoreClient |
초기화 로깅
protected void initLogging ()
ddmlib 로그를 초기화합니다.
단위 테스트를 모의 처리할 수 있도록 노출됩니다.
isShutdown
protected boolean isShutdown ()
반환 값 | |
---|---|
boolean |
종료
protected boolean isShuttingDown ()
반환 값 | |
---|---|
boolean |
processReadyCommands
protected void processReadyCommands (IDeviceManager manager)
매개변수 | |
---|---|
manager |
IDeviceManager |
waitForAllInvocationThreads가
protected void waitForAllInvocationThreads ()
모든 호출 스레드가 완료될 때까지 기다립니다.