KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > objectserver > persistence > impl > TestPersistenceTransactionProvider


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.objectserver.persistence.impl;
5
6 import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
7
8 import com.tc.exception.TCRuntimeException;
9 import com.tc.objectserver.persistence.api.PersistenceTransaction;
10 import com.tc.objectserver.persistence.api.PersistenceTransactionProvider;
11
12 public final class TestPersistenceTransactionProvider implements PersistenceTransactionProvider {
13   
14   public final LinkedQueue nullTransactionContexts = new LinkedQueue();
15   public final LinkedQueue newTransactions = new LinkedQueue();
16
17   public PersistenceTransaction newTransaction() {
18     try {
19       PersistenceTransaction rv = new TestPersistenceTransaction();
20       newTransactions.put(rv);
21       return rv;
22     } catch (Exception JavaDoc e) {
23       throw new TCRuntimeException(e);
24     }
25   }
26   
27   public PersistenceTransaction nullTransaction() {
28     try {
29       nullTransactionContexts.put(new Object JavaDoc());
30     } catch (InterruptedException JavaDoc e) {
31       throw new TCRuntimeException(e);
32     }
33     return TestPersistenceTransaction.NULL_TRANSACTION;
34   }
35
36 }
Popular Tags