MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
com.mysql.clusterj.core.SessionImpl Class Reference
Inheritance diagram for com.mysql.clusterj.core.SessionImpl:
Collaboration diagram for com.mysql.clusterj.core.SessionImpl:

Classes

interface  TransactionState

Public Member Functions

Boolean found (Object instance)
Operation insert (DomainTypeHandler<?> domainTypeHandler, ValueHandler valueHandler)
Iterable makePersistentAll (Iterable instances)
void deletePersistent (Object object)
Operation delete (DomainTypeHandler domainTypeHandler, ValueHandler valueHandler)
void deletePersistentAll (Iterable objects)
int deletePersistentAll (DomainTypeHandler<?> domainTypeHandler)
int deletePersistentAll (ScanOperation op, boolean abort)
ResultData selectUnique (DomainTypeHandler domainTypeHandler, ValueHandler keyHandler, BitSet fields)
void updatePersistent (Object object)
Operation update (DomainTypeHandler domainTypeHandler, ValueHandler valueHandler)
void updatePersistentAll (Iterable objects)
Iterable savePersistentAll (Iterable instances)
Transaction currentTransaction ()
void close ()
boolean isClosed ()
void begin ()
void commit ()
void rollback ()
void startAutoTransaction ()
void endAutoTransaction ()
void failAutoTransaction ()
void setRollbackOnly ()
boolean getRollbackOnly ()
synchronized< T >
DomainTypeHandler< T > 
getDomainTypeHandler (Class< T > cls)
Dictionary getDictionary ()
boolean isEnlisted ()
Query createQuery (Class cls)
QueryBuilder getQueryBuilder ()
IndexScanOperation getIndexScanOperation (Index storeIndex, Table storeTable)
IndexScanOperation getIndexScanOperationMultiRange (Index storeIndex, Table storeTable)
IndexScanOperation getIndexScanDeleteOperation (Index storeIndex, Table storeTable)
ScanOperation getTableScanOperation (Table storeTable)
ScanOperation getTableScanDeleteOperation (Table storeTable)
IndexOperation getUniqueIndexOperation (Index storeIndex, Table storeTable)
Operation getSelectOperation (Table storeTable)
Operation getDeleteOperation (Table storeTable)
IndexOperation getUniqueIndexDeleteOperation (Index storeIndex, Table storeTable)
void flush ()
List getChangeList ()
void persist (Object instance)
void remove (Object instance)
void markModified (StateManager instance)
void setPartitionKey (Class<?> domainClass, Object key)
void markModified (Object instance, String fieldName)
void executeNoCommit (boolean abort, boolean force)
void executeNoCommit ()
String getCoordinatedTransactionId ()
void setCoordinatedTransactionId (String coordinatedTransactionId)
void setLockMode (LockMode lockmode)
- Public Member Functions inherited from com.mysql.clusterj.core.spi.SessionSPI
< T > T initializeFromDatabase (DomainTypeHandler< T > domainTypeHandler, T object, ValueHandler valueHandler, ValueHandler createKeyValueHandler)
ResultData selectUnique (DomainTypeHandler<?> domainTypeHandler, ValueHandler keyHandler, BitSet fields)
Operation update (DomainTypeHandler<?> domainTypeHandler, ValueHandler valueHandler)
Operation delete (DomainTypeHandler<?> domainTypeHandler, ValueHandler valueHandler)
< T > QueryDomainType< T > createQueryDomainType (DomainTypeHandler< T > handler)
- Public Member Functions inherited from com.mysql.clusterj.Session
< T > T load (T instance)
Iterable<?> makePersistentAll (Iterable<?> instances)
void deletePersistentAll (Iterable<?> instances)
void updatePersistentAll (Iterable<?> instances)
Iterable<?> savePersistentAll (Iterable<?> instances)

Protected Member Functions

void assertNotClosed ()
void internalBegin ()
void internalCommit ()
void internalRollback ()
void handleTransactionException ()
synchronized< T >
DomainTypeHandler< T > 
getDomainTypeHandler (T object)

