01: /*
02: * Copyright 2001-2006 C:1 Financial Services GmbH
03: *
04: * This software is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License Version 2.1, as published by the Free Software Foundation.
07: *
08: * This software is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11: * Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public
14: * License along with this library; if not, write to the Free Software
15: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
16: */
17:
18: package de.finix.contelligent.core;
19:
20: /**
21: * This interface is an internally used version of
22: * {@link javax.transaction.Synchronization}. Only one real
23: * <code>Synchronization</code> instance gets registered with the
24: * TransactionManager and then calls every <code>TxSynchronization</code>
25: * instance in the order they were registered. The {@link #beforeCompletion}
26: * methods are called in order and the {@link #afterCompletion} methods in the
27: * reverse order of registration. <BR>
28: * <B>Note: registering is not implemented at the moment, invocation of
29: * TxSynchronization instances is hard-coded in {@link ContelligentImpl}.</B>
30: */
31: public interface TxSynchronization {
32:
33: /**
34: * Gets called prior to the start of the transaction completion process. If
35: * this method throws an exception or returns false the transaction will be
36: * rolled back.
37: *
38: * @return a boolean value indicating success or failure
39: * @exception Exception
40: * if any error occurs
41: * @see javax.transaction.Synchronization#beforeCompletion
42: */
43: boolean beforeCompletion() throws Exception;
44:
45: /**
46: * Gets called after the transaction is committed or rolled back.
47: *
48: * @param status -
49: * The status of the transaction completion.
50: * @see javax.transaction.Synchronization#afterCompletion
51: */
52: void afterCompletion(int status);
53:
54: /**
55: * Gets called in any case after beforeCompletion/afterCompletion or in case
56: * of an error.
57: */
58: void clean();
59: }
|