Caching source/target items of a ChangeCollection in bulk

Hi,

I was working with a ChangePackage object, where I grabbed the collection of changes with:

ChangeCollection cc = cp.getChanges();

I then wanted to iterate through this collection looking at each change:

for (loop with idx)
{
  Change ch = cc.get(idx);
  ch.getSourceItem();
  // do stuff with source item
  ch.getTargetItem();
  // do stuff with target item
}

I'm noticing via netmonitor that each call to ch.getSourceItem() and ch.getTargetItem() is triggering lots of network comms...

The first call to ch.getSourceItem() triggers the following:

Start: (rev 100) PROJ_CMD_REFRESH_ITEMS Time: 47 millis; Sent: 274 bytes; Got: 1046 bytes
Start: (rev 100) PROJ_CMD_GET_ITEM_HISTORY Time: 103 millis; Sent: 58 bytes; Got: 1103 bytes

But each call to ch.getTargetItem() triggers the following:

Start: (rev 100) PROJ_CMD_GET_FOLDER_ITEMS Time: 212 millis; Sent: 1370 bytes; Got: 12776 bytes
File.get("ModifiedTime") triggers a fetch from the server.>>
Start: (rev 100) PROJ_CMD_REFRESH_ITEMS Time: 43 millis; Sent: 274 bytes; Got: 949 bytes

So if a changepackage contains lots of files, this will equate to quite a bit of network comms.

Is there any way I can pool these source/target items together and populate their properties in one hit, to minimise traffic?

I had a look around the docs, StarTeam 2009 had something called ItemList, do I need something like that?

http://techpubs.borland.com/starteam/2009/en/sdk_documentation/api/com/starbase/starteam/ItemList.html

Gurce

  • >>had something called ItemList, do I need something like that?

    yes & no, something similar -

    an ItemList from the old 9.0 days is equivalent to ViewMemberCollection from 12.0 onwards.

    A CacheService is used to to perform bulk operations on artifact instances.

    CacheService is an interface defined in com.starteam

    /**

    * The CacheService is implemented by StarTeam objects that support caching data

    * locally The data will typically have been fetched from the server, and will

    * probably aggregate across multiple contained object instances.

    *

    * Important Note: This interface is not intended to be implemented by client

    * applications. We reserve the right to add methods in the future. Applications

    * that implement this interface may not be compatible with future versions of

    * the StarTeam SDK.

    */

    public interface CacheService {

    ChangeCollection cc = cp.getChanges();

    cc.getCache().populate(); // or refresh with MPX

    should significantly reduce your netmon traffic.

    you could also populate the changes Cache of all ChangePackages in the view in bulk, but you'd want to be running 64 bits in that case, with a lot of available memory

    please see ChangePackageCollection.getChangeCache()

    /**

    * Gets a CacheService that can be used to manipulate change objects for

    * multiple change packages in bulk.

    *

    * @return CacheService

    */

    public CacheService ChangePackageCollection::getChangeCache() {

    and you could populate the changepackages themselves in bulk using

    /**

    * Gets a cache service that can be used to populate, refresh or discard all

    * of the view members in this collection, in bulk.

    *

    * @return CacheService a cache service that can be used to populate,

    *         refresh or discard members

    */

    public CacheService ChangePackageCollection::getCache() {

    as you've probably guessed, this applies to all view member collections in general.