
org.objectweb.dream.queue.buffer.BufferAdd Maven / Gradle / Ivy
/**
* Dream
* Copyright (C) 2003-2004 INRIA Rhone-Alpes
*
* This library 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 of the License, or (at your option) any later version.
*
* This library 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 library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: [email protected]
*
* Initial developer(s): Vivien Quema
* Contributor(s): Romain Lenglet
*/
package org.objectweb.dream.queue.buffer;
import org.objectweb.dream.message.Message;
import org.objectweb.fractal.fraclet.annotation.annotations.Interface;
/**
* This interface defines methods that must be implemented by a buffer to allow
* components to add messages into it. Such an interface is used by producers
* of messages. Note: buffer implementations MUST BE
* thread-safe .
*/
@Interface(name = BufferAdd.ITF_NAME)
public interface BufferAdd
{
/**
* The commonly used name to refer to an interface with this signature.
*/
String ITF_NAME = "buffer-add";
/**
* Adds the specified message to the buffer. This method blocks if there is
* not enough space available. Buffers may place limitations on what
* elements may be added to this buffer. In particular, some buffers require
* that messages contain particular chunks.
*
* @param message the message to be added; never null
.
* @throws InterruptedException if it is interrupted while waiting for a
* message to be removed.
*/
void add(Message message) throws InterruptedException;
/**
* Adds the specified message to the buffer. If the message cannot be added
* (due to space limitation), the message is not added. Buffers may place
* limitations on what elements may be added to this buffer. In particular,
* some buffers require that messages contain particular chunks.
*
* @param message the message to be added; never null
.
* @return true
if the message has been added.
*/
boolean tryAdd(Message message);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy