01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * 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: PersistencePolicy.java 57209 2006-09-26 12:21:57Z dimitris@jboss.org $
25:
26: import java.io.Serializable;
27: import java.util.Date;
28: import java.util.List;
29:
30: import javax.management.ObjectName;
31:
32: /**
33: * Timers are persistent objects. In the event of a container crash, any single-event timers that have expired
34: * during the intervening time before container restart must cause the ejbTimeout method to be invoked
35: * upon restart. Any interval timers that have expired during the intervening time must cause the ejb-
36: * Timeout method to be invoked at least once upon restart.
37: *
38: * @author Thomas.Diesler@jboss.org
39: * @author Dimitris.Andreadis@jboss.org
40: * @version $Revision: 57209 $
41: * @since 09-Sep-2004
42: */
43: public interface PersistencePolicy {
44: /**
45: * Inserts a timer into persistent storage.
46: *
47: * @param timerId The timer id
48: * @param targetId The timed object id
49: * @param firstEvent The point in time at which the first txtimer expiration must occur.
50: * @param periode The number of milliseconds that must elapse between txtimer expiration notifications.
51: * @param info A serializable handback object.
52: */
53: void insertTimer(String timerId, TimedObjectId targetId,
54: Date firstEvent, long periode, Serializable info);
55:
56: /**
57: * Deletes a timer from persistent storage.
58: *
59: * @param timerId The timer id
60: * @param timedObjectId The id of the timed object
61: */
62: void deleteTimer(String timerId, TimedObjectId timedObjectId);
63:
64: /**
65: * List the persisted timer handles for a particular container
66: *
67: * @param containerId The Container ObjectName
68: * @param loader The ClassLoader to use for loading the handles
69: * @return a list of TimerHandleImpl objects
70: */
71: List listTimerHandles(ObjectName containerId, ClassLoader loader);
72:
73: /**
74: * List all the persisted timer handles
75: *
76: * @return a list of TimerHandleImpl objects
77: */
78: List listTimerHandles();
79:
80: /**
81: * Clear the persisted timers
82: */
83: void clearTimers();
84:
85: }
|