Hi,
I would like to ask if it is safe to call:
pageManager.getPages(…)
Can it cause memory problems if for example space has too many pages, or pages are to big.
Thanks for answers!
Hi dsdandzi,
Depending on the use case -
In case of all pages;
If you want to cover all the pages in a space, its better you streamline the process and then execute concurrently for x pages at a time(Example 5). Always avoid putting too much items in memory.
Other cases:
I would advise strongly against loading everything into memory.
Hi Saurabh,
Thanks for answer!
Yes, the case would be all current pages in space. I am not sure how would I streamline the process, can you elaborate on your solution a bit more please?
BTW, so you think it is better to not use the call pageManager.getPages(…)? Because for example here the accepted answer advises to use such call for retrieving all pages of given space.
Thanks for answers!
Sorry for replying late.
What I meant by streamlining is
- Get the array of all page names/id for a space.
- Then take subset of 10 ids and then use the same method get content of the pages.
- When you get the content perform operation concurrently(preferred) and save.
- Then override accessor object so it can be picked up by garbage collector.
If you are still worried about the memory consumption, you can use JVM monitoring tools available. I forgot the name but there is very cool tool to monitor JVM parameters of a running instance. If you need ping me I’ll find and provide you the name.
(I am no expert - this is what I would do on my first try, probably will change logic when facing challenges or business conditions)
Thanks Saurabh for you response!
I checked your solution and I think it would do some unnecessary iterations because pageManager.getPageIds(…) will get you both current ids and historical ids of pages, so I would also get older versions of same page which I dont need.
I did some additional research and it looks like that pageManager.getPages(…) is used in some answers (besides the one I already mentioned) for example here or here.
So I guess it is ok to use it.
Hi [dsdandzi],
I want to get pages or pageids from a particular space,I am using pageManage.getPages(space,true) and getPageIds(space) but any how ,I am not able to get pages or pageids.Can you please help.Syntax I am using is,
Collection pageIds = pageManager.getPageIds(space);
List (list of Page type) pages = pageManager.getPages(space, true);
Finally I want page ids from a particular space
Hi @saurabh.gupta,
I want to get pages or pageids from a particular space,I am using pageManage.getPages(space,true) and getPageIds(space) but any how ,I am not able to get pages or pageids.Can you please help.Syntax I am using is,
Collection pageIds = pageManager.getPageIds(space);
List (list of Page type) pages = pageManager.getPages(space, true);
Finally I want page ids from a particular space