diff --git a/openjpa-kernel/src/main/java/com/ibm/wsspi/uow/UOWAction.java b/openjpa-kernel/src/main/java/com/ibm/wsspi/uow/UOWAction.java deleted file mode 100644 index d2c1951eb..000000000 --- a/openjpa-kernel/src/main/java/com/ibm/wsspi/uow/UOWAction.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.ibm.wsspi.uow; - -/** - * This is a clean room re-implementation of the IBM UOWAction API from the existing bytecode API. - * This will not be shipped in any distribution but excluded from the packaged JAR file. - * It purely exists for compiling against it. - * - * @author Mark Struberg - */ -public interface UOWAction { - void run() throws Exception; -} diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/ee/WASRegistryManagedRuntime.java b/openjpa-kernel/src/main/java/org/apache/openjpa/ee/WASRegistryManagedRuntime.java index 57cc1a193..527d12b2a 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/ee/WASRegistryManagedRuntime.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/ee/WASRegistryManagedRuntime.java @@ -19,33 +19,21 @@ package org.apache.openjpa.ee; import com.ibm.wsspi.uow.UOWAction; - -import java.lang.reflect.Method; +import com.ibm.wsspi.uow.UOWManager; +import com.ibm.wsspi.uow.UOWManagerFactory; /** * WASRegistryManagedRuntime provides WebSphere specific extensions to - * {@link RegistryManagedRuntime}. Currently these extensions consist of using - * the WebSphere UOWManager interface to submit non transactional work. + * {@link RegistryManagedRuntime}. Currently, these extensions consist of using + * the WebSphere UOWManager interface to submit non-transactional work. */ public class WASRegistryManagedRuntime extends RegistryManagedRuntime { // value taken from com.ibm.websphere.uow.UOWSynchronizationRegistry private static final int WEBSPHERE_UOW_TYPE_LOCAL_TRANSACTION = 0; - private final Method getUOWManager; - private final Method runUnderUOW; public WASRegistryManagedRuntime() { - try { - Class classUOWManagerFactory = Class.forName("com.ibm.wsspi.uow.UOWManagerFactory"); - getUOWManager = classUOWManagerFactory.getMethod("getUOWManager"); - - Class classUOWManager = Class.forName("com.ibm.wsspi.uow.UOWManager"); - runUnderUOW = classUOWManager.getMethod("runUnderUOW", new Class[]{int.class, boolean.class, UOWAction.class}); - } - catch (Exception e) { - throw new RuntimeException("Problem while creating WASManagedRuntime", e); - } } /** @@ -55,13 +43,10 @@ public class WASRegistryManagedRuntime extends RegistryManagedRuntime { *

*/ @Override - public void doNonTransactionalWork(Runnable runnable) - throws RuntimeException, UnsupportedOperationException { + public void doNonTransactionalWork(Runnable runnable) throws RuntimeException { try { - Object uowManager = getUOWManager.invoke(null); - - runUnderUOW.invoke(uowManager, WEBSPHERE_UOW_TYPE_LOCAL_TRANSACTION, false, new DelegatingUOWAction(runnable)); - + UOWManager uowManager = UOWManagerFactory.getUOWManager(); + uowManager.runUnderUOW(WEBSPHERE_UOW_TYPE_LOCAL_TRANSACTION, false, new DelegatingUOWAction(runnable)); } catch(Exception e ) { RuntimeException re = new RuntimeException(e.getMessage(), e);