1 | try {↵ | | 1 | try {↵
|
2 | s = openSession();↵ | | 2 | s = openSession();↵
|
3 | txn = s.beginTransaction();↵ | | 3 | txn = s.beginTransaction();↵
|
4 | s.update(item);↵ | | 4 | s.update( item );↵
|
5 | txn.commit();↵ | | 5 | txn.commit();↵
|
6 | s.close();↵ | | |
|
7 | ↵ | | 6 | s.close();↵
|
8 | fail("expected stale write to fail");↵ | | 7 | fail( "expected stale write to fail" );↵
|
9 | } ↵ | | 8 | }↵
|
10 | catch (Throwable expected) {↵ | | 9 | catch( Throwable expected ) {↵
|
11 | // expected behavior here↵ | | 10 | // expected behavior here↵
|
12 | if (txn != null) {↵ | | 11 | if ( txn != null ) {↵
|
13 | try {↵ | | |
|
14 | txn.rollback();↵ | | |
|
15 | } ↵ | | 12 | try {↵
|
| | | 13 | txn.rollback();↵
|
| | | 14 | }↵
|
16 | catch (Throwable ignore) {↵ | | 15 | catch( Throwable ignore ) {↵
|
17 | }↵ | | |
|
18 | }↵ | | |
|
19 | } finally {↵ | | |
|
20 | ↵ | | 16 | }↵
|
| | | 17 | }↵
|
| | | 18 | }↵
|
| | | 19 | finally {↵
|
21 | if (s != null && s.isOpen()) {↵ | | 20 | if ( s != null && s.isOpen() ) {↵
|
22 | try {↵ | | |
|
23 | s.close();↵ | | |
|
24 | } ↵ | | 21 | try {↵
|
| | | 22 | s.close();↵
|
| | | 23 | }↵
|
25 | catch (Throwable ignore) {↵ | | 24 | catch( Throwable ignore ) {↵
|
26 | | | 25 |
|