org.apache.catalina.tribes.Member Java Examples

The following examples show how to use org.apache.catalina.tribes.Member. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NonBlockingCoordinator.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Override
public void messageReceived(ChannelMessage msg) {
    if ( Arrays.contains(msg.getMessage().getBytesDirect(),0,COORD_ALIVE,0,COORD_ALIVE.length) ) {
        //ignore message, its an alive message
        fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_MSG_ARRIVE,this,"Alive Message"));

    } else if ( Arrays.contains(msg.getMessage().getBytesDirect(),0,COORD_HEADER,0,COORD_HEADER.length) ) {
        try {
            CoordinationMessage cmsg = new CoordinationMessage(msg.getMessage());
            Member[] cmbr = cmsg.getMembers();
            fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_MSG_ARRIVE,this,"Coord Msg Arrived("+Arrays.toNameString(cmbr)+")"));
            processCoordMessage(cmsg);
        }catch ( ChannelException x ) {
            log.error(sm.getString("nonBlockingCoordinator.processCoordinationMessage.failed"),x);
        }
    } else {
        super.messageReceived(msg);
    }
}
 
Example #2
Source File: TcpFailureDetector.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Override
public void memberAdded(Member member) {
    if ( membership == null ) setupMembership();
    boolean notify = false;
    synchronized (membership) {
        if (removeSuspects.containsKey(member)) {
            //previously marked suspect, system below picked up the member again
            removeSuspects.remove(member);
        } else if (membership.getMember(member) == null){
            //if we add it here, then add it upwards too
            //check to see if it is alive
            if (memberAlive(member)) {
                membership.memberAlive(member);
                notify = true;
            } else {
                if (member instanceof StaticMember) {
                    addSuspects.put(member, Long.valueOf(System.currentTimeMillis()));
                }
            }
        }
    }
    if ( notify ) super.memberAdded(member);
}
 
Example #3
Source File: AbstractReplicatedMap.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
public V put(K key, V value, boolean notify) {
    MapEntry<K,V> entry = new MapEntry<K,V>(key,value);
    entry.setBackup(false);
    entry.setProxy(false);
    entry.setCopy(false);
    entry.setPrimary(channel.getLocalMember(false));

    V old = null;

    //make sure that any old values get removed
    if ( containsKey(key) ) old = remove(key);
    try {
        if ( notify ) {
            Member[] backup = publishEntryInfo(key, value);
            entry.setBackupNodes(backup);
        }
    } catch (ChannelException x) {
        log.error("Unable to replicate out data for a AbstractReplicatedMap.put operation", x);
    }
    innerMap.put(key,entry);
    return old;
}
 
Example #4
Source File: NonBlockingCoordinator.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
protected void handleMyToken(Member local, CoordinationMessage msg, Membership merged) throws ChannelException {
    if ( local.equals(msg.getLeader()) ) {
        //no leadership change
        if ( Arrays.sameMembers(msg.getMembers(),merged.getMembers()) ) {
            msg.type = COORD_CONF;
            super.sendMessage(Arrays.remove(msg.getMembers(),local),createData(msg,local),null);
            handleViewConf(msg, merged);
        } else {
            //membership change
            suggestedView = new Membership(local,AbsoluteOrder.comp,true);
            suggestedviewId = msg.getId();
            Arrays.fill(suggestedView,merged.getMembers());
            msg.view = merged.getMembers();
            sendElectionMsgToNextInline(local,msg);
        }
    } else {
        //leadership change
        suggestedView = null;
        suggestedviewId = null;
        msg.view = merged.getMembers();
        sendElectionMsgToNextInline(local,msg);
    }
}
 
Example #5
Source File: NonBlockingCoordinator.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public void memberDisappeared(Member member) {
    try {
        
        membership.removeMember((MemberImpl)member);
        super.memberDisappeared(member);
        try {
            fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_MBR_DEL,this,"Member remove("+member.getName()+")"));
            if ( started && (isCoordinator() || isHighest()) ) 
                startElection(true); //to do, if a member disappears, only the coordinator can start
        }catch ( ChannelException x ) {
            log.error("Unable to start election when member was removed.",x);
        }
    }finally {
    }
}
 
