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.vm;
20
21 import javax.transaction.TransactionManager;
22
23 import edu.emory.mathcs.backport.java.util.concurrent.Executor;
24
25 import org.apache.geronimo.gbean.GBeanInfo;
26 import org.apache.geronimo.gbean.GBeanInfoBuilder;
27 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
28 import org.apache.geronimo.timer.PersistentTimer;
29 import org.apache.geronimo.timer.ThreadPooledTimer;
30 import org.apache.geronimo.timer.TransactionalExecutorTaskFactory;
31
32 /**
33 * @version $Rev: 470597 $ $Date: 2006-11-02 15:30:55 -0800 (Thu, 02 Nov 2006) $
34 */
35 public class VMStoreThreadPooledTransactionalTimer extends ThreadPooledTimer {
36
37 public VMStoreThreadPooledTransactionalTimer(int repeatCount,
38 TransactionManager transactionManager,
39 Executor threadPool) {
40 super(new TransactionalExecutorTaskFactory(transactionManager, repeatCount),
41 new VMWorkerPersistence(), threadPool, transactionManager);
42 }
43
44
45 public static final GBeanInfo GBEAN_INFO;
46
47 static {
48 GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(VMStoreThreadPooledTransactionalTimer.class);
49 infoFactory.addInterface(PersistentTimer.class);
50
51 infoFactory.addAttribute("repeatCount", int.class, true);
52 infoFactory.addReference("TransactionManager", TransactionManager.class, NameFactory.TRANSACTION_MANAGER);
53 infoFactory.addReference("ThreadPool", Executor.class, NameFactory.GERONIMO_SERVICE);
54
55 infoFactory.setConstructor(new String[] {"repeatCount", "TransactionManager", "ThreadPool"});
56 GBEAN_INFO = infoFactory.getBeanInfo();
57 }
58
59 public static GBeanInfo getGBeanInfo() {
60 return GBEAN_INFO;
61 }
62 }