在我的代码中,我正在创建一个像这样的Observable -
0xF2 mov byte ptr [ecx],0x0
然后订阅它 -
public int removeFrom(int value,int pos) {
boolean exists = false;
if(0 < pos && pos <= this.size){
Node current = start.next;
Node previous = start;
Node deleted =null;
for(; current!=null; current=current.next) {
if(current.value == value) {
deleted = current;
previous.next = current.next;
current = previous;
size--;
exists = true;
return deleted.value;
} else {
previous = previous.next;
}
}
if(!exists)
System.out.println("the value not exist");
}
else
System.out.println("not valid position");
return -1;
}
我的问题是在我使用Observable observable = Observable.fromCallable(new Callable<String>() {
@Override
public String call() throws Exception {
return longlongTask();
}
})
处理我的订阅者后,Observable的长时间运行任务一直在运行,直到它最终完成。我想知道,一旦没有订阅者收听我的Observable,我是否有办法停止这个longlongTask。任何你用来解决这个问题的方法/标准做法将不胜感激。