01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.timer.vm;
17:
18: import javax.transaction.TransactionManager;
19:
20: import java.util.concurrent.Executor;
21:
22: import org.apache.geronimo.gbean.GBeanInfo;
23: import org.apache.geronimo.gbean.GBeanInfoBuilder;
24: import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
25: import org.apache.geronimo.timer.PersistentTimer;
26: import org.apache.geronimo.timer.ThreadPooledTimer;
27: import org.apache.geronimo.timer.TransactionalExecutorTaskFactory;
28:
29: /**
30: * @version $Rev: 589853 $ $Date: 2007-10-29 13:54:35 -0700 (Mon, 29 Oct 2007) $
31: */
32: public class VMStoreThreadPooledTransactionalTimer extends
33: ThreadPooledTimer {
34:
35: public VMStoreThreadPooledTransactionalTimer(int repeatCount,
36: TransactionManager transactionManager, Executor threadPool) {
37: super (new TransactionalExecutorTaskFactory(transactionManager,
38: repeatCount), new VMWorkerPersistence(), threadPool,
39: transactionManager);
40: }
41:
42: public static final GBeanInfo GBEAN_INFO;
43:
44: static {
45: GBeanInfoBuilder infoFactory = GBeanInfoBuilder
46: .createStatic(VMStoreThreadPooledTransactionalTimer.class);
47: infoFactory.addInterface(PersistentTimer.class);
48:
49: infoFactory.addAttribute("repeatCount", int.class, true);
50: infoFactory.addReference("TransactionManager",
51: TransactionManager.class, NameFactory.JTA_RESOURCE);
52: infoFactory.addReference("ThreadPool", Executor.class,
53: NameFactory.GERONIMO_SERVICE);
54:
55: infoFactory.setConstructor(new String[] { "repeatCount",
56: "TransactionManager", "ThreadPool" });
57: GBEAN_INFO = infoFactory.getBeanInfo();
58: }
59:
60: public static GBeanInfo getGBeanInfo() {
61: return GBEAN_INFO;
62: }
63: }
|