mardi 4 avril 2017

How can I capture request data in a static list

I am having a URL for e.g:

http://ift.tt/2oUjZ3R.

I will be having multiple request of the sort:

http://ift.tt/2oUjZ3R
http://ift.tt/2oxtPfu
http://ift.tt/2oUcyKe
http://ift.tt/2oxnP6A

I want to make a static list of data received from requests

List<String> data;

List will contain data1,data2,data3,data4. List will be cleared after particular interval and new list will be used for subsequent requests. What is the best option to achieve this:

1. static List<String> a = new CopyOnWriteArrayList<String>();
2. Singleton wrapper class to perform operation on normal java.util.List
3. using synchronized block

Aucun commentaire:

Enregistrer un commentaire