How to keep context in the RetryPolicy thread created by datastax driverDatastax Driver Mapping APIDatastax Cassandra Driver throwing CodecNotFoundExceptionDatastax Cassandra java driver RetryPolicy for Statement with pagingDatastax Cassandra driver with Scala - Codecs not foundDatastax Java Driver failed to scan an entire tableUsage of the LOCAL_QUORUM consistency level in Datastax driverHow to create a materialized view using datastax libraryHow to rollback using Datastax driver 3.0Cassandra Datastax driver not giving error when update failscassandra datastax driver- difference between session.execute() and cassandraTemplate.execute()

What to do as a player when ranger animal companion dies

What is the word for a person who destroys monuments?

Can Brexit be undone in an emergency?

Why would a fighter use the afterburner and air brakes at the same time?

What's the purpose of autocorrelation?

Do you add your strength modifier once or twice to an unarmed strike?

Does battery condition have anything to do with macbook pro performance?

How is underwater propagation of sound possible?

Debussy as term for bathroom?

Specifying BOM substitutions / alternatives with Contract Manufacturer (CM)

I was cheated into a job and want to leave ASAP, what do I tell my interviewers?

How was ownership of property managed during the Black Death, when so many original owners had died?

Which museums have artworks of all four ninja turtles' namesakes?

How to influence manager to not schedule team meetings during lunch?

How does one calculate the distribution of the Matt Colville way of rolling stats?

Madrid to London w/ Expired 90/180 days stay as US citizen

Is the name of an interval between two notes unique and absolute?

How does a married couple pay bills when one gets paid twice a month and the other will be getting paid every week?

Audire, with accusative or dative?

Did slaves have slaves?

What did the controller say during my approach to land (audio clip)?

Is there a connection between IT and Ghostbusters?

I reverse the source code, you negate the output!

Is there an in-universe reason Harry says this or is this simply a Rowling mistake?



How to keep context in the RetryPolicy thread created by datastax driver


Datastax Driver Mapping APIDatastax Cassandra Driver throwing CodecNotFoundExceptionDatastax Cassandra java driver RetryPolicy for Statement with pagingDatastax Cassandra driver with Scala - Codecs not foundDatastax Java Driver failed to scan an entire tableUsage of the LOCAL_QUORUM consistency level in Datastax driverHow to create a materialized view using datastax libraryHow to rollback using Datastax driver 3.0Cassandra Datastax driver not giving error when update failscassandra datastax driver- difference between session.execute() and cassandraTemplate.execute()






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am customizing the retry policy by implementing the datastax RetryPolicy. I've noticed that when triggered, the retry policy is executed in a new thread created by the datastax framework. Thus, I am losing my context and cannot link between the original query execution, and the current retry execution (my relevant context data is stored on ThreadLocal.)
Is there a way to register/pass data into the retry policy to be able to utilize information from the original query?
My end game is to be able to log relevant context information from the flow of the original query.










share|improve this question






























    0















    I am customizing the retry policy by implementing the datastax RetryPolicy. I've noticed that when triggered, the retry policy is executed in a new thread created by the datastax framework. Thus, I am losing my context and cannot link between the original query execution, and the current retry execution (my relevant context data is stored on ThreadLocal.)
    Is there a way to register/pass data into the retry policy to be able to utilize information from the original query?
    My end game is to be able to log relevant context information from the flow of the original query.










    share|improve this question


























      0












      0








      0








      I am customizing the retry policy by implementing the datastax RetryPolicy. I've noticed that when triggered, the retry policy is executed in a new thread created by the datastax framework. Thus, I am losing my context and cannot link between the original query execution, and the current retry execution (my relevant context data is stored on ThreadLocal.)
      Is there a way to register/pass data into the retry policy to be able to utilize information from the original query?
      My end game is to be able to log relevant context information from the flow of the original query.










      share|improve this question














      I am customizing the retry policy by implementing the datastax RetryPolicy. I've noticed that when triggered, the retry policy is executed in a new thread created by the datastax framework. Thus, I am losing my context and cannot link between the original query execution, and the current retry execution (my relevant context data is stored on ThreadLocal.)
      Is there a way to register/pass data into the retry policy to be able to utilize information from the original query?
      My end game is to be able to log relevant context information from the flow of the original query.







      cassandra-3.0 datastax-java-driver






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 28 at 14:09









      JonathanSJonathanS

      11 bronze badge




      11 bronze badge

























          1 Answer
          1






          active

          oldest

          votes


















          0
















          Indeed retry policy methods are invoked on an internal driver thread, so you can't use a ThreadLocal to share context.



          What you can do instead is wrap your statements in a custom StatementWrapper that stores that information in final fields.






          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );














            draft saved

            draft discarded
















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55399666%2fhow-to-keep-context-in-the-retrypolicy-thread-created-by-datastax-driver%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0
















            Indeed retry policy methods are invoked on an internal driver thread, so you can't use a ThreadLocal to share context.



            What you can do instead is wrap your statements in a custom StatementWrapper that stores that information in final fields.






            share|improve this answer





























              0
















              Indeed retry policy methods are invoked on an internal driver thread, so you can't use a ThreadLocal to share context.



              What you can do instead is wrap your statements in a custom StatementWrapper that stores that information in final fields.






              share|improve this answer



























                0














                0










                0









                Indeed retry policy methods are invoked on an internal driver thread, so you can't use a ThreadLocal to share context.



                What you can do instead is wrap your statements in a custom StatementWrapper that stores that information in final fields.






                share|improve this answer













                Indeed retry policy methods are invoked on an internal driver thread, so you can't use a ThreadLocal to share context.



                What you can do instead is wrap your statements in a custom StatementWrapper that stores that information in final fields.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 5 at 15:43









                Olivier MichallatOlivier Michallat

                1,9947 silver badges12 bronze badges




                1,9947 silver badges12 bronze badges





















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.




















                    draft saved

                    draft discarded















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55399666%2fhow-to-keep-context-in-the-retrypolicy-thread-created-by-datastax-driver%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript