Code example for Monitor

Methods: start

0
                Subject subject = new Subject();
                echo(">>> RUN Principal = " + principals[i / 3]);
                subject.getPrincipals().add(new JMXPrincipal(principals[i / 3]));
                PrivilegedAction action = new PrivilegedAction() {
                    public Object run() { 
                        m.start();
                        return null; 
                    } 
                }; 
                Subject.doAs(subject, action);
            } 
 
            // Wait for all tasks to be submitted 
            // 
            try { 
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                echo("I fell asleep but someone woke me up"); 
                return 1; 
            }