01: /*
02: * $Id: StartWorkExecutor.java 10489 2008-01-23 17:53:38Z dfeist $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
10:
11: /**
12: *
13: * Copyright 2004 The Apache Software Foundation
14: *
15: * Licensed under the Apache License, Version 2.0 (the "License");
16: * you may not use this file except in compliance with the License.
17: * You may obtain a copy of the License at
18: *
19: * http://www.apache.org/licenses/LICENSE-2.0
20: *
21: * Unless required by applicable law or agreed to in writing, software
22: * distributed under the License is distributed on an "AS IS" BASIS,
23: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24: * See the License for the specific language governing permissions and
25: * limitations under the License.
26: */package org.mule.work;
27:
28: import org.mule.api.work.WorkExecutor;
29: import org.mule.util.concurrent.Latch;
30:
31: import javax.resource.spi.work.WorkException;
32:
33: import edu.emory.mathcs.backport.java.util.concurrent.Executor;
34:
35: public class StartWorkExecutor implements WorkExecutor {
36:
37: public void doExecute(WorkerContext work, Executor executor)
38: throws WorkException, InterruptedException {
39: Latch latch = work.provideStartLatch();
40: executor.execute(work);
41: latch.await();
42: }
43:
44: }
|