Package javax.resource.spi.work

Examples of javax.resource.spi.work.WorkException


        try
        {
            work.workAccepted(this);
            workExecutor.doExecute(work, workExecutorService);
            WorkException exception = work.getWorkException();
            if (null != exception)
            {
                throw exception;
            }
        }
View Full Code Here


    @Test
    public void untracksWorkOnDoWorkException() throws Exception
    {
        Work work = mock(Work.class);
        doThrow(new WorkException()).when(delegateWorkManager).doWork(work);

        try
        {
            trackingWorkManager.doWork(work);
            expectedExceptionFail();
View Full Code Here

        Work work = mock(Work.class);
        int startTimeout = 10;
        ExecutionContext execContext = mock(ExecutionContext.class);
        WorkListener workListener = mock(WorkListener.class);

        doThrow(new WorkException()).when(delegateWorkManager).doWork(work, startTimeout, execContext, workListener);

        try
        {
            trackingWorkManager.doWork(work, startTimeout, execContext, workListener);
            expectedExceptionFail();
View Full Code Here

    @Test
    public void untracksWorkOnStartWorkException() throws Exception
    {
        final Work work = mock(Work.class);

        doThrow(new WorkException()).when(delegateWorkManager).startWork(Matchers.<Work>any());

        try
        {
            trackingWorkManager.startWork(work);
            expectedExceptionFail();
View Full Code Here

        final Work work = mock(Work.class);
        long startTimeout = 0;
        ExecutionContext execContext = mock(ExecutionContext.class);
        WorkListener workListener = mock(WorkListener.class);

        doThrow(new WorkException()).when(delegateWorkManager).startWork(Matchers.<Work>any(), eq(startTimeout), eq(execContext), Matchers.<WorkListener>any());

        try
        {
            trackingWorkManager.startWork(work, startTimeout, execContext, workListener);
            expectedExceptionFail();
View Full Code Here

    @Test
    public void untracksWorkOnSchedulingWorkException() throws Exception
    {
        final Work work = mock(Work.class);

        doThrow(new WorkException()).when(delegateWorkManager).scheduleWork(Matchers.<Work>any());

        try
        {
            trackingWorkManager.scheduleWork(work);
            expectedExceptionFail();
View Full Code Here

        final Work work = mock(Work.class);
        long startTimeout = 0;
        ExecutionContext execContext = mock(ExecutionContext.class);
        WorkListener workListener = mock(WorkListener.class);

        doThrow(new WorkException()).when(delegateWorkManager).scheduleWork(Matchers.<Work>any(), eq(startTimeout), eq(execContext), Matchers.<WorkListener>any());

        try
        {
            trackingWorkManager.scheduleWork(work, startTimeout, execContext, workListener);
            expectedExceptionFail();
View Full Code Here

     */
    public void executeWork(WorkerContext work) throws WorkException {
        work.workAccepted(this);
        try {
            doExecute(work);
            WorkException exception = work.getWorkException();
            if (null != exception) {
                throw exception;
            }
        } catch (InterruptedException e) {
            WorkCompletedException wcj = new WorkCompletedException(
View Full Code Here

     */
    private void executeWork(WorkerContext work, WorkExecutor workExecutor, Executor pooledExecutor) throws WorkException {
        work.workAccepted(this);
        try {
            workExecutor.doExecute(work, pooledExecutor);
            WorkException exception = work.getWorkException();
            if (null != exception) {
                throw exception;
            }
        } catch (InterruptedException e) {
            WorkCompletedException wcj = new WorkCompletedException(
View Full Code Here

        if (workType == DO) {
            // wait for completion
            try {
                worker.waitForCompletion();
            } catch (InterruptedException e) {
                WorkException workException = new WorkException("Work submission thread was interrupted", e);
                workException.setErrorCode(INTERNAL);
                throw workException;
            }

            // if work threw an exception, rethrow it
            WorkException workCompletedException = worker.getWorkException();
            if (workCompletedException != null) {
                throw workCompletedException;
            }
        } else if (workType == START) {
            // wait for work to start
            try {
                worker.waitForStart();
            } catch (InterruptedException e) {
                WorkException workException = new WorkException("Work submission thread was interrupted", e);
                workException.setErrorCode(INTERNAL);
                throw workException;
            }

            // if work threw a rejection exception, rethrow it (it is the exception for timeout)
            WorkException workCompletedException = worker.getWorkException();
            if (workCompletedException instanceof WorkRejectedException) {
                throw workCompletedException;
            }
        }
View Full Code Here

TOP

Related Classes of javax.resource.spi.work.WorkException

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.