01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.objectserver.persistence.impl;
05:
06: import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
07:
08: import com.tc.exception.TCRuntimeException;
09: import com.tc.objectserver.persistence.api.PersistenceTransaction;
10: import com.tc.objectserver.persistence.api.PersistenceTransactionProvider;
11:
12: public final class TestPersistenceTransactionProvider implements
13: PersistenceTransactionProvider {
14:
15: public final LinkedQueue nullTransactionContexts = new LinkedQueue();
16: public final LinkedQueue newTransactions = new LinkedQueue();
17:
18: public PersistenceTransaction newTransaction() {
19: try {
20: PersistenceTransaction rv = new TestPersistenceTransaction();
21: newTransactions.put(rv);
22: return rv;
23: } catch (Exception e) {
24: throw new TCRuntimeException(e);
25: }
26: }
27:
28: public PersistenceTransaction nullTransaction() {
29: try {
30: nullTransactionContexts.put(new Object());
31: } catch (InterruptedException e) {
32: throw new TCRuntimeException(e);
33: }
34: return TestPersistenceTransaction.NULL_TRANSACTION;
35: }
36:
37: }
|