Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 70809200D0C for ; Wed, 20 Sep 2017 22:04:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6ED291609E2; Wed, 20 Sep 2017 20:04:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id AF4C51609D8 for ; Wed, 20 Sep 2017 22:04:04 +0200 (CEST) Received: (qmail 28750 invoked by uid 500); 20 Sep 2017 20:04:03 -0000 Mailing-List: contact user-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@ignite.apache.org Delivered-To: mailing list user@ignite.apache.org Received: (qmail 28740 invoked by uid 99); 20 Sep 2017 20:04:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Sep 2017 20:04:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 29A3F1A3FFA for ; Wed, 20 Sep 2017 20:04:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.651 X-Spam-Level: X-Spam-Status: No, score=0.651 tagged_above=-999 required=6.31 tests=[SPF_HELO_PASS=-0.001, SPF_NEUTRAL=0.652] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 1Wt4PTaM-ZmI for ; Wed, 20 Sep 2017 20:04:01 +0000 (UTC) Received: from n6.nabble.com (n6.nabble.com [162.255.23.37]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id B3AFB5FCC1 for ; Wed, 20 Sep 2017 20:04:01 +0000 (UTC) Received: from n6.nabble.com (localhost [127.0.0.1]) by n6.nabble.com (Postfix) with ESMTP id 6E0521D118F6 for ; Wed, 20 Sep 2017 13:04:01 -0700 (MST) Date: Wed, 20 Sep 2017 13:04:01 -0700 (MST) From: bingili To: user@ignite.apache.org Message-ID: <1505937841448-0.post@n6.nabble.com> Subject: exception in transaction, how to rollback all put? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit archived-at: Wed, 20 Sep 2017 20:04:05 -0000 In the code, tx.commit() is not reached. Is there a way to rollback the cache.put("test1", "1"); cache.put("test2", "2"); public IgniteTest() { CacheConfiguration cacheCfg = new CacheConfiguration(); cacheCfg.setName("cacheName"); cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setCacheConfiguration(cacheCfg); TransactionConfiguration txCfg = new TransactionConfiguration(); cfg.setTransactionConfiguration(txCfg); cfg.setClientMode(true); Ignite ignite = Ignition.start(cfg); transactions = ignite.transactions(); cache = ignite.getOrCreateCache("txn test cache"); } public void run() { Transaction tx = transactions.txStart(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.SERIALIZABLE); try{ cache.put("test1", "1"); cache.put("test2", "2"); String[] bug = null; bug[0] = "hello"; cache.put("test3", "3"); System.out.println("tx.commit"); tx.commit(); }catch (Exception ex) { ex.printStackTrace(); System.out.println("tx.rollback"); tx.rollback(); } } -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/