You need to sign in to do that
Don't have an account?
Using @future
Hi all,
I currently have a method which simply calls an @future method 10 times. The method that it calls updates the database and stops. The problem is that the first methods dataset doesn't appear to get updated when the @future method fails. I have tried adding a wait to the code by using:
while (iCount < 10) {
runFuture();
Double dMilliUntil = System.Now().millisecond() + 100;
while (System.Now().millisecond() <= dMilliUntil ) { } //Wait for 1 second
iCount++;
}
which waits for 1 second (which should be long enough for the future method to complete). Does anyone know why this doesn't update the original dataset?
Thanks
James
@future methods are async methods. The method that calls the @future method is actually making a non-blocking call and will not have any idea if the @future method has failed or not.
If you can elobrate on what you are trying to do, we can think of an alternate approach.
Thanks for your response, I am happy that the @future call will be async and that is why I was using the wait inorder to ensure the @future had finished (the method doesn't need to know that it had finished). What I am trying to do is have a method that will make call the same method a number of times which will then select from the data set. As the select that it does may bring back more than 10,000 records, it would be good that I used an @future method to circumvent the Salesforce limitation of only 10,000 records per call. The other idea that I had for this was to select a certain set of the results, so you would get between 0 and 10,000 in the first select and between 10,000 and 20,000 in the second set. I hope it makes sense what I am trying to do.
James