Class DefaultISMLocking

  • All Implemented Interfaces:
    ISMLocking

    public class DefaultISMLocking
    extends Object
    implements ISMLocking
    Default item state locking strategy. The default strategy is simply to use a single coarse-grained read-write lock over the entire workspace.
    • Constructor Detail

      • DefaultISMLocking

        public DefaultISMLocking()
    • Method Detail

      • isWriterPreference

        public boolean isWriterPreference()
        Returns the writer preference status of this locking strategy.
        Returns:
        writer preference
      • setWriterPreference

        public void setWriterPreference​(boolean preference)
        Sets the writer preference status of this locking strategy.
        Parameters:
        preference - writer preference
      • acquireWriteLock

        public ISMLocking.WriteLock acquireWriteLock​(ChangeLog changeLog)
                                              throws InterruptedException
        Increments the writer count, sets the writer identifier and returns the acquired write lock once there are no other active readers or writers or the current writer shares the thread id with this writer.
        Specified by:
        acquireWriteLock in interface ISMLocking
        Parameters:
        changeLog - the change log
        Returns:
        the write lock for the given changeLog.
        Throws:
        InterruptedException - if the thread is interrupted while creating the write lock.