public class DelegateTransactionService extends Object implements IDistributedTransactionService
ITransactionService.| Constructor and Description |
|---|
DelegateTransactionService(IDistributedTransactionService proxy) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(long tx)
Request abort of the transaction write set.
|
long |
commit(long tx)
Request commit of the transaction write set.
|
boolean |
committed(long tx,
UUID dataService)
Sent by a task participating in a distributed commit of a transaction
when the task has successfully committed the write set of the transaction
on the live journal of the local
IDataService. |
void |
declareResources(long tx,
UUID dataService,
String[] resource)
An
IDataService MUST invoke this method before permitting an
operation isolated by a read-write transaction to execute with access to
the named resources (this applies only to distributed databases). |
void |
destroy()
Destroy the service.
|
String |
getHostname()
The host on which this service is running.
|
long |
getLastCommitTime()
Return the last commitTime reported to the
ITransactionService. |
long |
getReleaseTime()
Return the timestamp whose historical data MAY be released.
|
Class |
getServiceIface()
Return the most interesting interface for the service.
|
String |
getServiceName()
Return name by which a user might recognize this service.
|
UUID |
getServiceUUID()
The unique identifier for this service.
|
long |
newTx(long timestamp)
Create a new transaction.
|
long |
nextTimestamp()
Return the next unique timestamp.
|
void |
notifyCommit(long commitTime)
Notify the
ITransactionService that a commit has been performed
with the given timestamp (which it assigned) and that it should update
its lastCommitTime iff the given commitTime is GT its current
lastCommitTime. |
long |
prepared(long tx,
UUID dataService)
Callback by an
IDataService participating in a two phase commit
for a distributed transaction. |
public DelegateTransactionService(IDistributedTransactionService proxy)
public UUID getServiceUUID() throws IOException
IService
Note: Some service discovery frameworks (Jini) will assign the service a
UUID asynchronously after a new service starts, in which case
this method will return null until the service
UUID has been assigned.
getServiceUUID in interface IServiceIOException - since you can use this method with RMI.public String getServiceName() throws IOException
IServicegetServiceName in interface IServiceIOException - since you can use this method with RMI.public Class getServiceIface() throws IOException
IServicegetServiceIface in interface IServiceIOException - since you can use this method with RMI.public String getHostname() throws IOException
IServicegetHostname in interface IServiceIOException - since you can use this method with RMI.public void destroy()
throws RemoteException
IServiceDestroyAdmin#destroy().destroy in interface IServiceRemoteExceptionpublic long nextTimestamp()
throws IOException
ITimestampServiceNote: This method MUST return strictly increasing values, even when it is invoked by concurrent threads. While other implementations are possible and may be more efficient, one way to insure thread safety is to synchronize on some object such that the implementaiton exhibits a FIFO behavior.
nextTimestamp in interface ITimestampServiceIOException - if there is an RMI problem.TimestampServiceUtil.nextTimestamp(ITimestampService)public long prepared(long tx,
UUID dataService)
throws IOException,
InterruptedException,
BrokenBarrierException
IDistributedTransactionServiceIDataService participating in a two phase commit
for a distributed transaction. The ITransactionService will wait
until all IDataServices have prepared. It will then choose a
commitTime for the transaction and return that value to each
IDataService.
Note: If this method throws ANY exception then the task MUST cancel the commit, discard the local write set of the transaction, and note that the transaction is aborted in its local state.
prepared in interface IDistributedTransactionServicetx - The transaction identifier.dataService - The UUID of the IDataService which sent the
message.IOException - if there is an RMI problem.InterruptedExceptionBrokenBarrierExceptionpublic void notifyCommit(long commitTime)
throws IOException
ITransactionServiceITransactionService that a commit has been performed
with the given timestamp (which it assigned) and that it should update
its lastCommitTime iff the given commitTime is GT its current
lastCommitTime.
Note: This is used to inform the ITransactionService of commits
that DO NOT involve transaction commits. That is, local unisolated writes
on individual IDataServices in an IBigdataFederation.
notifyCommit in interface ITransactionServicecommitTime - The commit time.IOExceptionpublic long newTx(long timestamp)
throws IOException
ITransactionServicenewTx in interface ITransactionServicetimestamp - The timestamp may be:
lastCommitTime will
produce a read-only transaction that is reading on the
lastCommitTime with snapshot isolation (new
writes will not become visible in the view). This is basically
the same behavior as specifying ITx.READ_COMMITTED.
While perhaps counter-intuitive, this behavior is preferred to
throwing an exception when a user attempts to read from a
commit time GT the most recent commit point.).ITx.READ_COMMITTED to obtain
a read-historical transaction reading from the most recently
committed state of the database. The transaction will be
assigned a start time corresponding to the most recent commit
point of the database and will be a fully isolated read-only
view of the state of the database as of that start time. (This
is an atomic shorthand for newTx(getLastCommitTime())).ITx.UNISOLATED for a read-write transaction.IOException - RMI errors.public long getReleaseTime()
throws IOException
ITransactionServicenow-minReleaseAge and is updated whenever
the earliest running transaction terminates. This value is monotonically
increasing. It will always be LT the last non-zero last commit time. It
will never be negative. It MAY be ZERO (0L) and will be ZERO (0L) on
startup (unless explicitly set by the database to the last known commit
time).
The returned values is used to identify the most recent commit point LTE the releaseTime. This is the earliest commit point on whose data MAY be released. (Consequently, the first commit point GT the releaseTime is the earliest visible commit point.)
getReleaseTime in interface ITransactionServiceIOExceptionpublic long getLastCommitTime()
throws IOException
ITransactionServiceITransactionService.getLastCommitTime in interface ITransactionServiceIOExceptionpublic void declareResources(long tx,
UUID dataService,
String[] resource)
throws IOException
IDistributedTransactionServiceIDataService MUST invoke this method before permitting an
operation isolated by a read-write transaction to execute with access to
the named resources (this applies only to distributed databases). The
declared resources are used in the commit phase of the read-write tx to
impose a partial order on commits. That partial order guarantees that
commits do not deadlock in contention for the same resources.declareResources in interface IDistributedTransactionServicetx - The transaction identifier.dataService - The UUID an IDataService on which the
transaction will write.resource - An array of the named resources which the transaction will use
on that IDataService (this may be different for each
operation submitted by that transaction to the
IDataService).IOExceptionpublic boolean committed(long tx,
UUID dataService)
throws IOException,
InterruptedException,
BrokenBarrierException
IDistributedTransactionServiceIDataService. If this method
returns false then the distributed commit has failed and
the task MUST rollback the live journal to the previous commit point. If
the return is true then the distributed commit was
successful and the task should halt permitting the IDataService
to return from the ITxCommitProtocol.prepare(long, long) method.committed in interface IDistributedTransactionServicetx - The transaction identifier.dataService - The UUID of the IDataService which sent the
message.true if the distributed commit was successfull and
false if there was a problem.IOExceptionInterruptedExceptionBrokenBarrierExceptionpublic long commit(long tx)
throws ValidationError,
IOException
ITransactionService
The commit of a transaction with a write set on a single
IDataService does not require either ITx.UNISOLATED tasks
or other transactions to wait. The latency for such commits is directly
related to the size of the transaction write set.
However, the commit of a transaction with writes on more than one
IDataService requires a distributed commit protocol. The
distributed commit protocol forces ALL tasks writing on those
IDataServices to wait until the transaction is complete. This is
necessary in order to obtain a global commit point that corresponds to
the atomic commit state of the transaction (without this we would not
have the Atomic property for distributed transaction commits).
commit in interface ITransactionServicetx - The transaction identifier.ValidationError - if the transaction could not be validated.IOException - RMI errors.public void abort(long tx)
throws IOException
ITransactionServiceabort in interface ITransactionServicetx - The transaction identifier.IOException - RMI errors.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.