Protected Attributes

SessionFactoryImpl factory
Db db
Dictionary dictionary
TransactionImpl transactionImpl
PartitionKey partitionKey = null
boolean rollbackOnly = false
ClusterTransaction clusterTransaction
String joinTransactionId = null
Map properties
final int RESULT_READY = 0
final int SCAN_FINISHED = 1
final int CACHE_EMPTY = 2
List< StateManagerchangeList = new ArrayList<StateManager>()
List< Runnable > postExecuteOperations = new ArrayList<Runnable>()
TransactionState transactionState
int nestedAutoTransactionCounter = 0
int numberOfRetries = 5
TransactionState transactionStateNotActive
TransactionState transactionStateActive
TransactionState transactionStateAutocommit

Detailed Description

This class implements Session, the main user interface to ClusterJ. It also implements SessionSPI, the main component interface.

Definition at line 68 of file SessionImpl.java.

Member Function Documentation

void com.mysql.clusterj.core.SessionImpl.assertNotClosed ( )
inlineprotected

Assert this session is not yet closed.

Definition at line 714 of file SessionImpl.java.

Here is the call graph for this function:

void com.mysql.clusterj.core.SessionImpl.begin ( )
inline

Begin the current transaction.

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 724 of file SessionImpl.java.

Here is the caller graph for this function:

void com.mysql.clusterj.core.SessionImpl.close ( void  )
inline

Close this session and deallocate all resources.

Implements com.mysql.clusterj.Session.

Definition at line 698 of file SessionImpl.java.

void com.mysql.clusterj.core.SessionImpl.commit ( )
inline

Commit the current transaction.

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 752 of file SessionImpl.java.

Here is the caller graph for this function:

Query com.mysql.clusterj.core.SessionImpl.createQuery ( Class  cls)
inline

Create a query from a class.

Parameters
clsthe class
Returns
the query

Definition at line 1113 of file SessionImpl.java.

Here is the call graph for this function:

Transaction com.mysql.clusterj.core.SessionImpl.currentTransaction ( )
inline

Get the current transaction.

Returns
the transaction

Implements com.mysql.clusterj.Session.

Definition at line 691 of file SessionImpl.java.

void com.mysql.clusterj.core.SessionImpl.deletePersistent ( Object  object)
inline

Remove an instance from the database. Only the key field(s) are used to identify the instance.

Parameters
objectthe instance to remove from the database

Implements com.mysql.clusterj.Session.

Definition at line 463 of file SessionImpl.java.

Here is the call graph for this function:

void com.mysql.clusterj.core.SessionImpl.deletePersistentAll ( Iterable  objects)
inline

Delete the instances corresponding to the parameters.

Parameters
objectsthe objects to delete

Definition at line 492 of file SessionImpl.java.

Here is the call graph for this function:

Here is the caller graph for this function:

int com.mysql.clusterj.core.SessionImpl.deletePersistentAll ( DomainTypeHandler<?>  domainTypeHandler)
inline

Delete all instances of the parameter domainTypeHandler.

Parameters
domainTypeHandlerthe domainTypeHandler of instances to delete
Returns
the number of instances deleted

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 512 of file SessionImpl.java.

Here is the call graph for this function:

int com.mysql.clusterj.core.SessionImpl.deletePersistentAll ( ScanOperation  op,
boolean  abort 
)
inline

Delete all instances retrieved by the operation. The operation must have exclusive access to the instances and have the ScanFlag.KEY_INFO flag set.

Parameters
opthe scan operation
Returns
the number of instances deleted

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 536 of file SessionImpl.java.

Here is the call graph for this function:

void com.mysql.clusterj.core.SessionImpl.endAutoTransaction ( )
inline

End an auto transaction if it was started. Throw a ClusterJException if there is any problem.

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 823 of file SessionImpl.java.

Here is the caller graph for this function:

