You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by waterg <je...@gmail.com> on 2017/04/13 18:13:35 UTC

When is CacheStoreAdapter sessionEnd method called?

Hello, 

When is CacheStoreAdapter sessionEnd method called?
I implemented a persistent store with a overriding sessionEnd mothod like
this.

    @Override
    public void sessionEnd(boolean commit) {
        Connection conn = null;
        System.out.println("CALL me ************************");
        try  {
            conn = ses.attachment();
            if (conn != null && ses.isWithinTransaction()) {
                if (commit)
                    conn.commit();
                else
                    conn.rollback();
                conn.close();
            }
        }
        catch (SQLException e) {
            throw new CacheWriterException("Failed to end store session.",
e);
        }
    }

But it was never called. Which then may lead to connection not properly
closed
And could be a reason that led to this error.
http://apache-ignite-users.70518.x6.nabble.com/visor-failed-to-connect-to-cluster-td11919.html

What I noticed below is that almost 20K, waiting on port.

username@servername:~> netstat -ntu | grep <databaseip> | grep WAIT | wc -l
19711
tcp        0      0 <local ip address>:55699     <db server ip
address>:<port number>      TIME_WAIT
tcp        0      0 <local ip address>:34312     <db server ip
address>:<port number>      TIME_WAIT
tcp        0      0 <local ip address>:42490     <db server ip
address>:<port number>     TIME_WAIT
tcp        0      0 <local ip address>:60265     <db server ip
address>:<port number>      TIME_WAIT

appreciate your help!




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/When-is-CacheStoreAdapter-sessionEnd-method-called-tp11965.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: When is CacheStoreAdapter sessionEnd method called?

Posted by Pim D <pi...@ns.nl>.
How did you guys managed to get this working?
My sessionEnd is not called either (nor are write and delete).
Details:
http://apache-ignite-users.70518.x6.nabble.com/CacheStoreAdapter-write-and-delete-are-not-being-called-by-Ignite-s-GridCacheStoreManager-td19624.html



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: When is CacheStoreAdapter sessionEnd method called?

Posted by dkarachentsev <dk...@gridgain.com>.
Hi,

This method is called on transaction commit or rollback. Check that cache
has atomicity mode TRANSACTIONAL and you always call Transaction.commit() or
Transaction.rollback() for explicit transactions.

If it doesn't help, please attach pet project that reproduces this issue,
because in my case it's always called as documented.

Thanks!
-Dmitry



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/When-is-CacheStoreAdapter-sessionEnd-method-called-tp11965p11991.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.