All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.atomic.impl.ClearOperation Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.infinispan.atomic.impl;

import org.infinispan.commons.marshall.AbstractExternalizer;
import org.infinispan.commons.util.FastCopyHashMap;
import org.infinispan.commons.util.Util;
import org.infinispan.marshall.core.Ids;

import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Map;
import java.util.Set;

/**
 * An atomic clear operation.
 * 

* * @author (various) * @param * @param * @since 4.0 */ public class ClearOperation extends Operation { FastCopyHashMap originalEntries; ClearOperation() { } ClearOperation(FastCopyHashMap originalEntries) { this.originalEntries = originalEntries; } @Override public void rollback(Map delegate) { if (!originalEntries.isEmpty()) delegate.putAll(originalEntries); } @Override public void replay(Map delegate) { delegate.clear(); } @Override public K keyAffected() { //null means all keys are affected return null; } @Override public String toString() { return "ClearOperation"; } public static class Externalizer extends AbstractExternalizer { @Override public void writeObject(ObjectOutput output, ClearOperation object) throws IOException { // no-op } @Override public ClearOperation readObject(ObjectInput input) throws IOException, ClassNotFoundException { return new ClearOperation(); } @Override public Integer getId() { return Ids.ATOMIC_CLEAR_OPERATION; } @Override public Set> getTypeClasses() { return Util.>asSet(ClearOperation.class); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy