Skip to content

Commit 6944d25

Browse files
committed
only wait task can deploy
1 parent e093573 commit 6944d25

File tree

1 file changed

+8
-4
lines changed
  • AndroidExecLibrary/src/main/java/com/excellence/exec

1 file changed

+8
-4
lines changed

AndroidExecLibrary/src/main/java/com/excellence/exec/Command.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ public void onSuccess(String message) {
136136

137137
void deploy() {
138138
try {
139+
// only wait task can deploy
140+
if (mStatus != STATUS_WAITING) {
141+
return;
142+
}
139143
mStatus = STATUS_RUNNING;
140144
Observable.create(new ObservableOnSubscribe<String>() {
141145
@Override
@@ -170,6 +174,10 @@ public void subscribe(ObservableEmitter<String> emitter) throws Exception {
170174
}
171175
}
172176

177+
private boolean isRunning() {
178+
return mStatus == STATUS_RUNNING;
179+
}
180+
173181
private void cancel() {
174182
mStatus = STATUS_INTERRUPT;
175183
if (mProcess != null) {
@@ -178,10 +186,6 @@ private void cancel() {
178186
mTaskQueue.remove(this);
179187
}
180188

181-
private boolean isRunning() {
182-
return mStatus == STATUS_RUNNING;
183-
}
184-
185189
public void discard() {
186190
mStatus = STATUS_INTERRUPT;
187191
if (mProcess != null) {

0 commit comments

Comments
 (0)