GigaSpaces XAP 8.0 API

com.j_spaces.sadapter.datasource
Class BulkDataPersisterContext

java.lang.Object
  extended by com.j_spaces.sadapter.datasource.BulkDataPersisterContext

public class BulkDataPersisterContext
extends Object

BulkDataPersisterContext an operation context that is accessible on mirror in BulkDataPersister.executeBulk(List) method.
BulkDataPersisterContext should be used to consolidate distributed transactions on the mirror side.
BulkDataPersisterContext is not accessible on any other space except mirror and not in any other method except BulkDataPersister.executeBulk(List)

Example of mirror implementation:


 public void executeBulk(List bulk) throws DataSourceException {
            BulkDataPersisterContext context = BulkDataPersisterContext.getCurrentContext();

           if (context.isTransactional()) {
               TransactionParticipantData txData = context.getTransactionData();


                long id = txData.getTransactionId();
                int participantId = txData.getParticipantId();
                int participantsCount = txData.getParticipantsCount();

                // add to pending transactions      
                ....


                // if all transactions parts arrived - execute bulk
                ....

            }
            else
            {
               //regular execution
               ....
            }

        }
 

Since:
7.1
Author:
anna

Constructor Summary
BulkDataPersisterContext(TransactionParticipantData transactionData, String sourceMemberSpaceName)
           
 
Method Summary
static BulkDataPersisterContext getCurrentContext()
           
 String getSourceSpaceMemberName()
          Get the source space member name that sent this bulk.
 TransactionParticipantData getTransactionData()
          Gets transaction participant data if exists.
 boolean isTransactional()
           
static void resetContext()
          Resets the current context
static void setContext(BulkDataPersisterContext context)
          Set the context for the current thread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BulkDataPersisterContext

public BulkDataPersisterContext(TransactionParticipantData transactionData,
                                String sourceMemberSpaceName)
Parameters:
transactionData -
Method Detail

getCurrentContext

public static BulkDataPersisterContext getCurrentContext()
Returns:
the context of the current thread

setContext

public static void setContext(BulkDataPersisterContext context)
Set the context for the current thread


resetContext

public static void resetContext()
Resets the current context


getTransactionData

public TransactionParticipantData getTransactionData()
Gets transaction participant data if exists.


getSourceSpaceMemberName

public String getSourceSpaceMemberName()
Get the source space member name that sent this bulk.


isTransactional

public boolean isTransactional()

GigaSpaces XAP 8.0 API

Copyright © GigaSpaces.