Return-Path: X-Original-To: apmail-ignite-user-archive@minotaur.apache.org Delivered-To: apmail-ignite-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CDDE7187A7 for ; Tue, 22 Sep 2015 22:39:09 +0000 (UTC) Received: (qmail 56204 invoked by uid 500); 22 Sep 2015 22:39:09 -0000 Delivered-To: apmail-ignite-user-archive@ignite.apache.org Received: (qmail 56161 invoked by uid 500); 22 Sep 2015 22:39:09 -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 56151 invoked by uid 99); 22 Sep 2015 22:39:09 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Sep 2015 22:39:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 4FEBEC0AE4 for ; Tue, 22 Sep 2015 22:39:09 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.92 X-Spam-Level: X-Spam-Status: No, score=0.92 tagged_above=-999 required=6.31 tests=[SPF_FAIL=0.919, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id H1o3G8MezQKH for ; Tue, 22 Sep 2015 22:39:00 +0000 (UTC) Received: from mbob.nabble.com (mbob.nabble.com [162.253.133.15]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTP id 8E46820382 for ; Tue, 22 Sep 2015 22:38:59 +0000 (UTC) Received: from malf.nabble.com (unknown [162.253.133.59]) by mbob.nabble.com (Postfix) with ESMTP id 66E20161F5B6 for ; Tue, 22 Sep 2015 15:33:17 -0700 (PDT) Date: Tue, 22 Sep 2015 15:31:54 -0700 (PDT) From: kevin To: user@ignite.apache.org Message-ID: <1442961114875-1465.post@n6.nabble.com> In-Reply-To: <1442952659414-1464.post@n6.nabble.com> References: <1442517876418-1449.post@n6.nabble.com> <1442526783517-1451.post@n6.nabble.com> <1442583459301-1452.post@n6.nabble.com> <1442585578274-1453.post@n6.nabble.com> <1442621417994-1454.post@n6.nabble.com> <1442850926807-1456.post@n6.nabble.com> <1442894382489-1457.post@n6.nabble.com> <1442933729016-1461.post@n6.nabble.com> <1442951879504-1462.post@n6.nabble.com> <1442952659414-1464.post@n6.nabble.com> Subject: Re: CacheStore implementation using Hibernate MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I also found the other behavior that's been giving me confusing results: For both CacheInterceptor and CacheEntryProcessor, the onBeforePut/process methods are called twice. Once on IgniteCache.put/invoke and once on Transaction.commit. Consider this code > tx = ignite.transactions().txStart(); > int[] arg = {1}; > cache.invoke("test1", new CacheEntryProcessor > < > String, TestValue, Void > > > () { > @Override > public Void process(MutableEntry > < > String, TestValue > > > entry, Object... args) throws EntryProcessorException { > int arg = ((int[]) args[0])[0]; > > TestValue val = entry.getValue(); > > val.setMyInt(val.getMyInt() + arg); > entry.setValue(val); > > return null; > } > }, arg); > System.out.println("before commit: " + cache.get("test1")); > arg[0] = 5; > tx.commit(); > > System.out.println("after commit: " + cache.get("test1")); To the developer, the cache value would've looked like it incremented by 1 before it commits. The action of calling tx.commit() intuitively means to flush the changes to the database. Instead, the cache processor runs again, and the actual commit to the database increments the value by 5. Another thing is that if the CacheEntryProcessor executes successfully the first time, but throws a EntryProcessorException during commit, this error looks like it gets suppressed silently and the write through doesn't occur. -- View this message in context: http://apache-ignite-users.70518.x6.nabble.com/CacheStore-implementation-using-Hibernate-tp1423p1465.html Sent from the Apache Ignite Users mailing list archive at Nabble.com.