Search in sources :

Example 1 with JoinRsp

use of org.jgroups.protocols.pbcast.JoinRsp in project JGroups by belaban.

the class ASYM_ENCRYPT method getCoordinator.

/**
 * Tries to find out if this is a JOIN_RSP or INSTALL_MERGE_VIEW message and returns the coordinator of the view
 */
protected Address getCoordinator(Message msg, GMS.GmsHeader hdr) {
    switch(hdr.getType()) {
        case GMS.GmsHeader.JOIN_RSP:
            try {
                JoinRsp join_rsp = Util.streamableFromBuffer(JoinRsp::new, msg.getRawBuffer(), msg.getOffset(), msg.getLength());
                View new_view = join_rsp != null ? join_rsp.getView() : null;
                return new_view != null ? new_view.getCoord() : null;
            } catch (Throwable t) {
                log.error("%s: failed getting coordinator (keyserver) from JoinRsp: %s", local_addr, t);
            }
            break;
        case GMS.GmsHeader.INSTALL_MERGE_VIEW:
            try {
                Tuple<View, Digest> tuple = GMS._readViewAndDigest(msg.getRawBuffer(), msg.getOffset(), msg.getLength());
                View new_view = tuple != null ? tuple.getVal1() : null;
                return new_view != null ? new_view.getCoord() : null;
            } catch (Throwable t) {
                log.error("%s: failed getting coordinator (keyserver) from INSTALL_MERGE_VIEW: %s", local_addr, t);
            }
            break;
    }
    return null;
}
Also used : JoinRsp(org.jgroups.protocols.pbcast.JoinRsp)

Example 2 with JoinRsp

use of org.jgroups.protocols.pbcast.JoinRsp in project JGroups by belaban.

the class SASL method sendJoinRejectionMessage.

protected void sendJoinRejectionMessage(Address dest, String error_msg) {
    if (dest == null)
        return;
    // specify the error message on the JoinRsp
    JoinRsp joinRes = new JoinRsp(error_msg);
    Message msg = new Message(dest).putHeader(GMS_ID, new GmsHeader(GmsHeader.JOIN_RSP)).setBuffer(GMS.marshal(joinRes));
    down_prot.down(msg);
}
Also used : JoinRsp(org.jgroups.protocols.pbcast.JoinRsp) Message(org.jgroups.Message) GmsHeader(org.jgroups.protocols.pbcast.GMS.GmsHeader)

Example 3 with JoinRsp

use of org.jgroups.protocols.pbcast.JoinRsp in project JGroups by belaban.

the class AUTH method sendJoinRejectionMessage.

protected void sendJoinRejectionMessage(Address dest, String error_msg) {
    if (dest == null)
        return;
    // specify the error message on the JoinRsp
    JoinRsp joinRes = new JoinRsp(error_msg);
    Message msg = new BytesMessage(dest).putHeader(GMS_ID, new GMS.GmsHeader(GMS.GmsHeader.JOIN_RSP)).setArray(GMS.marshal(joinRes));
    down_prot.down(msg);
}
Also used : JoinRsp(org.jgroups.protocols.pbcast.JoinRsp)

Aggregations

JoinRsp (org.jgroups.protocols.pbcast.JoinRsp)3 Message (org.jgroups.Message)1 GmsHeader (org.jgroups.protocols.pbcast.GMS.GmsHeader)1