src/main/java/toy/das/atomicBroadcast/RBrodcastService.java
/**
     * Atomic Broadcast a message to the whole network.
     * @param m the message to broadcast
     * @param channel the broadcaster channel (with a single Toy group this is always 0)
     * @param id the broadcaster id
     * @return the serial id of the Atomic Broadcast action
     */
Atomic Broadcast a message to the whole network.
@param m the message to broadcast
@param channel the broadcaster channel (with a single Toy group this is always 0)
@param id the broadcaster id
@return the serial id of the Atomic Broadcast action
Atomic Broadcast a message to the whole network . @param m the message to broadcast @param channel the broadcaster channel ( with a single Toy group this is always 0 ) @param id the broadcaster id @return the serial id of the Atomic Broadcast action
public int broadcast(byte[] m, int channel, int id) {
        Types.RBMsg msg = Types.RBMsg.
                newBuilder().
                setM(Types.Meta.newBuilder()
                        .setChannel(channel)
                        .setSender(id)
                        .setCid(cid)
                        .build()).
                setData(ByteString.copyFrom(m)).
                build();
        int ret = cid;
        cid++;
        byte[] data = msg.toByteArray();
        RBProxy.invokeAsynchRequest(data, new ReplyListener() {
            @Override
            public void reset() {
            }
            @Override
            public void replyReceived(RequestContext context, TOMMessage reply) {
            }
        }, TOMMessageType.ORDERED_REQUEST);
        return ret;
    }
public int broadcast ( byte [ ] m , int channel , int id ) { Types . RBMsg msg = Types . RBMsg . newBuilder ( ) . setM ( Types . Meta . newBuilder ( ) . setChannel ( channel ) . setSender ( id ) . setCid ( cid ) . build ( ) ) . setData ( ByteString . copyFrom ( m ) ) . build ( ) ; int ret = cid ; cid ++ ; byte [ ] data = msg . toByteArray ( ) ; RBProxy . invokeAsynchRequest ( data , new ReplyListener ( ) { @ Override public void reset ( ) { } @ Override public void replyReceived ( RequestContext context , TOMMessage reply ) { } } , TOMMessageType . ORDERED_REQUEST ) ; return ret ; }
Atomic Broadcast a message to the whole network.
Atomic Broadcast a message to the whole network .