You need to sign in to do that
Don't have an account?

error working with @future: batchable class has jobs pending or in progress
I'm just starting with the @future tag and added a future call to a Contact after insert trigger I've got. I added a call to a method which I plan to have geocode the Contact based on address, via a call out to google's geocoding service.
My method is very simple right now:
My code compiles and runs in the UI, but the future action (Country updated to 'Zanzibar') hasn't happened after an hour. When I try to modify the class that contains the future method, I get this error in the IDE:
Batchable class has jobs pending or in progress
dataAugmentation.cls
Winter 09 Preview/src/unpackaged/classes
line 1
Force.com save problem
I couldn't find any documentation about how future calls get batched and run, but if I had to interpret this error message I would guess that my updates are sitting in a queue waiting to run, and while that is happening, I can't modify the class.
Is that what is going on? Are there ways to monitor what future calls are waiting for execution?
Thanks,
Steve
My method is very simple right now:
Code:
public class dataAugmentation { @future public static void augmentAddresses(List<id> contactIdsToAugment) { List<Contact> ContactsToBeUpdated = new List<Contact>(); for (Contact thisContact : [Select Id, OtherStreet,OtherCity,OtherState,OtherPostalCode,OtherCountry from Contact where Id IN :contactIdsToAugment]) { thisContact.OtherCountry='Zanzibar'; ContactsToBeUpdated.add(thisContact); //callout to web service //thisContactToAugment.Country='Zanzibar'; } update ContactsToBeUpdated; } }
My code compiles and runs in the UI, but the future action (Country updated to 'Zanzibar') hasn't happened after an hour. When I try to modify the class that contains the future method, I get this error in the IDE:
Batchable class has jobs pending or in progress
dataAugmentation.cls
Winter 09 Preview/src/unpackaged/classes
line 1
Force.com save problem
I couldn't find any documentation about how future calls get batched and run, but if I had to interpret this error message I would guess that my updates are sitting in a queue waiting to run, and while that is happening, I can't modify the class.
Is that what is going on? Are there ways to monitor what future calls are waiting for execution?
Thanks,
Steve
The explanation for the error message ("Batchable class has jobs pending or in progress") is
Batch apex classes cannot be changed while there are still batches in the apex queue. You can view this queue under Setup | Administration Setup | Monitoring | Apex Jobs
While you have jobs being processed you cannot change the apex class that is handling the active (or pending) processes. You can abort these processes if you need to stop execution of batch jobs.
If you dont' have any pending/processing jobs and see this error, then someone in salesforce support would need to investigate.
All Answers
there's another wrinkle, the prerelease environment has a more restricted outbound configuration, so your callout might not work.
let me know...
I'll try to add some callouts and let you know if I get anywhere.
Thanks for looking into it,
Steve
The explanation for the error message ("Batchable class has jobs pending or in progress") is
Batch apex classes cannot be changed while there are still batches in the apex queue. You can view this queue under Setup | Administration Setup | Monitoring | Apex Jobs
While you have jobs being processed you cannot change the apex class that is handling the active (or pending) processes. You can abort these processes if you need to stop execution of batch jobs.
If you dont' have any pending/processing jobs and see this error, then someone in salesforce support would need to investigate.