Interface PerNodeLocalQueue

    • Field Detail

      • NUMBER_OF_PHYSICAL_QUEUES_PER_NODE

        static final int NUMBER_OF_PHYSICAL_QUEUES_PER_NODE
    • Method Detail

      • close

        void close()
        closes the queue and all resources connected with this queue (like processing thread(s), files); closing a queue is definitive - it will never be open (i.e. not-closed) again;
      • isClosed

        boolean isClosed()
        Some operations (like add(CrossNodesEvent)) on a closed queue will throw a IllegalStateException. This method allows to check if the queue has not been closed.
        Returns:
        true if queue is closed
      • name

        @NotNull
        @NotNull String name()
        Returns:
        name of the queue could be useful for the user, like identifying the queue file path from logs
      • getQueueFilePath

        @NotNull
        @NotNull Optional<Path> getQueueFilePath()
        Returns:
        the queue file path if exists, empty otherwise
      • hasPermission

        boolean hasPermission()
        Returns:
        true if it has read/write access to queue storage
      • usableSpaceInBytes

        @Nullable
        Long usableSpaceInBytes()
        Returns:
        number of bytes left on device where this queue is stored or null if unable to get this value
      • size

        int size()
        Returns:
        number of elements in this queue
      • backupQueue

        void backupQueue​(String prefix)
                  throws IOException
        Note: use with caution This method is mainly designed to handle critical state of the queue storage by backing up the current queue persistent store and recreating a new one. Renames current queue file name to [prefix]_[queue_file_name] and re-creates queue file with [queue_file_name]. If file with [prefix]_[queue_file_name] already exists it will be deleted. Note that if backupQueue(String) is called between peek() and remove() this can cause remove() to delete a different CrossNodesEvent then expected or may throw NoSuchElementException if the new queue after backupQueue(String) is empty.
        Throws:
        IOException
      • nodeQueueNumberForCurrentThread

        static int nodeQueueNumberForCurrentThread()
        Utility method to get the nodeQueueNumber for current thread.
        Returns:
        nodeQueueNumber for current thread
      • nodeQueueNumber

        static int nodeQueueNumber​(long threadId)
        Utility method to get the nodeQueueNumber for given thread id.
        Returns:
        nodeQueueNumber for given thread id