Class TransientSolrCoreCache

  • Direct Known Subclasses:
    TransientSolrCoreCacheDefault

    @Deprecated(since="9.2")
    public abstract class TransientSolrCoreCache
    extends Object
    Deprecated.
    The base class for custom transient core maintenance. Any custom plugin that wants to take control of transient caches (i.e. any core defined with transient=true) should override this class.

    WARNING: There is quite a bit of higher-level locking done by the CoreContainer to avoid various race conditions etc. You should _only_ manipulate them within the method calls designed to change them. E.g. only add to the transient core descriptors in addTransientDescriptor etc.

    Trust the higher-level code (mainly SolrCores and CoreContainer) to call the appropriate operations when necessary and to coordinate shutting down cores, manipulating the internal structures and the like.

    The only real action you should _initiate_ is to close a core for whatever reason, and do that by calling notifyCoreCloseListener(coreToClose); The observer will call back to removeCore(name) at the appropriate time. There is no need to directly remove the core _at that time_ from the transientCores list, a call will come back to this class when CoreContainer is closing this core.

    CoreDescriptors are read-once. During "core discovery" all valid descriptors are enumerated and added to the appropriate list. Thereafter, they are NOT re-read from disk. In those situations where you want to re-define the coreDescriptor, maintain a "side list" of changed core descriptors. Then override getTransientDescriptor to return your new core descriptor. NOTE: assuming you've already closed the core, the _next_ time that core is required getTransientDescriptor will be called and if you return the new core descriptor your re-definition should be honored. You'll have to maintain this list for the duration of this Solr instance running. If you persist the coreDescriptor, then next time Solr starts up the new definition will be read.

    If you need to manipulate the return, for instance block a core from being loaded for some period of time, override say getTransientDescriptor and return null.

    In particular, DO NOT reach into the transientCores structure from a method called to manipulate core descriptors or vice-versa.

    • Constructor Detail

      • TransientSolrCoreCache

        public TransientSolrCoreCache()
        Deprecated.
    • Method Detail

      • addCore

        public abstract SolrCore addCore​(String name,
                                         SolrCore core)
        Deprecated.
        Adds the newly-opened core to the list of open cores.
      • getAllCoreNames

        public abstract Set<String> getAllCoreNames()
        Deprecated.
        Returns the names of all possible cores, whether they are currently loaded or not.
      • getLoadedCoreNames

        public abstract Set<String> getLoadedCoreNames()
        Deprecated.
        Returns the names of all currently loaded cores.
      • removeCore

        public abstract SolrCore removeCore​(String name)
        Deprecated.
        Removes a core from the internal structures, presumably it being closed. If the core is re-opened, it will be re-added by CoreContainer.
      • getCore

        public abstract SolrCore getCore​(String name)
        Deprecated.
        Gets the core associated with the name. Returns null if there is none.
      • containsCore

        public abstract boolean containsCore​(String name)
        Deprecated.
        Returns whether the cache contains the named core.
      • addTransientDescriptor

        public abstract void addTransientDescriptor​(String rawName,
                                                    CoreDescriptor cd)
        Deprecated.
        Adds a new CoreDescriptor. This method will only be called during core discovery at startup.
      • getTransientDescriptor

        public abstract CoreDescriptor getTransientDescriptor​(String name)
        Deprecated.
        Gets the CoreDescriptor for a transient core (loaded or unloaded). This method is used when opening cores and the like. If you want to change a core's descriptor, override this method and return the current core descriptor.
      • removeTransientDescriptor

        public abstract CoreDescriptor removeTransientDescriptor​(String name)
        Deprecated.
        Removes a CoreDescriptor from the list of transient cores descriptors.
      • close

        public void close()
        Deprecated.
        Called in order to free resources.
      • getStatus

        public abstract int getStatus​(String coreName)
        Deprecated.
        Gets a custom status for the given core name. Allows custom implementations to communicate arbitrary information as necessary.
      • setStatus

        public abstract void setStatus​(String coreName,
                                       int status)
        Deprecated.
        Sets a custom status for the given core name. Allows custom implementations to communicate arbitrary information as necessary.