Package org.rhq.core.pc.component.ComponentInvocationContextImpl

Examples of org.rhq.core.pc.component.ComponentInvocationContextImpl.LocalContext


            this.method = method;
            this.args = args;
            this.lock = lock;
            this.componentInvocationContext = (ComponentInvocationContextImpl) resourceContainer.getResourceContext()
                .getComponentInvocationContext();
            localContext = new LocalContext();
        }
View Full Code Here


        assertEquals(recorder.getRecordedValue(), false);
    }

    @Test(timeOut = 1000 * 30)
    public void threadShouldSeeLocalContextValue() throws Exception {
        final LocalContext localContext = new LocalContext();
        InterruptedStatusRecorder recorder = new InterruptedStatusRecorder() {
            @Override
            public void run() {
                componentInvocationContext.setLocalContext(localContext);
                while (!componentInvocationContext.isInterrupted()) {
                    try {
                        Thread.sleep(SECONDS.toMillis(1));
                    } catch (InterruptedException e) {
                        break;
                    }
                }
                value = componentInvocationContext.isInterrupted();
            }
        };
        Thread thread = startRecorderThread(recorder);
        localContext.markInterrupted();
        thread.join();
        assertEquals(recorder.getRecordedValue(), true);
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.pc.component.ComponentInvocationContextImpl.LocalContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.