org.apache.geode.internal.cache.EntriesSet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of geode-core Show documentation
Show all versions of geode-core Show documentation
Apache Geode provides a database-like consistency model, reliable transaction processing and a shared-nothing architecture to maintain very low latency performance with high concurrency processing
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this file to You 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.
*/
package org.apache.geode.internal.cache;
import java.util.AbstractSet;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import org.apache.geode.cache.EntryDestroyedException;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.query.internal.QueryExecutionContext;
import org.apache.geode.internal.cache.LocalRegion.IteratorType;
import org.apache.geode.internal.cache.LocalRegion.NonTXEntry;
import org.apache.geode.internal.i18n.LocalizedStrings;
/** Set view of entries */
public class EntriesSet extends AbstractSet {
final LocalRegion topRegion;
final boolean recursive;
final IteratorType iterType;
protected final TXStateInterface myTX;
final boolean allowTombstones;
protected final InternalDataView view;
final boolean rememberReads;
private boolean keepSerialized = false;
protected boolean ignoreCopyOnReadForQuery = false;
EntriesSet(LocalRegion region, boolean recursive, IteratorType viewType,
boolean allowTombstones) {
this.topRegion = region;
this.recursive = recursive;
this.iterType = viewType;
this.myTX = region.getTXState();
this.view = this.myTX == null ? region.getSharedDataView() : this.myTX;
this.rememberReads = true;
this.allowTombstones = allowTombstones;
}
protected final void checkTX() {
if (this.myTX != null) {
if (!myTX.isInProgress()) {
throw new IllegalStateException(
LocalizedStrings.LocalRegion_REGION_COLLECTION_WAS_CREATED_WITH_TRANSACTION_0_THAT_IS_NO_LONGER_ACTIVE
.toLocalizedString(myTX.getTransactionId()));
}
} else {
if (this.topRegion.isTX()) {
throw new IllegalStateException(
LocalizedStrings.LocalRegion_NON_TRANSACTIONAL_REGION_COLLECTION_IS_BEING_USED_IN_A_TRANSACTION
.toLocalizedString(this.topRegion.getTXState().getTransactionId()));
}
}
}
@Override
public Iterator