Skip to content

Commit

Permalink
Removed transaction filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNavigateur committed Nov 8, 2011
1 parent 9749655 commit 79854f2
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 109 deletions.
10 changes: 5 additions & 5 deletions core/src/main/java/org/prevayler/implementation/Capsule.java
Expand Up @@ -50,15 +50,15 @@ public Object deserialize(Serializer journalSerializer) {
}

/**
* Executes a freshly deserialized copy of the transaction if this is being called via the royal food taster or if <code>configureTransactionDeepCopy</code> wasn't set to <code>false</code> on your <code>PrevaylerFactory</code>. Otherwise, this will execute the transaction directly. The execution will synchronize on the prevalentSystem.
* Executes a freshly deserialized copy of the transaction by default. If <code>configureTransactionDeepCopy</code> was set to <code>true</code> on your <code>PrevaylerFactory</code>, this will execute the transaction directly. The execution will synchronize on the prevalentSystem.
*/
public void executeOn(Object prevalentSystem, Date executionTime, Serializer journalSerializer, boolean guaranteeTransactionDeepCopy) {
public void executeOn(Object prevalentSystem, Date executionTime, Serializer journalSerializer) {
Object transaction;
if(guaranteeTransactionDeepCopy || _transaction == null){
transaction = deserialize(journalSerializer);
if(_transaction != null){
transaction = _transaction;
}
else{
transaction = _transaction;
transaction = deserialize(journalSerializer);
}

synchronized (prevalentSystem) {
Expand Down
Expand Up @@ -20,7 +20,6 @@ public class PrevalentSystemGuard<P> implements TransactionSubscriber {
private long _systemVersion; // All access is synchronized on "this"
private boolean _ignoreRuntimeExceptions; // All access is synchronized on "this"
private final Serializer _journalSerializer;
private boolean _guaranteeTransactionDeepCopy = false;

public PrevalentSystemGuard(P prevalentSystem, long systemVersion, Serializer journalSerializer) {
_prevalentSystem = prevalentSystem;
Expand All @@ -37,10 +36,6 @@ public P prevalentSystem() {
return _prevalentSystem;
}
}

public void guaranteeTransactionDeepCopy(){
_guaranteeTransactionDeepCopy = true;
}

public void subscribeTo(TransactionPublisher publisher) throws IOException, ClassNotFoundException {
long initialTransaction;
Expand Down Expand Up @@ -76,7 +71,7 @@ public void receive(TransactionTimestamp transactionTimestamp) {
try {
// Don't synchronize on _prevalentSystem here so that the capsule can deserialize a fresh
// copy of the transaction without blocking queries.
capsule.executeOn(_prevalentSystem, executionTime, _journalSerializer, _guaranteeTransactionDeepCopy);
capsule.executeOn(_prevalentSystem, executionTime, _journalSerializer);
} catch (RuntimeException rx) {
if (!_ignoreRuntimeExceptions) throw rx; //TODO Guarantee that transactions received from pending transaction recovery don't ever throw RuntimeExceptions. Maybe use a wrapper for that.
} catch (Error error) {
Expand Down
Expand Up @@ -12,14 +12,12 @@
import org.prevayler.implementation.TransactionTimestamp;
import org.prevayler.implementation.clock.PausableClock;
import org.prevayler.implementation.journal.Journal;
import org.prevayler.implementation.publishing.censorship.TransactionCensor;

import java.io.IOException;

public class CentralPublisher extends AbstractPublisher {

private final PausableClock _pausableClock;
private final TransactionCensor _censor;
private final Journal _journal;

private volatile int _pendingPublications = 0;
Expand All @@ -30,11 +28,10 @@ public class CentralPublisher extends AbstractPublisher {
private final Object _nextTurnMonitor = new Object();


public CentralPublisher(Clock clock, TransactionCensor censor, Journal journal) {
public CentralPublisher(Clock clock, Journal journal) {
super(new PausableClock(clock));
_pausableClock = (PausableClock) _clock; //This is just to avoid casting the inherited _clock every time.

_censor = censor;
_journal = journal;
}

Expand Down Expand Up @@ -69,9 +66,7 @@ private TransactionGuide approve(Capsule capsule) {
synchronized (_nextTurnMonitor) {
TransactionTimestamp timestamp = new TransactionTimestamp(capsule, _nextTransaction, _pausableClock.realTime());

_censor.approve(timestamp);

// Only count this transaction once approved.
// Count this transaction
Turn turn = _nextTurn;
_nextTurn = _nextTurn.next();
_nextTransaction++;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 79854f2

Please sign in to comment.