I have declared a map as a instance variable like this:
public class JSONParser_GET {
public static Map<String, String> mapOfValues= new Map<String,String>();
...
Now, I have a future method where I am adding the values to this map:
@future(callout=true)
public static void getRequest(String type,String e,String authHeader){
mapOfValues.put(type,lookupname);
...
But the values are not available when I try to access it in different method. Isn't that is what static is supposed to do? As I am declaring it as static instance variable it should be globally available. I tried to use global keyword as well. But that also doesn't seems to work. Any help is appreciated
So, here is what I did.. It seems future methods may execute in parallel due to which it is not possible to get the values from the response in one Map itself. So I wrote a method before the getRequest and made it as future so that I can make only one instance of future handler.
@future(callout==true)
public class JSONParser_GET {
public static Map<String, String> mapOfValues= new Map<String,String>();
getRequest()
getRequest()
getRequest()
}
public void getRequest{...}