Example #6
Source File: ThroughputInterceptor.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
    if ( access.addAndGet(1) == 1 ) txStart = System.currentTimeMillis();
    long bytes = XByteBuffer.getDataPackageLength(((ChannelData)msg).getDataPackageLength());
    try {
        super.sendMessage(destination, msg, payload);
    }catch ( ChannelException x ) {
        msgTxErr.addAndGet(1);
        if ( access.get() == 1 ) access.addAndGet(-1);
        throw x;
    } 
    mbTx += (bytes*destination.length)/(1024d*1024d);
    mbAppTx += bytes/(1024d*1024d);
    if ( access.addAndGet(-1) == 0 ) {
        long stop = System.currentTimeMillis();
        timeTx += (stop - txStart) / 1000d;
        if ((msgTxCnt.get() / interval) >= lastCnt) {
            lastCnt++;
            report(timeTx);
        }
    }
    msgTxCnt.addAndGet(1);
}
 
Example #7
Source File: SimpleTcpCluster.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * New cluster member is registered
 * 
 * @see org.apache.catalina.tribes.MembershipListener#memberAdded(org.apache.catalina.tribes.Member)
 */
@Override
public void memberAdded(Member member) {
    try {
        hasMembers = channel.hasMembers();
        if (log.isInfoEnabled()) log.info("Replication member added:" + member);
        // Notify our interested LifecycleListeners
        fireLifecycleEvent(BEFORE_MEMBERREGISTER_EVENT, member);

        registerMember(member);

        // Notify our interested LifecycleListeners
        fireLifecycleEvent(AFTER_MEMBERREGISTER_EVENT, member);
    } catch (Exception x) {
        log.error("Unable to connect to replication system.", x);
    }

}
 
Example #8
Source File: AbstractReplicatedMap.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public void mapMemberAdded(Member member) {
    if ( member.equals(getChannel().getLocalMember(false)) ) return;
    boolean memberAdded = false;
    //select a backup node if we don't have one
    Member mapMember = getChannel().getMember(member);
    if (mapMember == null) {
        log.warn("Notified member is not registered in the membership:" + member);
        return;
    }
    synchronized (mapMembers) {
        if (!mapMembers.containsKey(mapMember) ) {
            if (log.isInfoEnabled()) log.info("Map member added:" + mapMember);
            mapMembers.put(mapMember, Long.valueOf(System.currentTimeMillis()));
            memberAdded = true;
        }
    }
    if ( memberAdded ) {
        synchronized (stateMutex) {
            Iterator<Map.Entry<K,MapEntry<K,V>>> i = innerMap.entrySet().iterator();
            while (i.hasNext()) {
                Map.Entry<K,MapEntry<K,V>> e = i.next();
                MapEntry<K,V> entry = innerMap.get(e.getKey());
                if ( entry == null ) continue;
                if (entry.isPrimary() && (entry.getBackupNodes() == null || entry.getBackupNodes().length == 0)) {
                    try {
                        Member[] backup = publishEntryInfo(entry.getKey(), entry.getValue());
                        entry.setBackupNodes(backup);
                        entry.setPrimary(channel.getLocalMember(false));
                    } catch (ChannelException x) {
                        log.error("Unable to select backup node.", x);
                    } //catch
                } //end if
            } //while
        } //synchronized
    }//end if
}
 
Example #9
Source File: TestDomainFilterInterceptor.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void memberDisappeared(Member member) {
    if (members.contains(member)) {
        members.remove(member);
        try {
            System.out.println(name + ":member disappeared[" + new String(member.getPayload(), "ASCII") + "; Thread:"+Thread.currentThread().getName()+"]");
        } catch (Exception x) {
            System.out.println(name + ":member disappeared[unknown]");
        }
    }
}
 
Example #10
Source File: OrderInterceptor.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
protected void processLeftOvers(Member member, boolean force) {
    MessageOrder tmp = incoming.get(member);
    if ( force ) {
        Counter cnt = getInCounter(member);
        cnt.setCounter(Integer.MAX_VALUE);
    }
    if ( tmp!= null ) processIncoming(tmp);
}
 
Example #11
Source File: AbstractReplicatedMap.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public boolean accept(Serializable msg, Member sender) {
    boolean result = false;
    if (msg instanceof MapMessage) {
        if ( log.isTraceEnabled() ) log.trace("Map["+mapname+"] accepting...."+msg);
        result = Arrays.equals(mapContextName, ( (MapMessage) msg).getMapId());
        if ( log.isTraceEnabled() ) log.trace("Msg["+mapname+"] accepted["+result+"]...."+msg);
    }
    return result;
}
 
