com.gemstone.gemfire.internal.cache.SetWithCheckpoint Maven / Gradle / Ivy
/*
* 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;
import java.util.AbstractSet;
import java.util.ArrayList;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.Set;
import com.gemstone.gemfire.internal.cache.locks.NonReentrantLock;
import com.gemstone.gnu.trove.THashSet;
/**
* A {@link Set} implementation that allows putting up checkpoints and iterating
* over elements added since the {@link Checkpoint} or removing all new
* elements. The set disallows removing elements from itself directly (though
* {@link #iterator()} can still be used to remove elements, it will cause
* unexpected behaviour for any {@link Checkpoint}s captured prior to that).
*
* It tries to optimize memory overhead by using a list for small sizes and
* switching to a linked HashSet for larger sizes.
*
* @author swale
* @since 7.0
*/
public final class SetWithCheckpoint extends AbstractSet