robotoworks / mechanoid

Eclipse plugin providing a set of DSL's for the rapid development of Android apps
58 stars 26 forks source link

pending Operation #247

Closed hannesa2 closed 10 years ago

hannesa2 commented 10 years ago

I'm looking for the pending operation queue, to handle in my app execution of some actions. As I understand in OperationServiceBridge.java this holds the queue

private final static SparseArray<Intent> mPendingRequests = new SparseArray<Intent>();

Am I right ? Is there a more elegant way to require the queue list instead of this new method ?

public static SparseArray<Intent> getPendingRequests() {
    return mPendingRequests;
}

and in Ops.java

public static SparseArray<Intent> getPendingRequests() {
    return OperationServiceBridge.getPendingRequests();
}
fluxtah commented 10 years ago

Yes that is the pending op queue in OperationServiceBridge, what kind of thing do you need to do with it?

hannesa2 commented 10 years ago

I want to know, if I can skip the clustering of my map on multiple pending (web)operations. Just the last should render my map with >10000 markers

fluxtah commented 10 years ago

Its possible to abort operations, but you need to make sure that you handle abortion in the operation itself, this would make them complete quicker.

Ops.abort(123, "reason for aborting");

in your op you can handle it like this, to return early from any long running code.

        if(context.isAborted()) {
            return OperationResult.ok();
        }