Example #12
Source File: FragmentationInterceptor.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public void frag(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
    int size = msg.getMessage().getLength();

    int count = ((size / maxSize )+(size%maxSize==0?0:1));
    ChannelMessage[] messages = new ChannelMessage[count];
    int remaining = size;
    for ( int i=0; i<count; i++ ) {
        ChannelMessage tmp = (ChannelMessage)msg.clone();
        int offset = (i*maxSize);
        int length = Math.min(remaining,maxSize);
        tmp.getMessage().clear();
        tmp.getMessage().append(msg.getMessage().getBytesDirect(),offset,length);
        //add the msg nr
        //tmp.getMessage().append(XByteBuffer.toBytes(i),0,4);
        tmp.getMessage().append(i);
        //add the total nr of messages
        //tmp.getMessage().append(XByteBuffer.toBytes(count),0,4);
        tmp.getMessage().append(count);
        //add true as the frag flag
        //byte[] flag = XByteBuffer.toBytes(true);
        //tmp.getMessage().append(flag,0,flag.length);
        tmp.getMessage().append(true);
        messages[i] = tmp;
        remaining -= length;
        
    }
    for ( int i=0; i<messages.length; i++ ) {
        super.sendMessage(destination,messages[i],payload);
    }
}
 
Example #13
Source File: Membership.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Notify the membership that this member has announced itself.
 *
 * @param member - the member that just pinged us
 * @return - true if this member is new to the cluster, false otherwise.<br>
 * - false if this member is the local member or updated.
 */
public boolean memberAlive(Member member) {
    // Ignore ourselves
    if (member.equals(local)) {
        return false;
    }

    boolean result = false;
    synchronized (membersLock) {
        MbrEntry entry = map.get(member);
        if (entry == null) {
            entry = addMember(member);
            result = true;
        } else {
            // Update the member alive time
            Member updateMember = entry.getMember();
            if (updateMember.getMemberAliveTime() != member.getMemberAliveTime()) {
                // Update fields that can change
                updateMember.setMemberAliveTime(member.getMemberAliveTime());
                updateMember.setPayload(member.getPayload());
                updateMember.setCommand(member.getCommand());
                // Re-order. Can't sort in place since a call to
                // getMembers() may then receive an intermediate result.
                Member[] newMembers = members.clone();
                Arrays.sort(newMembers, memberComparator);
                members = newMembers;
            }
        }
        entry.accessed();
    }
    return result;
}
 
Example #14
Source File: DeltaManager.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * send a block of session to sender
 * @param sender
 * @param currentSessions
 * @param sendTimestamp
 * @throws IOException
 */
protected void sendSessions(Member sender, Session[] currentSessions,long sendTimestamp) throws IOException {
    byte[] data = serializeSessions(currentSessions);
    if (log.isDebugEnabled()) log.debug(sm.getString("deltaManager.receiveMessage.unloadingAfter",getName()));
    SessionMessage newmsg = new SessionMessageImpl(name,SessionMessage.EVT_ALL_SESSION_DATA, data,"SESSION-STATE", "SESSION-STATE-" + getName());
    newmsg.setTimestamp(sendTimestamp);
    if (log.isDebugEnabled()) log.debug(sm.getString("deltaManager.createMessage.allSessionData",getName()));
    counterSend_EVT_ALL_SESSION_DATA++;
    cluster.send(newmsg, sender);
}
 
Example #15
Source File: DeltaManager.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Find the master of the session state
 * @return master member of sessions
 */
protected Member findSessionMasterMember() {
    Member mbr = null;
    Member mbrs[] = cluster.getMembers();
    if(mbrs.length != 0 ) mbr = mbrs[0];
    if(mbr == null && log.isWarnEnabled()) {
        log.warn(sm.getString("deltaManager.noMasterMember",getName(), ""));
    }
    if(mbr != null && log.isDebugEnabled()) {
        log.debug(sm.getString("deltaManager.foundMasterMember",getName(), mbr));
    }
    return mbr;
}
 
Example #16
Source File: LoadTest.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * memberAdded
 *
 * @param member Member
 * TODO Implement this org.apache.catalina.tribes.MembershipListener
 *   method
 */
@Override
public void memberAdded(Member member) {
    log.info("Member added:"+member);
    synchronized (mutex) {
        mutex.notifyAll();
    }
}
 
Example #17
Source File: McastService.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void memberAdded(Member member) {
    MembershipListener listener = this.listener;
    if (listener != null) {
        listener.memberAdded(member);
    }
}
 
