18 #ifndef HAZELCAST_TransactionContext 19 #define HAZELCAST_TransactionContext 21 #include "hazelcast/client/TransactionOptions.h" 22 #include "hazelcast/client/txn/TransactionProxy.h" 23 #include "hazelcast/client/TransactionalMap.h" 24 #include "hazelcast/client/exception/IllegalStateException.h" 25 #include "hazelcast/client/TransactionalQueue.h" 26 #include "hazelcast/client/TransactionalMultiMap.h" 27 #include "hazelcast/client/TransactionalList.h" 28 #include "hazelcast/client/TransactionalSet.h" 30 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 32 #pragma warning(disable: 4251) //for dll export 39 class ClientTransactionManagerServiceImpl;
43 namespace connection {
44 class ClientConnectionManagerImpl;
64 std::string getTxnId()
const;
71 void beginTransaction();
78 void commitTransaction();
85 void rollbackTransaction();
95 template<
typename K,
typename V>
97 return getTransactionalObject< TransactionalMap<K, V> >(name);
109 return getTransactionalObject< TransactionalQueue< E > >(name);
119 template<
typename K,
typename V>
121 return getTransactionalObject< TransactionalMultiMap<K, V> >(name);
133 return getTransactionalObject< TransactionalList< E > >(name);
145 return getTransactionalObject< TransactionalSet< E > >(name);
157 if (transaction.getState() != txn::TxnState::ACTIVE) {
158 std::string message =
"No transaction is found while accessing ";
159 message +=
"transactional object -> [" + name +
"]!";
160 throw exception::IllegalStateException(
"TransactionContext::getMap(const std::string& name)", message);
162 T txnObject(name, &transaction);
168 boost::shared_ptr<connection::Connection> txnConnection;
169 txn::TransactionProxy transaction;
175 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 179 #endif //HAZELCAST_TransactionContext Contains the configuration for a Hazelcast transaction.
Definition: TransactionOptions.h:67
TransactionalList< E > getList(const std::string &name)
Returns the transactional list instance with the specified name.
Definition: TransactionContext.h:132
TransactionalMap< K, V > getMap(const std::string &name)
Returns the transactional distributed map instance with the specified name.
Definition: TransactionContext.h:96
T getTransactionalObject(const std::string &name)
get any transactional object with template T.
Definition: TransactionContext.h:156
Transactional implementation of IMap.
Definition: TransactionalMap.h:44
Transactional implementation of MultiMap.
Definition: TransactionalMultiMap.h:40
Transactional implementation of IList.
Definition: TransactionalList.h:30
Transactional implementation of ISet.
Definition: TransactionalSet.h:34
TransactionalSet< E > getSet(const std::string &name)
Returns the transactional set instance with the specified name.
Definition: TransactionContext.h:144
TransactionalMultiMap< K, V > getMultiMap(const std::string &name)
Returns the transactional multimap instance with the specified name.
Definition: TransactionContext.h:120
TransactionalQueue< E > getQueue(const std::string &name)
Returns the transactional queue instance with the specified name.
Definition: TransactionContext.h:108
Definition: MapEntryView.h:32
Transactional implementation of IQueue.
Definition: TransactionalQueue.h:38
Provides a context to do transactional operations; so beginning/committing transactions, but also retrieving transactional data-structures like the TransactionalMap.
Definition: TransactionContext.h:54