1 5 package org.prevayler.implementation; 6 7 import java.util.Date ; 8 9 import org.prevayler.*; 10 11 12 class TransactionWithQueryExecuter implements Transaction { 13 14 static final long serialVersionUID = 0L; 15 16 private TransactionWithQuery _delegate; 17 18 private transient Object _result; 19 private transient Exception _exception; 20 21 22 private TransactionWithQueryExecuter() {} TransactionWithQueryExecuter(TransactionWithQuery transactionWithQuery) { 24 _delegate = transactionWithQuery; 25 } 26 27 public final void executeOn(Object prevalentSystem, Date timestamp) { 28 try { 29 _result = _delegate.executeAndQuery(prevalentSystem, timestamp); 30 } catch (RuntimeException rx) { 31 throw rx; } catch (Exception ex) { 33 _exception = ex; 34 } 35 } 36 37 Object result() throws Exception { 38 if (_exception != null) throw _exception; 39 return _result; 40 } 41 42 } | Popular Tags |