
org.infinispan.transaction.RemoteTransaction Maven / Gradle / Ivy
/*
* JBoss, Home of Professional Open Source
* Copyright 2011 Red Hat Inc. and/or its affiliates and other
* contributors as indicated by the @author tags. All rights reserved.
* See the copyright.txt in the distribution for a full listing of
* individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.infinispan.transaction;
import org.infinispan.commands.write.WriteCommand;
import org.infinispan.container.entries.CacheEntry;
import org.infinispan.transaction.xa.GlobalTransaction;
import org.infinispan.transaction.xa.InvalidTransactionException;
import org.infinispan.util.InfinispanCollections;
import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
/**
* Defines the state of a remotely originated transaction.
*
* @author [email protected]
* @since 4.0
*/
public class RemoteTransaction extends AbstractCacheTransaction implements Cloneable {
private static final Log log = LogFactory.getLog(RemoteTransaction.class);
/**
* This flag can only be true for transactions received via state transfer. During state transfer we do not migrate
* lookedUpEntries to save bandwidth. If missingLookedUpEntries is true at the time a CommitCommand is received this
* indicates the preceding PrepareCommand was received by previous owner before state transfer but not by the
* current owner which now has to re-execute prepare to populate lookedUpEntries (and acquire the locks).
*/
private volatile boolean missingLookedUpEntries = false;
public RemoteTransaction(WriteCommand[] modifications, GlobalTransaction tx, int topologyId) {
super(tx, topologyId);
this.modifications = modifications == null || modifications.length == 0
? InfinispanCollections.emptyList()
: Arrays.asList(modifications);
lookedUpEntries = new HashMap
© 2015 - 2025 Weber Informatics LLC | Privacy Policy