コード例 #1
0
ファイル: FlushTest.java プロジェクト: rvansa/JGroups
  public void testFlushWithCrashedParticipants() throws Exception {
    JChannel c1 = null;
    JChannel c2 = null;
    JChannel c3 = null;

    try {
      c1 = createChannel(true, 3, "C1");
      changeProps(c1);
      c1.connect("testFlushWithCrashedFlushCoordinator");

      c2 = createChannel(c1, "C2");
      changeProps(c2);
      c2.connect("testFlushWithCrashedFlushCoordinator");

      c3 = createChannel(c1, "C3");
      changeProps(c3);
      c3.connect("testFlushWithCrashedFlushCoordinator");

      // and then kill members other than flush coordinator
      Util.shutdown(c3);
      Util.shutdown(c1);

      // start flush
      Util.startFlush(c2);

      c2.stopFlush();
      Util.waitUntilAllChannelsHaveSameSize(10000, 500, c2);

      // cluster should not hang and one remaining member should have a correct view
      assertTrue("correct view size", c2.getView().size() == 1);
    } finally {
      Util.close(c3, c2, c1);
    }
  }
コード例 #2
0
 private boolean startFlush(Channel ch, int num_attempts, long timeout, boolean automatic_resume) {
   log.debug(
       "starting flush on " + ch.getAddress() + " with automatic resume=" + automatic_resume);
   boolean result = Util.startFlush(ch, num_attempts, 10, timeout);
   if (automatic_resume) {
     ch.stopFlush();
   }
   return result;
 }
コード例 #3
0
 private boolean startFlush(Channel ch, boolean automatic_resume) {
   log.debug(
       "starting flush on " + ch.getAddress() + " with automatic resume=" + automatic_resume);
   boolean result = Util.startFlush(ch);
   if (automatic_resume) {
     ch.stopFlush();
   }
   return result;
 }
コード例 #4
0
ファイル: FlushTest.java プロジェクト: rvansa/JGroups
  public void testFlushWithCrashedParticipant() throws Exception {
    JChannel c1 = null;
    JChannel c2 = null;
    JChannel c3 = null;

    try {
      c1 = createChannel(true, 3, "C1");
      changeProps(c1);
      c1.connect("testFlushWithCrashedParticipant");

      c2 = createChannel(c1, "C2");
      changeProps(c2);
      c2.connect("testFlushWithCrashedParticipant");

      c3 = createChannel(c1, "C3");
      changeProps(c3);
      c3.connect("testFlushWithCrashedParticipant");

      System.out.println("shutting down C3");
      Util.shutdown(c3); // kill a flush participant

      System.out.println("C2: starting flush");
      boolean rc = Util.startFlush(c2);
      System.out.println("flush " + (rc ? " was successful" : "failed"));
      assert rc;

      System.out.println("stopping flush");
      c2.stopFlush();

      System.out.println("waiting for view to contain C1 and C2");
      Util.waitUntilAllChannelsHaveSameSize(10000, 500, c1, c2);

      // cluster should not hang and two remaining members should have a correct view
      System.out.println("C1: view=" + c1.getView() + "\nC2: view=" + c2.getView());
      assertTrue("correct view size", c1.getView().size() == 2);
      assertTrue("correct view size", c2.getView().size() == 2);
    } finally {
      Util.close(c3, c2, c1);
    }
  }
コード例 #5
0
ファイル: FlushTest.java プロジェクト: rvansa/JGroups
  /** Tests http://jira.jboss.com/jira/browse/JGRP-661 */
  public void testPartialFlush() throws Exception {
    JChannel c1 = null;
    JChannel c2 = null;
    try {
      c1 = createChannel(true, 2);
      c1.setReceiver(new SimpleReplier(c1, true));
      c1.connect("testPartialFlush");

      c2 = createChannel(c1);
      c2.setReceiver(new SimpleReplier(c2, false));
      c2.connect("testPartialFlush");

      List<Address> members = new ArrayList<Address>();
      members.add(c2.getAddress());
      boolean flushedOk = Util.startFlush(c2, members);

      assertTrue("Partial flush worked", flushedOk);

      c2.stopFlush(members);
    } finally {
      Util.close(c2, c1);
    }
  }
コード例 #6
0
ファイル: JChannel.java プロジェクト: schaebo/JGroups
 /** Retrieves state from the target member. See {@link #getState(Address,long)} for details. */
 public void getState(Address target, long timeout, boolean useFlushIfPresent) throws Exception {
   Callable<Boolean> flusher = () -> Util.startFlush(JChannel.this);
   getState(target, timeout, useFlushIfPresent ? flusher : null);
 }