Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License. See accompanying
* LICENSE file.
*/
package com.gemstone.gemfire.internal.cache.partitioned;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import com.gemstone.gemfire.DataSerializer;
import com.gemstone.gemfire.LogWriter;
import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.cache.CacheWriterException;
import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.EntryExistsException;
import com.gemstone.gemfire.cache.Operation;
import com.gemstone.gemfire.cache.RegionDestroyedException;
import com.gemstone.gemfire.cache.TransactionException;
import com.gemstone.gemfire.cache.client.PoolFactory;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.internal.DM;
import com.gemstone.gemfire.distributed.internal.DirectReplyProcessor;
import com.gemstone.gemfire.distributed.internal.DistributionManager;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.ReplyException;
import com.gemstone.gemfire.distributed.internal.ReplyMessage;
import com.gemstone.gemfire.distributed.internal.ReplyProcessor21;
import com.gemstone.gemfire.distributed.internal.ReplySender;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.i18n.LogWriterI18n;
import com.gemstone.gemfire.internal.Assert;
import com.gemstone.gemfire.internal.ByteArrayDataInput;
import com.gemstone.gemfire.internal.InternalDataSerializer;
import com.gemstone.gemfire.internal.NanoTimer;
import com.gemstone.gemfire.internal.cache.*;
import com.gemstone.gemfire.internal.cache.DistributedPutAllOperation.EntryVersionsList;
import com.gemstone.gemfire.internal.cache.DistributedPutAllOperation.PutAllEntryData;
import com.gemstone.gemfire.internal.cache.PutAllPartialResultException.PutAllPartialResult;
import com.gemstone.gemfire.internal.cache.delta.Delta;
import com.gemstone.gemfire.internal.cache.ha.ThreadIdentifier;
import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID;
import com.gemstone.gemfire.internal.cache.tier.sockets.VersionedObjectList;
import com.gemstone.gemfire.internal.cache.versions.ConcurrentCacheModificationException;
import com.gemstone.gemfire.internal.cache.versions.VersionTag;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.internal.shared.Version;
import com.gemstone.gnu.trove.THashMap;
import com.gemstone.gnu.trove.THashSet;
/**
* A Partitioned Region update message. Meant to be sent only to
* a bucket's primary owner. In addition to updating an entry it is also used to
* send Partitioned Region event information.
*
* @author Gester Zhou
* @since 6.0
*/
public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
private PutAllEntryData[] putAllPRData;
private int putAllPRDataSize = 0;
private Integer bucketId;
/** An additional object providing context for the operation, e.g., for BridgeServer notification */
ClientProxyMembershipID bridgeContext;
/** true if no callbacks should be invoked */
private boolean skipCallbacks;
protected static final short HAS_BRIDGE_CONTEXT = UNRESERVED_FLAGS_START;
protected static final short SKIP_CALLBACKS = (HAS_BRIDGE_CONTEXT << 1);
protected static final short FETCH_FROM_HDFS = (SKIP_CALLBACKS << 1);
//using the left most bit for IS_PUT_DML, the last available bit
protected static final short IS_PUT_DML = (short) (FETCH_FROM_HDFS << 1);
private transient InternalDistributedSystem internalDs;
/** whether direct-acknowledgement is desired */
private transient boolean directAck = false;
/**
* state from operateOnRegion that must be preserved for transmission
* from the waiting pool
*/
transient boolean result = false;
transient VersionedObjectList versions = null;
private PutAllResponse remoteResponse;
/** whether this operation should fetch oldValue from HDFS */
private boolean fetchFromHDFS;
private boolean isPutDML;
/**
* Empty constructor to satisfy {@link DataSerializer}requirements
*/
public PutAllPRMessage() {
}
public PutAllPRMessage(int bucketId, int size, boolean notificationOnly,
boolean posDup, boolean skipCallbacks, final TXStateInterface tx, boolean fetchFromHDFS, boolean isPutDML) {
super(tx);
this.bucketId = Integer.valueOf(bucketId);
putAllPRData = new PutAllEntryData[size];
this.notificationOnly = notificationOnly;
this.posDup = posDup;
this.skipCallbacks = skipCallbacks;
this.fetchFromHDFS = fetchFromHDFS;
this.isPutDML = isPutDML;
}
public void addEntry(PutAllEntryData entry) {
this.putAllPRData[this.putAllPRDataSize++] = entry;
}
public void initMessage(PartitionedRegion r, Set recipients,
boolean notifyOnly, DirectReplyProcessor p) {
setInternalDs(r.getSystem());
setDirectAck(false);
this.resetRecipients();
if (recipients != null) {
setRecipients(recipients);
}
this.regionId = r.getPRId();
this.processor = p;
this.processorId = p==null? 0 : p.getProcessorId();
if (p != null && this.isSevereAlertCompatible()) {
p.enableSevereAlertProcessing();
}
this.notificationOnly = notifyOnly;
}
@Override
public boolean isSevereAlertCompatible() {
// allow forced-disconnect processing for all cache op messages
return true;
}
public void setPossibleDuplicate(boolean posDup) {
this.posDup = posDup;
}
// this method made unnecessary by entry versioning in 7.0 but kept here for merging
// public void saveKeySet(PutAllPartialResult partialKeys) {
// partialKeys.addKeysAndVersions(this.versions);
// }
public final int getSize() {
return putAllPRDataSize;
}
public Collection