Skip to content

Commit

Permalink
ns
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed Feb 28, 2013
1 parent 85bc478 commit fa3f6dd
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions tests/junit/org/jgroups/tests/OOBTest.java
Expand Up @@ -30,34 +30,25 @@ public class OOBTest extends ChannelTestBase {


@BeforeMethod @BeforeMethod
void init() throws Exception { void init() throws Exception {
a=createChannel(true, 2); a=createChannel(true, 2, "A");
a.setName("A"); b=createChannel(a, "B");
b=createChannel(a);
b.setName("B");
setOOBPoolSize(a,b); setOOBPoolSize(a,b);
setStableGossip(a,b); setStableGossip(a,b);
a.connect("OOBTest"); a.connect("OOBTest");
b.connect("OOBTest"); b.connect("OOBTest");
View view=b.getView(); Util.waitUntilAllChannelsHaveSameSize(10000, 1000, a, b);
System.out.println("view = " + view);
Util.waitUntilAllChannelsHaveSameSize(20000, 1000,a,b);
} }




@AfterMethod @AfterMethod void cleanup() {Util.close(b, a);}
void cleanup() {
Util.sleep(1000);
Util.close(b,a);
}




/** /**
* A and B. A multicasts a regular message, which blocks in B. Then A multicasts an OOB message, which must be * A and B. A multicasts a regular message, which blocks in B. Then A multicasts an OOB message, which must be
* received by B. * received by B.
*/ */
public void testNonBlockingUnicastOOBMessage() throws Exception { public void testNonBlockingUnicastOOBMessage() throws Exception {
Address dest=b.getAddress(); send(b.getAddress());
send(dest);
} }


public void testNonBlockingMulticastOOBMessage() throws Exception { public void testNonBlockingMulticastOOBMessage() throws Exception {
Expand Down Expand Up @@ -312,7 +303,7 @@ private void send(Address dest) throws Exception {
final int NUM=10; final int NUM=10;
b.setReceiver(receiver); b.setReceiver(receiver);


a.send(new Message(dest, 1)); a.send(dest, 1); // the only regular message
for(int i=2; i <= NUM; i++) for(int i=2; i <= NUM; i++)
a.send(new Message(dest, i).setFlag(Message.OOB)); a.send(new Message(dest, i).setFlag(Message.OOB));


Expand All @@ -322,7 +313,7 @@ private void send(Address dest) throws Exception {
if(list.size() == NUM-1) if(list.size() == NUM-1)
break; break;
sendStableMessages(a,b); sendStableMessages(a,b);
Util.sleep(1000); // give the asynchronous msgs some time to be received Util.sleep(500); // give the asynchronous msgs some time to be received
} }


System.out.println("list = " + list); System.out.println("list = " + list);
Expand Down Expand Up @@ -369,8 +360,8 @@ private static void check(final int num_expected_msgs, Collection<Integer>... li
private static void setOOBPoolSize(JChannel... channels) { private static void setOOBPoolSize(JChannel... channels) {
for(Channel channel: channels) { for(Channel channel: channels) {
TP transport=channel.getProtocolStack().getTransport(); TP transport=channel.getProtocolStack().getTransport();
transport.setOOBThreadPoolMinThreads(1); transport.setOOBThreadPoolMinThreads(4);
transport.setOOBThreadPoolMaxThreads(2); transport.setOOBThreadPoolMaxThreads(8);
} }
} }


Expand Down

0 comments on commit fa3f6dd

Please sign in to comment.