Class BatchingFetcher

    • Field Detail

      • source

        protected Source source
      • batchQueried

        protected int batchQueried
      • cacheMisses

        protected int cacheMisses
      • timeSpentExecute

        protected long timeSpentExecute
      • timeSpentPrefetchEquiv

        protected long timeSpentPrefetchEquiv
      • timeSpentPrefetchTracker

        protected long timeSpentPrefetchTracker
    • Constructor Detail

      • BatchingFetcher

        public BatchingFetcher​(BaseEquivalentObjectFetcher fetcher,
                               DataTracker dataTracker,
                               Source source)
        Constructor
        Parameters:
        fetcher - another EquivalentObjectFetcher
        dataTracker - a DataTracker object to pass prefetch instructions to
        source - the data Source that is being loaded
    • Method Detail

      • getNoseyObjectStore

        public ObjectStore getNoseyObjectStore​(ObjectStore os)
        Returns an ObjectStore layered on top of the given ObjectStore, which reports to this fetcher which objects are being loaded.
        Parameters:
        os - an ObjectStore
        Returns:
        an ObjectStore
      • close

        public void close​(Source source)
        Close method - prints out summary data.
        Overrides:
        close in class HintingFetcher
        Parameters:
        source - the Source used
      • getEquivalentsFor

        protected void getEquivalentsFor​(java.util.List<ResultsRow<java.lang.Object>> batch)
                                  throws ObjectStoreException
        Fetches the equivalent object information for a whole batch of objects.
        Parameters:
        batch - the objects
        Throws:
        ObjectStoreException - if something goes wrong
      • getEquivalentsForObjects

        protected void getEquivalentsForObjects​(java.util.List<FastPathObject> fpos)
                                         throws ObjectStoreException
        Fetches the equivalent object information for a whole batch of objects.
        Parameters:
        fpos - the objects to fetch equivalents for
        Throws:
        ObjectStoreException - if something goes wrong
      • canDoPkNow

        protected boolean canDoPkNow​(PrimaryKey pk,
                                     ClassDescriptor cld,
                                     java.util.Map<PrimaryKey,​ClassDescriptor> pksNotDone)
        Returns whether this primary key can be fetched now.
        Parameters:
        pk - the PrimaryKey
        cld - the ClassDescriptor that the PrimaryKey is in
        pksNotDone - a Map of pks not yet fetched
        Returns:
        a boolean
      • doPk

        protected void doPk​(PrimaryKey pk,
                            ClassDescriptor cld,
                            java.util.Map<InterMineObject,​java.util.Set<InterMineObject>> results,
                            java.util.List<InterMineObject> objectsForCld,
                            java.util.Set<java.lang.Integer> fetchedObjectIds)
                     throws ObjectStoreException
        Fetches equivalent objects for a particular primary key.
        Parameters:
        pk - the PrimaryKey
        cld - the ClassDescriptor of the PrimaryKey
        results - a Map to hold results that are to be added to the cache
        objectsForCld - a List of objects relevant to this PrimaryKey
        fetchedObjectIds - a Set to hold ids of objects that are fetched, to prefetch from the data tracker later
        Throws:
        ObjectStoreException - if something goes wrong