"adrian(a)jboss.org" wrote : Couldn't you just implement this anyway in your
services,
| using the 2PC create/start lifecycle?
|
|
| | private volatile Thread startupThread;
| |
| | public void create() throws Exception
| | {
| | startupThread = new Thread(new Runnable()
| | {
| | public void run()
| | {
| | // start channel here
| | }
| | });
| | startupThread.start();
| | }
| |
| | public void start() throws Exception
| | {
| | startThread.join(); // wait for startup to complete before injecting ourselves
onto others
| | startThread = null;
| | }
| |
|
| Of course, we could do better (e.g. using thread pools and "optimizing"
| related work across threads based on dependencies) if this was a feature of the MC.
No, since create only creates the channel, but start() connects it (time consuming
operation), we'd block the main thread for the same time with the join() as if we
deployed on the main thread directly.
We could create a separate threads and not join() it, but that might have unintended
consequences, such as channels not being ready when JBossCache (which has a dep on a
channel) starts...
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4131439#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...