Interface MkStorage

All Known Implementing Classes:
MkStorage.InFile, MkStorage.Synced

@Immutable public interface MkStorage
Storage of GitHub data.
Since:
0.5
Suppressed Checkstyle violations:
MultipleStringLiteralsCheck (200 lines)
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    In file.
    static final class 
    Synchronized.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    apply(Iterable<org.xembly.Directive> dirs)
    Update XML with this directives.
    void
    Locks storage to the current thread.
    void
    Unlock storage.
    com.jcabi.xml.XML
    xml()
    Get full XML.
  • Method Details

    • xml

      com.jcabi.xml.XML xml() throws IOException
      Get full XML.
      Returns:
      XML
      Throws:
      IOException - If there is any I/O problem, or if the current storage is locked by another thread.
    • apply

      void apply(Iterable<org.xembly.Directive> dirs) throws IOException
      Update XML with this directives.
      Parameters:
      dirs - Directives
      Throws:
      IOException - If there is any I/O problem, or if the current storage is locked by another thread.
    • lock

      void lock()
      Locks storage to the current thread.

      If the lock is available, grant it to the calling thread and block all operations from other threads. If not available, wait for the holder of the lock to release it with unlock() before any other operations can be performed.

      Locking behavior is reentrant, which means a thread can invoke lock() multiple times, where a hold count is maintained.

    • unlock

      void unlock()
      Unlock storage.

      Locking behavior is reentrant, thus if the thread invoked lock() multiple times, the hold count is decremented. If the hold count reaches 0, the lock is released.

      If the current thread does not hold the lock, an IllegalMonitorStateException will be thrown.