Class WriteOperation

    • Constructor Summary

      Constructors 
      Constructor Description
      WriteOperation​(Element element)
      Create a new write operation for a particular element
      WriteOperation​(Element element, long creationTime)
      Create a new write operation for a particular element and creation time
    • Constructor Detail

      • WriteOperation

        public WriteOperation​(Element element)
        Create a new write operation for a particular element
        Parameters:
        element - the element to write
      • WriteOperation

        public WriteOperation​(Element element,
                              long creationTime)
        Create a new write operation for a particular element and creation time
        Parameters:
        element - the element to write
        creationTime - the creation time of the operation
    • Method Detail

      • performSingleOperation

        public void performSingleOperation​(CacheWriter cacheWriter)
        Perform this operation as a single execution with the provided cache writer
        Specified by:
        performSingleOperation in interface SingleOperation
        Parameters:
        cacheWriter - the cache writer this operation should be performed upon
      • createBatchOperation

        public BatchOperation createBatchOperation​(java.util.List<? extends SingleOperation> operations)
        Creates a batch operation that corresponds to the operation type of this single operation.

        This batch operation will not be stored in the queue anymore and is solely used for structuring. The data from the single operation will already be processed in the final form that will be expected by the CacheWriter that will be used to execute the batch operation.

        Specified by:
        createBatchOperation in interface SingleOperation
        Parameters:
        operations - the single operations that need to be regrouped in the batch operation
        Returns:
        the created batch operation
      • getKey

        public java.lang.Object getKey()
        Retrieves the element key for this operation.
        Specified by:
        getKey in interface KeyBasedOperation
        Returns:
        the key of the element that is concerned by the operation.
      • getCreationTime

        public long getCreationTime()
        Retrieves the moment when the operation was created.
        Specified by:
        getCreationTime in interface KeyBasedOperation
        Returns:
        the creation time in milliseconds
      • getElement

        public Element getElement()
        Retrieves the element that will be used for this operation
      • getType

        public SingleOperationType getType()
        Returns a stable identifier for the type this operation can be classified in. This is used to group and order batched operations.
        Specified by:
        getType in interface SingleOperation
        Returns:
        the identifier for this operation type
      • throwAway

        public void throwAway​(CacheWriter cacheWriter,
                              java.lang.RuntimeException e)
        Called when all retries have failed
        Specified by:
        throwAway in interface SingleOperation
        Parameters:
        cacheWriter - the CacheWriter to delegate to
        e - the last exception encountered
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object