org.prevayler.contrib.facade
Interface TransactionHint

All Superinterfaces:
Serializable

public interface TransactionHint
extends Serializable

A TransactionHint contains hints of other things to do inside the transaction. For instance, set a timestamp or call some specified method from within the Prevayler transaction. Basically, this allows for a generic way to specify actions internal to the Prevayler transaction, with full knowledge of being within the context of the Prevayler transaction, all without hardcoding anything in the generic proxy transactions. Methods that are transactionally proxied don't (and shouldn't) really realize they are part of a transaction so they can't take advantage of certain contextual info such as the Prevayler-managed Date object that is passed to each transaction. This class provides access to that context.

Currently there exists only a preExecute() method which executes immediately before the transactionally proxied method is invoked. It might be legitimate to add a postExecute() method, but I haven't found the need for it yet, so I didn't add it.

Caveat:

Could make for non-deterministic behavior if each time the app is started, it has a different transaction hint defined; maybe one set of transactions gets timestamped, but then another set doesn't. Is this acceptable?

Answer:

Well, the same could be said of hard coded transactions. Transactions could be modified internally, recompiled, and re-run without the application knowing the difference. The only difference here is the externalization of the issue to a method separate from the transactionally proxied method itself. Might not be a real issue?

Since:
0_2
Author:
Jacob Kjome [hoju@visi.com]

Field Summary
static TransactionHint NOOP_TRANSACTION_HINT
          A default empty transaction hint which should be used if no other transaction hint is specified
 
Method Summary
 void preExecute(Object p_prevalentSystem, Method p_method, Object[] p_args, Date p_timestamp)
          This method executes just before the transactional method is invoked, so it is a good place to put any generic code that needs to be executed before any transaction
 

Field Detail

NOOP_TRANSACTION_HINT

static final TransactionHint NOOP_TRANSACTION_HINT
A default empty transaction hint which should be used if no other transaction hint is specified

Method Detail

preExecute

void preExecute(Object p_prevalentSystem,
                Method p_method,
                Object[] p_args,
                Date p_timestamp)
                throws Exception
This method executes just before the transactional method is invoked, so it is a good place to put any generic code that needs to be executed before any transaction

Throws:
Exception


Copyright © 2001-2013. All Rights Reserved.