void com.mysql.clusterj.core.SessionImpl.executeNoCommit ( boolean  abort,
boolean  force 
)
inline

Execute any pending operations (insert, delete, update, load) and then perform post-execute operations (for load) via clusterTransaction.postExecuteCallback().

Parameters
abortabort this transaction on error
forceforce the operation to be sent immediately

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 1343 of file SessionImpl.java.

void com.mysql.clusterj.core.SessionImpl.executeNoCommit ( )
inline

Execute any pending operations (insert, delete, update, load) and then perform post-execute operations (for load) via clusterTransaction.postExecuteCallback(). Abort the transaction on error. Force the operation to be sent immediately.

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 1354 of file SessionImpl.java.

Here is the caller graph for this function:

void com.mysql.clusterj.core.SessionImpl.failAutoTransaction ( )
inline

Fail an auto transaction if it was started. Throw a ClusterJException if there is any problem.

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 832 of file SessionImpl.java.

Here is the caller graph for this function:

void com.mysql.clusterj.core.SessionImpl.flush ( )
inline

Flush deferred changes to the back end. Inserts, deletes, loads, and updates are sent to the back end.

Implements com.mysql.clusterj.Session.

Definition at line 1275 of file SessionImpl.java.

Here is the call graph for this function:

Boolean com.mysql.clusterj.core.SessionImpl.found ( Object  instance)
inline

Was this instance found in the database?

Parameters
instancethe instance
Returns
  • null if the instance is null or was created via newInstance and never loaded;
  • true if the instance was returned from a find or query or created via newInstance and successfully loaded;
  • false if the instance was created via newInstance and not found.

Implements com.mysql.clusterj.Session.

Definition at line 353 of file SessionImpl.java.

Here is the call graph for this function:

String com.mysql.clusterj.core.SessionImpl.getCoordinatedTransactionId ( )
inline

Return the coordinatedTransactionId of the current transaction. The transaction might not have been enlisted.

Returns
the coordinatedTransactionId

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 1367 of file SessionImpl.java.

Operation com.mysql.clusterj.core.SessionImpl.getDeleteOperation ( Table  storeTable)
inline

Create a delete operation for a table.

Parameters
storeTablethe table
Returns
the operation

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 1247 of file SessionImpl.java.

Here is the call graph for this function:

synchronized<T> DomainTypeHandler<T> com.mysql.clusterj.core.SessionImpl.getDomainTypeHandler ( object)
inlineprotected

Get the domain type handler for an instance.

Parameters
objectthe instance for which to get the domain type handler
Returns
the domain type handler

Definition at line 1047 of file SessionImpl.java.

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized<T> DomainTypeHandler<T> com.mysql.clusterj.core.SessionImpl.getDomainTypeHandler ( Class< T >  cls)
inline

Get the domain type handler for a class.

Parameters
clsthe class
Returns
the domain type handler

Definition at line 1058 of file SessionImpl.java.

Here is the call graph for this function:

IndexScanOperation com.mysql.clusterj.core.SessionImpl.getIndexScanDeleteOperation ( Index  storeIndex,
Table  storeTable 
)
inline

Create an index scan delete operation for an index and table.

Parameters
storeIndexthe index
storeTablethe table
Returns
the index scan operation

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 1166 of file SessionImpl.java.

Here is the call graph for this function:

IndexScanOperation com.mysql.clusterj.core.SessionImpl.getIndexScanOperation ( Index  storeIndex,
Table  storeTable 
)
inline

Create an index scan operation for an index and table.

Parameters
storeIndexthe index
storeTablethe table
Returns
the index scan operation

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 1132 of file SessionImpl.java.

Here is the call graph for this function:

IndexScanOperation com.mysql.clusterj.core.SessionImpl.getIndexScanOperationMultiRange ( Index  storeIndex,
Table  storeTable 
)
inline

Create an index scan operation for an index and table to be used for a multi-range scan.

Parameters
storeIndexthe index
storeTablethe table
Returns
the index scan operation

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 1149 of file SessionImpl.java.

