KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ejb > txtimer > EJBTimerService


1 /*
2  * JBoss, Home of Professional Open Source
3  * Copyright 2005, JBoss Inc., and individual contributors as indicated
4  * by the @authors tag. See the copyright.txt in the distribution for a
5  * full listing of individual contributors.
6  *
7  * This is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this software; if not, write to the Free
19  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21  */

22 package org.jboss.ejb.txtimer;
23
24 // $Id: EJBTimerService.java 38205 2005-11-17 22:16:37Z dimitris $
25

26 import javax.ejb.TimerService JavaDoc;
27 import javax.management.ObjectName JavaDoc;
28
29 import org.jboss.ejb.Container;
30 import org.jboss.mx.util.ObjectNameFactory;
31
32 /**
33  * A service that implements this interface provides a Tx aware EJBTimerService.
34  *
35  * @author Thomas.Diesler@jboss.org
36  * @author Dimitris.Andreadis@jboss.org
37  * @version $Revision: 38205 $
38  * @since 07-Apr-2004
39  */

40 public interface EJBTimerService
41 {
42    /**
43     * The default object name
44     */

45    static final ObjectName JavaDoc OBJECT_NAME = ObjectNameFactory.create("jboss.ejb:service=EJBTimerService");
46
47    /**
48     * Create a TimerService for a given containerId/pKey (TimedObjectId) that lives in a JBoss Container.
49     * The TimedObjectInvoker is constructed from the invokerClassName.
50     *
51     * @param containerId The string identifier for a class of TimedObjects
52     * @param pKey The primary key for an instance of a TimedObject, may be null
53     * @param container The Container that is associated with the TimerService
54     * @return the TimerService
55     */

56    TimerService JavaDoc createTimerService(ObjectName JavaDoc containerId, Object JavaDoc pKey, Container container) throws IllegalStateException JavaDoc;
57
58    /**
59     * Create a TimerService for a given containerId/pKey (TimedObjectId) that is invoked through the given invoker.
60     *
61     * @param containerId The string identifier for a class of TimedObjects
62     * @param pKey The primary key for an instance of a TimedObject, may be null
63     * @param invoker The TimedObjectInvoker
64     * @return the TimerService
65     */

66    TimerService JavaDoc createTimerService(ObjectName JavaDoc containerId, Object JavaDoc pKey, TimedObjectInvoker invoker) throws IllegalStateException JavaDoc;
67
68    /**
69     * Get the TimerService for a given containerId/pKey (TimedObjectId).
70     *
71     * @param containerId The string identifier for a class of TimedObjects
72     * @param pKey The primary key for an instance of a TimedObject, may be null
73     * @return The TimerService, or null if it does not exist
74     */

75    TimerService JavaDoc getTimerService(ObjectName JavaDoc containerId, Object JavaDoc pKey) throws IllegalStateException JavaDoc;
76
77    /**
78     * Remove the TimerService for a given containerId/pKey (TimedObjectId),
79     * along with any persisted timer information.
80     *
81     * This should be used for removing the TimerService and Timers
82     * associated with a particular entity bean, when it gets removed.
83     *
84     * @param containerId The string identifier for a class of TimedObjects
85     * @param pKey The primary key for an instance of a TimedObject, may be null
86     */

87    void removeTimerService(ObjectName JavaDoc containerId, Object JavaDoc pKey) throws IllegalStateException JavaDoc;
88    
89    /**
90     * Remove the TimerService for a given containerId.
91     *
92     * This should be used to remove the timer service and timers for
93     * any type of container (session, entity, message) at the time of
94     * undeployment.
95     *
96     * @param containerId The string identifier for a class of TimedObjects
97     * @param keepState Flag indicating whether timer persistent state should be kept or removed
98     */

99    void removeTimerService(ObjectName JavaDoc containerId, boolean keepState) throws IllegalStateException JavaDoc;
100    
101    /**
102     * Restore the persisted timers for a given ejb container
103     *
104     * @param containerId The ejb container id
105     * @param loader The classloader to use for loading the timers
106     */

107    void restoreTimers(ObjectName JavaDoc containerId, ClassLoader JavaDoc loader) throws IllegalStateException JavaDoc;
108    
109 }
110
Popular Tags