public class SpliceTransactionFactory extends java.lang.Object implements ModuleControl, ModuleSupportable
Modifier and Type | Field and Description |
---|---|
protected ContextService |
contextFactory |
protected DataValueFactory |
dataValueFactory |
protected FileResource |
fileHandler |
protected HBaseStore |
hbaseStore |
protected SpliceLockFactory |
lockFactory |
protected static java.lang.String |
NESTED_READONLY_USER_CONTEXT_ID |
protected StorageFactory |
storageFactory |
protected static java.lang.String |
USER_CONTEXT_ID |
Constructor and Description |
---|
SpliceTransactionFactory() |
Modifier and Type | Method and Description |
---|---|
void |
boot(boolean create,
java.util.Properties properties)
Boot this module with the given properties.
|
boolean |
canSupport(java.util.Properties properties)
See if this implementation can support any attributes that are listed in properties.
|
Transaction |
findUserTransaction(HBaseStore hbaseStore,
ContextManager contextMgr,
java.lang.String transName)
Find or create a user-level transaction.
|
FileResource |
getFileHandler() |
LockFactory |
getLockFactory() |
java.lang.Object |
getXAResourceManager() |
Transaction |
marshalTransaction(java.lang.String transName,
TxnView txn)
place a transaction which was created outside of derby (e.g.
|
protected SpliceTransaction |
startCommonTransaction(HBaseStore hbaseStore,
ContextManager contextMgr,
DataValueFactory dataValueFactory,
java.lang.String transName,
boolean abortAll,
java.lang.String contextName)
Start a new transaction.
|
protected SpliceTransaction |
startNestedTransaction(HBaseStore hbaseStore,
ContextManager contextMgr,
DataValueFactory dataValueFactory,
java.lang.String transName,
boolean abortAll,
java.lang.String contextName,
boolean additive,
TxnView parentTxn) |
Transaction |
startNestedTransaction(HBaseStore hbaseStore,
ContextManager contextMgr,
TxnView parentTxn)
Start a "nested" transaction.
|
Transaction |
startTransaction(HBaseStore hbaseStore,
ContextManager contextMgr,
java.lang.String transName)
Starts a new transaction with the given name.
|
void |
stop()
Stop the module.
|
protected static final java.lang.String USER_CONTEXT_ID
protected static final java.lang.String NESTED_READONLY_USER_CONTEXT_ID
protected SpliceLockFactory lockFactory
protected DataValueFactory dataValueFactory
protected ContextService contextFactory
protected HBaseStore hbaseStore
protected StorageFactory storageFactory
protected FileResource fileHandler
public LockFactory getLockFactory()
public java.lang.Object getXAResourceManager() throws StandardException
StandardException
public Transaction marshalTransaction(java.lang.String transName, TxnView txn) throws StandardException
transName
- the name of the transactiontxn
- the transaction to marshallStandardException
- if something goes wrong (which it isn't super likely to do)public Transaction startTransaction(HBaseStore hbaseStore, ContextManager contextMgr, java.lang.String transName) throws StandardException
hbaseStore
- the hbase store relevant to the transactioncontextMgr
- the context managertransName
- the name of the transactionStandardException
- if something goes wrong creating the transactionpublic Transaction startNestedTransaction(HBaseStore hbaseStore, ContextManager contextMgr, TxnView parentTxn) throws StandardException
hbaseStore
- the hbase store relevant to the transactioncontextMgr
- the context managerparentTxn
- the parent transactionStandardException
- if something goes wrongpublic Transaction findUserTransaction(HBaseStore hbaseStore, ContextManager contextMgr, java.lang.String transName) throws StandardException
hbaseStore
- the hbase store relevant to the transactioncontextMgr
- the context managertransName
- the name of the transactionStandardException
- if something goes wrongprotected final SpliceTransaction startNestedTransaction(HBaseStore hbaseStore, ContextManager contextMgr, DataValueFactory dataValueFactory, java.lang.String transName, boolean abortAll, java.lang.String contextName, boolean additive, TxnView parentTxn)
protected final SpliceTransaction startCommonTransaction(HBaseStore hbaseStore, ContextManager contextMgr, DataValueFactory dataValueFactory, java.lang.String transName, boolean abortAll, java.lang.String contextName)
public boolean canSupport(java.util.Properties properties)
ModuleSupportable
The module can check for attributes in the properties to
see if it can fulfill the required behaviour. E.g. the raw
store may define an attribute called RawStore.Recoverable.
If a temporary raw store is required the property RawStore.recoverable=false
would be added to the properties before calling bootServiceModule. If a
raw store cannot support this attribute its canSupport method would
return null. Also see the Monitor class's prologue to see how the
identifier is used in looking up properties.
Actually a better way maybe to have properties of the form
RawStore.Attributes.mandatory=recoverable,smallfootprint and
RawStore.Attributes.requested=oltp,fast
canSupport
in interface ModuleSupportable
public void boot(boolean create, java.util.Properties properties) throws StandardException
ModuleControl
An implementation's boot method can throw StandardException. If it is thrown the module is not registered by the monitor and therefore cannot be found through a findModule(). In this case the module's stop() method is not called, thus throwing this exception must free up any resources.
When create is true the contents of the properties object
will be written to the service.properties of the persistent
service. Thus any code that requires an entry in service.properties
must explicitly place the value in this properties set
using the put method.
Typically the properties object contains one or more default
properties sets, which are not written out to service.properties.
These default sets are how callers modify the create process. In a
JDBC connection database create the first set of defaults is a properties
object that contains the attributes that were set on the jdbc:splice: URL.
This attributes properties set has the second default properties set as
its default. This set (which could be null) contains the properties
that the user set on their DriverManager.getConnection() call, and are thus
not owned by Derby code, and thus must not be modified by Derby
code.
When create is false the properties object contains all the properties set in the service.properties file plus a limited number of attributes from the JDBC URL attributes or connection properties set. This avoids properties set by the user compromising the boot process. An example of a property passed in from the JDBC world is the bootPassword for encrypted databases.
Code should not hold onto the passed in properties reference after boot time as its contents may change underneath it. At least after the complete boot is completed, the links to all the default sets will be removed.
boot
in interface ModuleControl
StandardException
- Module cannot be started.Monitor
,
ModuleFactory
public void stop()
ModuleControl
stop
in interface ModuleControl
Monitor
,
ModuleFactory
public FileResource getFileHandler()