Here is the call graph for this function:

QueryBuilder com.mysql.clusterj.core.SessionImpl.getQueryBuilder ( )
inline

Get a query builder.

Returns
the query builder

Implements com.mysql.clusterj.Session.

Definition at line 1122 of file SessionImpl.java.

boolean com.mysql.clusterj.core.SessionImpl.getRollbackOnly ( )
inline

Is the current transaction marked for rollback only?

Returns
true if the current transaction is marked for rollback only

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 857 of file SessionImpl.java.

Here is the caller graph for this function:

Operation com.mysql.clusterj.core.SessionImpl.getSelectOperation ( Table  storeTable)
inline

Create a select operation for a table.

Parameters
storeTablethe table
Returns
the operation

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 1231 of file SessionImpl.java.

Here is the call graph for this function:

ScanOperation com.mysql.clusterj.core.SessionImpl.getTableScanDeleteOperation ( Table  storeTable)
inline

Create a table scan delete operation for a table.

Parameters
storeTablethe table
Returns
the table scan operation

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 1198 of file SessionImpl.java.

Here is the call graph for this function:

ScanOperation com.mysql.clusterj.core.SessionImpl.getTableScanOperation ( Table  storeTable)
inline

Create a table scan operation for a table.

Parameters
storeTablethe table
Returns
the table scan operation

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 1182 of file SessionImpl.java.

Here is the call graph for this function:

IndexOperation com.mysql.clusterj.core.SessionImpl.getUniqueIndexDeleteOperation ( Index  storeIndex,
Table  storeTable 
)
inline

Create an index delete operation for an index and table.

Parameters
storeIndexthe index
storeTablethe table
Returns
the index operation

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 1264 of file SessionImpl.java.

Here is the call graph for this function:

IndexOperation com.mysql.clusterj.core.SessionImpl.getUniqueIndexOperation ( Index  storeIndex,
Table  storeTable 
)
inline

Create an index operation for an index and table.

Parameters
storeIndexthe index
storeTablethe table
Returns
the index operation

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 1215 of file SessionImpl.java.

Here is the call graph for this function:

void com.mysql.clusterj.core.SessionImpl.internalBegin ( )
inlineprotected

Internally begin the transaction. Called by transactionState.begin().

Definition at line 733 of file SessionImpl.java.

Here is the call graph for this function:

void com.mysql.clusterj.core.SessionImpl.internalCommit ( )
inlineprotected

Internally commit the transaction. Called by transactionState.commit().

Definition at line 761 of file SessionImpl.java.

Here is the call graph for this function:

void com.mysql.clusterj.core.SessionImpl.internalRollback ( )
inlineprotected

Internally roll back the transaction. Called by transactionState.rollback() and transactionState.commit() if the transaction is marked for rollback.

Definition at line 796 of file SessionImpl.java.

Here is the call graph for this function:

Here is the caller graph for this function:

boolean com.mysql.clusterj.core.SessionImpl.isClosed ( )
inline

Is this session closed?

Returns
true if the session is closed

Implements com.mysql.clusterj.Session.

Definition at line 709 of file SessionImpl.java.

Here is the caller graph for this function:

boolean com.mysql.clusterj.core.SessionImpl.isEnlisted ( )
inline

Is the transaction enlisted. A transaction is enlisted if and only if an operation has been defined that requires an ndb transaction to be started.

Returns
true if the transaction is enlisted

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 1081 of file SessionImpl.java.

Here is the caller graph for this function:

Iterable com.mysql.clusterj.core.SessionImpl.makePersistentAll ( Iterable  instances)
inline

Make a number of instances persistent.

Parameters
instancesa Collection or array of objects to persist
Returns
a Collection or array with the same order of iteration

Definition at line 435 of file SessionImpl.java.

Here is the call graph for this function:

void com.mysql.clusterj.core.SessionImpl.markModified ( StateManager  obj)
inline

Mark an object as modified.

Implements com.mysql.clusterj.core.CacheManager.

