1 /** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one or more 4 * contributor license agreements. See the NOTICE file distributed with 5 * this work for additional information regarding copyright ownership. 6 * The ASF licenses this file to You under the Apache License, Version 2.0 7 * (the "License"); you may not use this file except in compliance with 8 * the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package org.apache.geronimo.timer.jdbc; 20 21 import java.sql.SQLException; 22 import javax.sql.DataSource; 23 import javax.transaction.TransactionManager; 24 25 import edu.emory.mathcs.backport.java.util.concurrent.Executor; 26 27 import org.apache.geronimo.connector.outbound.ConnectionFactorySource; 28 import org.apache.geronimo.gbean.GBeanInfo; 29 import org.apache.geronimo.gbean.GBeanInfoBuilder; 30 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; 31 import org.apache.geronimo.kernel.Kernel; 32 import org.apache.geronimo.timer.NontransactionalExecutorTaskFactory; 33 import org.apache.geronimo.timer.PersistentTimer; 34 import org.apache.geronimo.timer.ThreadPooledTimer; 35 36 /** 37 * @version $Rev: 470597 $ $Date: 2006-11-02 15:30:55 -0800 (Thu, 02 Nov 2006) $ 38 */ 39 public class JDBCStoreThreadPooledNonTransactionalTimer extends ThreadPooledTimer { 40 41 public JDBCStoreThreadPooledNonTransactionalTimer(ConnectionFactorySource managedConnectionFactoryWrapper, 42 TransactionManager transactionManager, 43 Executor threadPool, 44 Kernel kernel) throws SQLException { 45 super(new NontransactionalExecutorTaskFactory(), 46 new JDBCWorkerPersistence(kernel.getKernelName(), (DataSource)managedConnectionFactoryWrapper.$getResource(), false), threadPool, transactionManager); 47 } 48 49 50 public static final GBeanInfo GBEAN_INFO; 51 52 static { 53 GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(JDBCStoreThreadPooledNonTransactionalTimer.class); 54 infoFactory.addInterface(PersistentTimer.class); 55 56 infoFactory.addReference("ManagedConnectionFactoryWrapper", ConnectionFactorySource.class, NameFactory.JCA_MANAGED_CONNECTION_FACTORY); 57 infoFactory.addReference("ThreadPool", Executor.class, NameFactory.GERONIMO_SERVICE); 58 infoFactory.addReference("TransactionManager", TransactionManager.class, NameFactory.TRANSACTION_MANAGER); 59 60 infoFactory.addAttribute("kernel", Kernel.class, false); 61 62 infoFactory.setConstructor(new String[]{"ManagedConnectionFactoryWrapper", "TransactionManager", "ThreadPool", "kernel"}); 63 GBEAN_INFO = infoFactory.getBeanInfo(); 64 } 65 66 public static GBeanInfo getGBeanInfo() { 67 return GBEAN_INFO; 68 } 69 }