Skip to content

Commit

Permalink
Thread.currentThread().join() at end of main
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Blagojevic committed Jul 30, 2009
1 parent 2b6fcd2 commit 7795866
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/org/jgroups/stack/GossipRouter.java
Expand Up @@ -56,7 +56,7 @@
* additional administrative effort on the part of the user.<p>
* @author Bela Ban
* @author Ovidiu Feodorov <ovidiuf@users.sourceforge.net>
* @version $Id: GossipRouter.java,v 1.26.2.10 2009/07/30 08:57:13 vlada Exp $
* @version $Id: GossipRouter.java,v 1.26.2.11 2009/07/30 09:11:28 vlada Exp $
* @since 2.1.1
*/
public class GossipRouter {
Expand Down Expand Up @@ -416,7 +416,19 @@ public void run() {
GossipRouter.this.stop();
}
});


// start the main server thread
new Thread(new Runnable() {
public void run() {
try{
mainLoop();
}
finally {
cleanup();
}
}
}, "GossipRouter").start();

// starts the cache sweeper as daemon thread, so we won't block on it
// upon termination
timer=new Timer(true);
Expand All @@ -425,12 +437,6 @@ public void run() {
sweep();
}
}, expiryTime, expiryTime);

try {
mainLoop();
} finally {
cleanup();
}
}

/**
Expand Down Expand Up @@ -1174,11 +1180,12 @@ public static void main(String[] args) throws Exception {
if (soLinger >= 0)
router.setLingerTimeout(soLinger);

router.start();
router.start();
}
catch(Exception e) {
System.err.println(e);
}
}
Thread.currentThread().join();
}

static void help() {
Expand Down

0 comments on commit 7795866

Please sign in to comment.