Example #18
Source File: LoadTest.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public void messageReceived(Serializable msg, Member mbr){
    if ( receiveStart == 0 ) receiveStart = System.currentTimeMillis();
    if ( debug ) {
        if ( msg instanceof LoadMessage ) {
            printArray(((LoadMessage)msg).getMessage());
        }
    }

    if ( msg instanceof ByteMessage && !(msg instanceof LoadMessage)) {
        LoadMessage tmp = new LoadMessage();
        tmp.setMessage(((ByteMessage)msg).getMessage());
        msg = tmp;
        tmp = null;
    }


    bytesReceived+=((LoadMessage)msg).getMessage().length;
    mBytesReceived+=(((LoadMessage)msg).getMessage().length)/1024f/1024f;
    messagesReceived++;
    if ( (messagesReceived%statsInterval)==0 || (messagesReceived==msgCount)) {
        float bytes = (((LoadMessage)msg).getMessage().length*messagesReceived);
        float seconds = (System.currentTimeMillis()-receiveStart) / 1000f;
        log.info("****RECEIVE STATS-"+Thread.currentThread().getName()+"*****"+
                 "\n\tMessage count :"+(long)messagesReceived+
                 "\n\tMessage/sec   :"+messagesReceived/seconds+
                 "\n\tTotal bytes   :"+(long)bytes+
                 "\n\tTotal mbytes  :"+(long)mBytesReceived+
                 "\n\tTime since 1st:"+seconds+" seconds"+
                 "\n\tBytes/second  :"+(bytes/seconds)+
                 "\n\tMBytes/second :"+(mBytesReceived/seconds)+"\n");

    }
}
 
Example #19
Source File: TestTcpFailureDetector.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public void memberDisappeared(Member member) {
    if ( members.contains(member) ) {
        members.remove(member);
        try{
            System.out.println(name + ":member disappeared[" + new String(member.getPayload(), "ASCII") + "]");
        }catch ( Exception x ) {
            System.out.println(name + ":member disappeared[unknown]");
        }
    }
}
 
Example #20
Source File: StaticMembershipInterceptor.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
protected void sendMemberMessage(Member[] members, byte[] message) throws ChannelException {
    if ( members == null || members.length == 0 ) return;
    ChannelData data = new ChannelData(true);
    data.setAddress(getLocalMember(false));
    data.setTimestamp(System.currentTimeMillis());
    data.setOptions(getOptionFlag());
    data.setMessage(new XByteBuffer(message, false));
    super.sendMessage(members, data, null);
}
 
Example #21
Source File: GzipInterceptor.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
    try {
        byte[] data = compress(msg.getMessage().getBytes());
        msg.getMessage().trim(msg.getMessage().getLength());
        msg.getMessage().append(data,0,data.length);
        getNext().sendMessage(destination, msg, payload);
    } catch ( IOException x ) {
        log.error("Unable to compress byte contents");
        throw new ChannelException(x);
    }
}
 
Example #22
Source File: CoordinationDemo.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public String getStatusLine() {
    //member - 30
    //running- 10
    //coord - 30
    //view-id - 24
    //view count - 8
    StringBuilder buf = new StringBuilder();
    String local = "";
    String coord = "";
    String viewId = "";
    String count = "0";
    if ( channel != null ) {
        Member lm = channel.getLocalMember(false);
        local = lm!=null?lm.getName():"";
        coord = interceptor!=null && interceptor.getCoordinator()!=null?interceptor.getCoordinator().getName():"";
        if (interceptor != null) {
            viewId = getByteString(interceptor.getViewId()!=null?interceptor.getViewId().getBytes():new byte[0]);
            count = String.valueOf(interceptor.getView().length);
        }
    }
    buf.append(leftfill(local,30," "));
    buf.append(leftfill(startstatus, 10, " "));
    buf.append(leftfill(coord, 30, " "));
    buf.append(leftfill(viewId, 24, " "));
    buf.append(leftfill(count, 8, " "));
    buf.append("\n");
    buf.append("Status:"+status);
    buf.append("\n");
    return buf.toString();
}
 
Example #23
Source File: TestDataIntegrity.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Test
public void testDataSendACK() throws Exception {
    System.err.println("Starting ACK");
    for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(),Channel.SEND_OPTIONS_USE_ACK);
    Thread.sleep(250);
    System.err.println("Finished ACK");
    assertEquals("Checking success messages.",msgCount,listener1.count);
}
 
Example #24
Source File: AbstractReplicatedMap.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * @deprecated  Unused - will be removed in 8.0.x
 */
@Deprecated
protected void writeMembers(ObjectOutput out,Member[] members) throws IOException {
    if ( members == null ) members = new Member[0];
    out.writeInt(members.length);
    for (int i=0; i<members.length; i++ ) {
        if ( members[i] != null ) {
            byte[] d = members[i] != null ? ( (MemberImpl)members[i]).getData(false) : new byte[0];
            out.writeInt(d.length);
            out.write(d);
        }
    }
}
 