Definition at line 1301 of file SessionImpl.java.

void com.mysql.clusterj.core.SessionImpl.markModified ( Object  instance,
String  fieldName 
)
inline

Mark the field in the instance as modified so it is flushed.

Parameters
instancethe persistent instance
fieldNamethe field to mark as modified

Implements com.mysql.clusterj.Session.

Definition at line 1331 of file SessionImpl.java.

Here is the call graph for this function:

void com.mysql.clusterj.core.SessionImpl.persist ( Object  instance)
inline

Insert the instance into the database. This method has identical semantics to makePersistent.

Parameters
instancethe instance to insert

Implements com.mysql.clusterj.Session.

Definition at line 1293 of file SessionImpl.java.

void com.mysql.clusterj.core.SessionImpl.remove ( Object  instance)
inline

Delete the instance from the database. This method has identical semantics to deletePersistent.

Parameters
instancethe instance to delete

Implements com.mysql.clusterj.Session.

Definition at line 1297 of file SessionImpl.java.

void com.mysql.clusterj.core.SessionImpl.rollback ( )
inline

Roll back the current transaction.

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 785 of file SessionImpl.java.

Here is the caller graph for this function:

Iterable com.mysql.clusterj.core.SessionImpl.savePersistentAll ( Iterable  instances)
inline

Save the instances even if they do not exist.

Parameters
instances

Definition at line 677 of file SessionImpl.java.

Here is the call graph for this function:

ResultData com.mysql.clusterj.core.SessionImpl.selectUnique ( DomainTypeHandler  domainTypeHandler,
ValueHandler  keyHandler,
BitSet  fields 
)
inline

Select a single row from the database. Only the fields requested will be selected. A transaction must be active (either via begin or startAutoTransaction).

Parameters
domainTypeHandlerthe domainTypeHandler to be selected
keyHandlerthe key supplier for the select
fieldsthe fields to select; null to select all fields
Returns
the ResultData from the database

Definition at line 583 of file SessionImpl.java.

void com.mysql.clusterj.core.SessionImpl.setCoordinatedTransactionId ( String  coordinatedTransactionId)
inline

Set the coordinatedTransactionId for the next transaction. This will take effect as soon as the transaction is enlisted.

Parameters
coordinatedTransactionIdthe coordinatedTransactionId

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 1375 of file SessionImpl.java.

void com.mysql.clusterj.core.SessionImpl.setLockMode ( LockMode  lockmode)
inline

Set the lock mode for subsequent operations. The lock mode takes effect immediately and continues until set again.

Parameters
lockmodethe lock mode

Implements com.mysql.clusterj.Session.

Definition at line 1383 of file SessionImpl.java.

void com.mysql.clusterj.core.SessionImpl.setPartitionKey ( Class<?>  cls,
Object  key 
)
inline

Set the partition key for the next transaction. The key must be of the same type as the primary key defined by the table corresponding to the cls parameter. The key parameter is the wrapped version of the primitive type of the key, e.g. Integer for INT key types, Long for BIGINT key types, or String for char and varchar types.

For multi-column primary keys, the key parameter is an Object[], each element of which is a component of the primary key. The elements must be in the order of declaration of the columns (not necessarily the order defined in the CONSTRAINT ... PRIMARY KEY clause) of the CREATE TABLE statement.

Exceptions
ClusterJUserExceptionif a transaction is enlisted
ClusterJUserExceptionif a partition key is null
ClusterJUserExceptionif called twice in the same transaction
ClusterJUserExceptionif a partition key is the wrong type
Parameters
keythe primary key of the mapped table

Implements com.mysql.clusterj.Session.

Definition at line 1305 of file SessionImpl.java.

Here is the call graph for this function:

void com.mysql.clusterj.core.SessionImpl.setRollbackOnly ( )
inline

Mark the current transaction as rollback only.

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 850 of file SessionImpl.java.

Here is the caller graph for this function:

void com.mysql.clusterj.core.SessionImpl.startAutoTransaction ( )
inline

