com.gemstone.gemfire.internal.cache.ReliableMessageQueue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gemfire-core Show documentation
Show all versions of gemfire-core Show documentation
SnappyData store based off Pivotal GemFireXD
/*
* 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 com.gemstone.gemfire.distributed.Role;
import java.util.Set;
/**
* A reliable message queue is used by a DistributedRegion to queue up distributed
* operations for required roles that are not present at the time the operation
* is done.
* Instances of this interface can be obtained from {@link ReliableMessageQueueFactory} which can be obtained from {@link GemFireCacheImpl#getReliableMessageQueueFactory}.
*
* @author Darrel Schneider
* @since 5.0
*/
public interface ReliableMessageQueue {
/**
* Returns the region this queue belongs to.
*/
public DistributedRegion getRegion();
/**
* Adds a message to the queue to be sent to the list of roles.
* @param data the actual data that describes the operation to enqueue
* @param roles the roles that need to receive this message.
*/
public void add(ReliableDistributionData data, Set roles);
/**
* Gets the roles that this queue currently has messages for.
* @return a set of {link Role}s that currently have queued messages.
* null
is returned if no messages are queued.
*/
public Set getQueuingRoles();
/**
* Attempts to send any messages that have been added for the given role
* to all members that are currently playing that role.
* @param role the role whose queued messages should be sent
* @return true if send was successful; false if it was not and the messages
* are still queued.
*/
public boolean roleReady(Role role);
/**
* Removes all the data in this queue causing it to never be sent.
*/
public void destroy();
/**
* Closes this queue. This frees up any memory used by the queue but its
* persistent data remains.
*/
public void close();
}