Example #25
Source File: AbstractReplicatedMap.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public Member[] getMapMembersExcl(Member[] exclude) {
    synchronized (mapMembers) {
        @SuppressWarnings("unchecked") // mapMembers has the correct type
        HashMap<Member, Long> list = (HashMap<Member, Long>)mapMembers.clone();
        for (int i=0; i<exclude.length;i++) list.remove(exclude[i]);
        return getMapMembers(list);
    }
}
 
Example #26
Source File: SimpleTcpCluster.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public void messageReceived(ClusterMessage message) {

        if (log.isDebugEnabled() && message != null)
            log.debug("Assuming clocks are synched: Replication for "
                    + message.getUniqueId() + " took="
                    + (System.currentTimeMillis() - (message).getTimestamp())
                    + " ms.");

        //invoke all the listeners
        boolean accepted = false;
        if (message != null) {
            for (Iterator<ClusterListener> iter = clusterListeners.iterator();
                    iter.hasNext();) {
                ClusterListener listener = iter.next();
                if (listener.accept(message)) {
                    accepted = true;
                    listener.messageReceived(message);
                }
            }
            if (!accepted && notifyLifecycleListenerOnFailure) {
                Member dest = message.getAddress();
                // Notify our interested LifecycleListeners
                fireLifecycleEvent(RECEIVE_MESSAGE_FAILURE_EVENT,
                        new SendMessageData(message, dest, null));
                if (log.isDebugEnabled()) {
                    log.debug("Message " + message.toString() + " from type "
                            + message.getClass().getName()
                            + " transfered but no listener registered");
                }
            }
        }
        return;
    }
 
Example #27
Source File: McastService.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Return all the members by name
 */
@Override
public String[] getMembersByName() {
    Member[] currentMembers = getMembers();
    String [] membernames ;
    if(currentMembers != null) {
        membernames = new String[currentMembers.length];
        for (int i = 0; i < currentMembers.length; i++) {
            membernames[i] = currentMembers[i].toString() ;
        }
    } else
        membernames = new String[0] ;
    return membernames ;
}
 
Example #28
Source File: GroupChannel.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * memberAdded gets invoked by the interceptor below the channel
 * and the channel will broadcast it to the membership listeners
 * @param member Member - the new member
 */
@Override
public void memberAdded(Member member) {
    //notify upwards
    for (int i=0; i<membershipListeners.size(); i++ ) {
        MembershipListener membershipListener = (MembershipListener)membershipListeners.get(i);
        if (membershipListener != null) membershipListener.memberAdded(member);
    }
}
 
Example #29
Source File: RpcChannel.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Send a message and wait for the response.
 * @param destination Member[] - the destination for the message, and the members you request a reply from
 * @param message Serializable - the message you are sending out
 * @param rpcOptions int - FIRST_REPLY, MAJORITY_REPLY or ALL_REPLY
 * @param channelOptions channel sender options
 * @param timeout long - timeout in milliseconds, if no reply is received within this time null is returned
 * @return Response[] - an array of response objects.
 * @throws ChannelException Error sending message
 */
public Response[] send(Member[] destination,
                       Serializable message,
                       int rpcOptions,
                       int channelOptions,
                       long timeout) throws ChannelException {

    if ( destination==null || destination.length == 0 ) return new Response[0];

    //avoid dead lock
    int sendOptions =
        channelOptions & ~Channel.SEND_OPTIONS_SYNCHRONIZED_ACK;

    RpcCollectorKey key = new RpcCollectorKey(UUIDGenerator.randomUUID(false));
    RpcCollector collector = new RpcCollector(key,rpcOptions,destination.length);
    try {
        synchronized (collector) {
            if ( rpcOptions != NO_REPLY ) responseMap.put(key, collector);
            RpcMessage rmsg = new RpcMessage(rpcId, key.id, message);
            channel.send(destination, rmsg, sendOptions);
            if ( rpcOptions != NO_REPLY ) collector.wait(timeout);
        }
    } catch ( InterruptedException ix ) {
        Thread.currentThread().interrupt();
    } finally {
        responseMap.remove(key);
    }
    return collector.getResponses();
}
 
Example #30
Source File: TestDataIntegrity.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Test
public void testDataSendACK() throws Exception {
    System.err.println("Starting ACK");
    for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(),Channel.SEND_OPTIONS_USE_ACK);
    Thread.sleep(250);
    System.err.println("Finished ACK");
    assertEquals("Checking success messages.",msgCount,listener1.count);
}