Search in sources :

Example 1 with GuardedBy

use of org.jgroups.annotations.GuardedBy in project JGroups by belaban.

the class DeliveryManagerImpl method getAndSetView.

@GuardedBy("deliverySet")
private View getAndSetView(View newView) {
    View oldView = currentView;
    currentView = newView;
    return oldView;
}
Also used : View(org.jgroups.View) GuardedBy(org.jgroups.annotations.GuardedBy)

Example 2 with GuardedBy

use of org.jgroups.annotations.GuardedBy in project JGroups by belaban.

the class BaseBundler method sendBundledMessages.

/**
 * Sends all messages in the map. Messages for the same destination are bundled into a message list.
 * The map will be cleared when done.
 */
@GuardedBy("lock")
protected void sendBundledMessages() {
    for (Map.Entry<Address, List<Message>> entry : msgs.entrySet()) {
        List<Message> list = entry.getValue();
        if (list.isEmpty())
            continue;
        output.position(0);
        if (list.size() == 1)
            sendSingleMessage(list.get(0));
        else {
            Address dst = entry.getKey();
            sendMessageList(dst, list.get(0).getSrc(), list);
            if (transport.statsEnabled())
                transport.incrBatchesSent(1);
        }
    }
    clearMessages();
    count = 0;
}
Also used : Address(org.jgroups.Address) Message(org.jgroups.Message) GuardedBy(org.jgroups.annotations.GuardedBy)

Example 3 with GuardedBy

use of org.jgroups.annotations.GuardedBy in project JGroups by belaban.

the class BaseBundler method addMessage.

@GuardedBy("lock")
protected void addMessage(Message msg, long size) {
    Address dest = msg.getDest();
    List<Message> tmp = msgs.computeIfAbsent(dest, k -> new ArrayList<>(5));
    tmp.add(msg);
    count += size;
}
Also used : Address(org.jgroups.Address) Message(org.jgroups.Message) GuardedBy(org.jgroups.annotations.GuardedBy)

Aggregations

GuardedBy (org.jgroups.annotations.GuardedBy)3 Address (org.jgroups.Address)2 Message (org.jgroups.Message)2 View (org.jgroups.View)1