Start a transaction if there is not already an active transaction. Throw a ClusterJException if there is any problem.

Implements com.mysql.clusterj.core.spi.SessionSPI.

Definition at line 814 of file SessionImpl.java.

Here is the caller graph for this function:

void com.mysql.clusterj.core.SessionImpl.updatePersistent ( Object  object)
inline

Update an instance in the database. The key field(s) are used to identify the instance; modified fields change the values in the database.

Parameters
objectthe instance to update in the database

Implements com.mysql.clusterj.Session.

Definition at line 605 of file SessionImpl.java.

Here is the call graph for this function:

Here is the caller graph for this function:

void com.mysql.clusterj.core.SessionImpl.updatePersistentAll ( Iterable  objects)
inline

Update the instances corresponding to the parameters.

Parameters
objectsthe objects to update

Definition at line 639 of file SessionImpl.java.

Here is the call graph for this function:

Member Data Documentation

List<StateManager> com.mysql.clusterj.core.SessionImpl.changeList = new ArrayList<StateManager>()
protected

The list of objects changed since the last flush

Definition at line 109 of file SessionImpl.java.

ClusterTransaction com.mysql.clusterj.core.SessionImpl.clusterTransaction
protected

The underlying ClusterTransaction

Definition at line 95 of file SessionImpl.java.

Db com.mysql.clusterj.core.SessionImpl.db
protected

Db: one per session.

Definition at line 80 of file SessionImpl.java.

Dictionary com.mysql.clusterj.core.SessionImpl.dictionary
protected

Dictionary: one per session.

Definition at line 83 of file SessionImpl.java.

SessionFactoryImpl com.mysql.clusterj.core.SessionImpl.factory
protected

My Factory.

Definition at line 77 of file SessionImpl.java.

String com.mysql.clusterj.core.SessionImpl.joinTransactionId = null
protected

The transaction id to join

Definition at line 98 of file SessionImpl.java.

int com.mysql.clusterj.core.SessionImpl.nestedAutoTransactionCounter = 0
protected

Nested auto transaction counter.

Definition at line 123 of file SessionImpl.java.

int com.mysql.clusterj.core.SessionImpl.numberOfRetries = 5
protected

Number of retries for retriable exceptions

Definition at line 127 of file SessionImpl.java.

PartitionKey com.mysql.clusterj.core.SessionImpl.partitionKey = null
protected

The partition key

Definition at line 89 of file SessionImpl.java.

List<Runnable> com.mysql.clusterj.core.SessionImpl.postExecuteOperations = new ArrayList<Runnable>()
protected

The list of pending operations, such as load operations, that need to be processed after the operation is sent to the database via

See Also
executeNoCommit().

Definition at line 114 of file SessionImpl.java.

Map com.mysql.clusterj.core.SessionImpl.properties
protected

The properties for this session

Definition at line 101 of file SessionImpl.java.

final int com.mysql.clusterj.core.SessionImpl.RESULT_READY = 0
protected

Flags for iterating a scan

Definition at line 104 of file SessionImpl.java.

boolean com.mysql.clusterj.core.SessionImpl.rollbackOnly = false
protected

Rollback only status

Definition at line 92 of file SessionImpl.java.

TransactionImpl com.mysql.clusterj.core.SessionImpl.transactionImpl
protected

One transaction at a time.

Definition at line 86 of file SessionImpl.java.

TransactionState com.mysql.clusterj.core.SessionImpl.transactionState
protected

The transaction state of this session.

Definition at line 117 of file SessionImpl.java.

TransactionState com.mysql.clusterj.core.SessionImpl.transactionStateActive
protected

This represents the state of Transaction Active.

Definition at line 933 of file SessionImpl.java.

TransactionState com.mysql.clusterj.core.SessionImpl.transactionStateNotActive
protected

This represents the state of Transaction Not Active.

Definition at line 877 of file SessionImpl.java.


The documentation for this class was generated from the following file: