JBeans (JMX) monitoring with Plotly Dash for PythonCalling an external command in PythonWhat are metaclasses in Python?Is there a way to run Python on Android?Finding the index of an item given a list containing it in PythonWhat is the difference between Python's list methods append and extend?How can I safely create a nested directory?Does Python have a ternary conditional operator?How to get the current time in PythonHow can I make a time delay in Python?Does Python have a string 'contains' substring method?

Microservices and Stored Procedures

Safely hang a mirror that does not have hooks

What are the end bytes of *.docx file format

What can a pilot do, if an air traffic controller is incapacitated?

How did Roman armies survive in the desert?

US entry with tourist visa but past alcohol arrest

Manager manipulates my leaves, what's in it for him?

Can Northern Ireland's border issue be solved by repartition?

Wired to Wireless Doorbell

Are actors contractually obligated to certain things like going nude/ Sensual Scenes/ Gory Scenes?

Creating a 16x16(NxN) grid

Create a magic square of 4-digit numbers

Is there any actual security benefit to restricting foreign IPs?

What's the purpose of autocorrelation?

What do solvers like Gurobi and CPLEX do when they run into hard instances of MIP

How should I avoid someone patenting technology in my paper/poster?

Reaction of aqueous sodium carbonate with aluminum foil

Apple Developer Program Refund Help

C# Fastest way to do Array Table Lookup with Integer Index

Is Zack Morris's 'time stop' ability in "Saved By the Bell" a supernatural ability?

Should the pagination be reset when changing the order?

How to ask a man to not take up more than one seat on public transport while avoiding conflict?

Are there hydrocarbons on the Moon?

Shimano 105 FD-R7000-F front dereailleur chain rub



JBeans (JMX) monitoring with Plotly Dash for Python


Calling an external command in PythonWhat are metaclasses in Python?Is there a way to run Python on Android?Finding the index of an item given a list containing it in PythonWhat is the difference between Python's list methods append and extend?How can I safely create a nested directory?Does Python have a ternary conditional operator?How to get the current time in PythonHow can I make a time delay in Python?Does Python have a string 'contains' substring method?






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








1















I am trying to use dash for live monitoring of JBeans attributes. When using dcc.Interval program closes automatically after first POST /_dash-update-component try.



  • Python 3.6

  • Dash 1.0.2

I connected to Jconsole. Referring to Jbean attributes and extracting values works. It even works when I launch dash app for first time, but then when Interval is triggered dash program closes.



  • JBean tested - works fine

  • Dash code tested - it extracts n_intervals just fine

Steps:



  1. JMX FUNCTIONS MODULE

import jpype as jpype
from jpype import java
from jpype import javax
import sys, os
import pandas as pd
import datetime

#JMX CONNECTION FUNCTION:

def jmx_connect(HOST, USER, PORT, PASS):
URL = 'service:jmx:rmi:///jndi/rmi://'+HOST+':'+PORT+'/jmxrmi'
jpype.startJVM(jpype.get_default_jvm_path())
jhash = java.util.HashMap()
jarray=jpype.JArray(java.lang.String)([USER,PASS])
jhash.put(javax.management.remote.JMXConnector.CREDENTIALS, jarray);
jmxurl = javax.management.remote.JMXServiceURL(URL)
jmxsoc = javax.management.remote.JMXConnectorFactory.connect(jmxurl,jhash)
connection = jmxsoc.getMBeanServerConnection();
return connection

#Enter login details HERE:
HOST =
USER =
PORT =
PASS =

#initializing connection with my login details
connection = jmx_connect(HOST, USER, PORT, PASS)


#Thread Count function to extract number of active threads:
#THREAD COUNT
def jmx_ThreadCount():
object="java.lang:type=Threading"
attribute= "ThreadCount"
attr = connection.getAttribute(javax.management.ObjectName(object),attribute)
return attr


  1. DASH MODULE

from TEST_jvmRun import * #this is import of my JVM functions
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.graph_objs as go

app = dash.Dash()

app.layout = html.Div([
html.H1(id='live-update-text'),
dcc.Interval(id='interval-component', interval=10000, n_intervals=0)
])

@app.callback(Output('live-update-text', 'children'),
[Input('interval-component', 'n_intervals')])
def update_current_delay(n):
#return f"counter: n"
return f"WORKING, trial: n ; jmx_ThreadCount()"

if __name__ == '__main__':
app.run_server()


a) ACTUAL RESULTS



--- command line output:



C:Usersm011472DocumentsPython ScriptsWeb>cd "c:Usersm011472DocumentsPython ScriptsWeb" && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && C:Python36python.exe C:Usersm011472.vscodeextensionsms-python.python-2018.4.0pythonFilesPythonToolsvisualstudio_py_launcher.py "c:Usersm011472DocumentsPython ScriptsWeb" 53564 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput "c:Usersm011472DocumentsPython ScriptsWebTEST_dashboard.py" "
* Serving Flask app "TEST_dashboard" (lazy loading) * Environment: production WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:8050/ (Press CTRL+C to quit)
127.0.0.1 - - [28/Mar/2019 14:57:02] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [28/Mar/2019 14:57:03] "GET /_dash-layout HTTP/1.1" 200 -
127.0.0.1 - - [28/Mar/2019 14:57:03] "GET /_dash-dependencies HTTP/1.1" 200 -
127.0.0.1 - - [28/Mar/2019 14:57:03] "POST /_dash-update-component HTTP/1.1" 200 -

C:Usersm011472DocumentsPython ScriptsWeb>


--- dashboard output:



WORKING, trial: 0 ; 418



b) EXPECTED RESULTS



--- command line output:



Program should execute POST every 10 sec and never end



--- DASHBOARD OUTPUT:



Numbers should be updated each 10 sec



WORKING, trial: 0 ; XXX (any number)
WORKING, trial: 1 ; XXY
WORKING, trial: 2 ; XXZ










share|improve this question
































    1















    I am trying to use dash for live monitoring of JBeans attributes. When using dcc.Interval program closes automatically after first POST /_dash-update-component try.



    • Python 3.6

    • Dash 1.0.2

    I connected to Jconsole. Referring to Jbean attributes and extracting values works. It even works when I launch dash app for first time, but then when Interval is triggered dash program closes.



    • JBean tested - works fine

    • Dash code tested - it extracts n_intervals just fine

    Steps:



    1. JMX FUNCTIONS MODULE

    import jpype as jpype
    from jpype import java
    from jpype import javax
    import sys, os
    import pandas as pd
    import datetime

    #JMX CONNECTION FUNCTION:

    def jmx_connect(HOST, USER, PORT, PASS):
    URL = 'service:jmx:rmi:///jndi/rmi://'+HOST+':'+PORT+'/jmxrmi'
    jpype.startJVM(jpype.get_default_jvm_path())
    jhash = java.util.HashMap()
    jarray=jpype.JArray(java.lang.String)([USER,PASS])
    jhash.put(javax.management.remote.JMXConnector.CREDENTIALS, jarray);
    jmxurl = javax.management.remote.JMXServiceURL(URL)
    jmxsoc = javax.management.remote.JMXConnectorFactory.connect(jmxurl,jhash)
    connection = jmxsoc.getMBeanServerConnection();
    return connection

    #Enter login details HERE:
    HOST =
    USER =
    PORT =
    PASS =

    #initializing connection with my login details
    connection = jmx_connect(HOST, USER, PORT, PASS)


    #Thread Count function to extract number of active threads:
    #THREAD COUNT
    def jmx_ThreadCount():
    object="java.lang:type=Threading"
    attribute= "ThreadCount"
    attr = connection.getAttribute(javax.management.ObjectName(object),attribute)
    return attr


    1. DASH MODULE

    from TEST_jvmRun import * #this is import of my JVM functions
    import dash
    import dash_core_components as dcc
    import dash_html_components as html
    from dash.dependencies import Input, Output
    import plotly.graph_objs as go

    app = dash.Dash()

    app.layout = html.Div([
    html.H1(id='live-update-text'),
    dcc.Interval(id='interval-component', interval=10000, n_intervals=0)
    ])

    @app.callback(Output('live-update-text', 'children'),
    [Input('interval-component', 'n_intervals')])
    def update_current_delay(n):
    #return f"counter: n"
    return f"WORKING, trial: n ; jmx_ThreadCount()"

    if __name__ == '__main__':
    app.run_server()


    a) ACTUAL RESULTS



    --- command line output:



    C:Usersm011472DocumentsPython ScriptsWeb>cd "c:Usersm011472DocumentsPython ScriptsWeb" && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && C:Python36python.exe C:Usersm011472.vscodeextensionsms-python.python-2018.4.0pythonFilesPythonToolsvisualstudio_py_launcher.py "c:Usersm011472DocumentsPython ScriptsWeb" 53564 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput "c:Usersm011472DocumentsPython ScriptsWebTEST_dashboard.py" "
    * Serving Flask app "TEST_dashboard" (lazy loading) * Environment: production WARNING: Do not use the development server in a production environment.
    Use a production WSGI server instead.
    * Debug mode: off
    * Running on http://127.0.0.1:8050/ (Press CTRL+C to quit)
    127.0.0.1 - - [28/Mar/2019 14:57:02] "GET / HTTP/1.1" 200 -
    127.0.0.1 - - [28/Mar/2019 14:57:03] "GET /_dash-layout HTTP/1.1" 200 -
    127.0.0.1 - - [28/Mar/2019 14:57:03] "GET /_dash-dependencies HTTP/1.1" 200 -
    127.0.0.1 - - [28/Mar/2019 14:57:03] "POST /_dash-update-component HTTP/1.1" 200 -

    C:Usersm011472DocumentsPython ScriptsWeb>


    --- dashboard output:



    WORKING, trial: 0 ; 418



    b) EXPECTED RESULTS



    --- command line output:



    Program should execute POST every 10 sec and never end



    --- DASHBOARD OUTPUT:



    Numbers should be updated each 10 sec



    WORKING, trial: 0 ; XXX (any number)
    WORKING, trial: 1 ; XXY
    WORKING, trial: 2 ; XXZ










    share|improve this question




























      1












      1








      1








      I am trying to use dash for live monitoring of JBeans attributes. When using dcc.Interval program closes automatically after first POST /_dash-update-component try.



      • Python 3.6

      • Dash 1.0.2

      I connected to Jconsole. Referring to Jbean attributes and extracting values works. It even works when I launch dash app for first time, but then when Interval is triggered dash program closes.



      • JBean tested - works fine

      • Dash code tested - it extracts n_intervals just fine

      Steps:



      1. JMX FUNCTIONS MODULE

      import jpype as jpype
      from jpype import java
      from jpype import javax
      import sys, os
      import pandas as pd
      import datetime

      #JMX CONNECTION FUNCTION:

      def jmx_connect(HOST, USER, PORT, PASS):
      URL = 'service:jmx:rmi:///jndi/rmi://'+HOST+':'+PORT+'/jmxrmi'
      jpype.startJVM(jpype.get_default_jvm_path())
      jhash = java.util.HashMap()
      jarray=jpype.JArray(java.lang.String)([USER,PASS])
      jhash.put(javax.management.remote.JMXConnector.CREDENTIALS, jarray);
      jmxurl = javax.management.remote.JMXServiceURL(URL)
      jmxsoc = javax.management.remote.JMXConnectorFactory.connect(jmxurl,jhash)
      connection = jmxsoc.getMBeanServerConnection();
      return connection

      #Enter login details HERE:
      HOST =
      USER =
      PORT =
      PASS =

      #initializing connection with my login details
      connection = jmx_connect(HOST, USER, PORT, PASS)


      #Thread Count function to extract number of active threads:
      #THREAD COUNT
      def jmx_ThreadCount():
      object="java.lang:type=Threading"
      attribute= "ThreadCount"
      attr = connection.getAttribute(javax.management.ObjectName(object),attribute)
      return attr


      1. DASH MODULE

      from TEST_jvmRun import * #this is import of my JVM functions
      import dash
      import dash_core_components as dcc
      import dash_html_components as html
      from dash.dependencies import Input, Output
      import plotly.graph_objs as go

      app = dash.Dash()

      app.layout = html.Div([
      html.H1(id='live-update-text'),
      dcc.Interval(id='interval-component', interval=10000, n_intervals=0)
      ])

      @app.callback(Output('live-update-text', 'children'),
      [Input('interval-component', 'n_intervals')])
      def update_current_delay(n):
      #return f"counter: n"
      return f"WORKING, trial: n ; jmx_ThreadCount()"

      if __name__ == '__main__':
      app.run_server()


      a) ACTUAL RESULTS



      --- command line output:



      C:Usersm011472DocumentsPython ScriptsWeb>cd "c:Usersm011472DocumentsPython ScriptsWeb" && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && C:Python36python.exe C:Usersm011472.vscodeextensionsms-python.python-2018.4.0pythonFilesPythonToolsvisualstudio_py_launcher.py "c:Usersm011472DocumentsPython ScriptsWeb" 53564 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput "c:Usersm011472DocumentsPython ScriptsWebTEST_dashboard.py" "
      * Serving Flask app "TEST_dashboard" (lazy loading) * Environment: production WARNING: Do not use the development server in a production environment.
      Use a production WSGI server instead.
      * Debug mode: off
      * Running on http://127.0.0.1:8050/ (Press CTRL+C to quit)
      127.0.0.1 - - [28/Mar/2019 14:57:02] "GET / HTTP/1.1" 200 -
      127.0.0.1 - - [28/Mar/2019 14:57:03] "GET /_dash-layout HTTP/1.1" 200 -
      127.0.0.1 - - [28/Mar/2019 14:57:03] "GET /_dash-dependencies HTTP/1.1" 200 -
      127.0.0.1 - - [28/Mar/2019 14:57:03] "POST /_dash-update-component HTTP/1.1" 200 -

      C:Usersm011472DocumentsPython ScriptsWeb>


      --- dashboard output:



      WORKING, trial: 0 ; 418



      b) EXPECTED RESULTS



      --- command line output:



      Program should execute POST every 10 sec and never end



      --- DASHBOARD OUTPUT:



      Numbers should be updated each 10 sec



      WORKING, trial: 0 ; XXX (any number)
      WORKING, trial: 1 ; XXY
      WORKING, trial: 2 ; XXZ










      share|improve this question
















      I am trying to use dash for live monitoring of JBeans attributes. When using dcc.Interval program closes automatically after first POST /_dash-update-component try.



      • Python 3.6

      • Dash 1.0.2

      I connected to Jconsole. Referring to Jbean attributes and extracting values works. It even works when I launch dash app for first time, but then when Interval is triggered dash program closes.



      • JBean tested - works fine

      • Dash code tested - it extracts n_intervals just fine

      Steps:



      1. JMX FUNCTIONS MODULE

      import jpype as jpype
      from jpype import java
      from jpype import javax
      import sys, os
      import pandas as pd
      import datetime

      #JMX CONNECTION FUNCTION:

      def jmx_connect(HOST, USER, PORT, PASS):
      URL = 'service:jmx:rmi:///jndi/rmi://'+HOST+':'+PORT+'/jmxrmi'
      jpype.startJVM(jpype.get_default_jvm_path())
      jhash = java.util.HashMap()
      jarray=jpype.JArray(java.lang.String)([USER,PASS])
      jhash.put(javax.management.remote.JMXConnector.CREDENTIALS, jarray);
      jmxurl = javax.management.remote.JMXServiceURL(URL)
      jmxsoc = javax.management.remote.JMXConnectorFactory.connect(jmxurl,jhash)
      connection = jmxsoc.getMBeanServerConnection();
      return connection

      #Enter login details HERE:
      HOST =
      USER =
      PORT =
      PASS =

      #initializing connection with my login details
      connection = jmx_connect(HOST, USER, PORT, PASS)


      #Thread Count function to extract number of active threads:
      #THREAD COUNT
      def jmx_ThreadCount():
      object="java.lang:type=Threading"
      attribute= "ThreadCount"
      attr = connection.getAttribute(javax.management.ObjectName(object),attribute)
      return attr


      1. DASH MODULE

      from TEST_jvmRun import * #this is import of my JVM functions
      import dash
      import dash_core_components as dcc
      import dash_html_components as html
      from dash.dependencies import Input, Output
      import plotly.graph_objs as go

      app = dash.Dash()

      app.layout = html.Div([
      html.H1(id='live-update-text'),
      dcc.Interval(id='interval-component', interval=10000, n_intervals=0)
      ])

      @app.callback(Output('live-update-text', 'children'),
      [Input('interval-component', 'n_intervals')])
      def update_current_delay(n):
      #return f"counter: n"
      return f"WORKING, trial: n ; jmx_ThreadCount()"

      if __name__ == '__main__':
      app.run_server()


      a) ACTUAL RESULTS



      --- command line output:



      C:Usersm011472DocumentsPython ScriptsWeb>cd "c:Usersm011472DocumentsPython ScriptsWeb" && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && C:Python36python.exe C:Usersm011472.vscodeextensionsms-python.python-2018.4.0pythonFilesPythonToolsvisualstudio_py_launcher.py "c:Usersm011472DocumentsPython ScriptsWeb" 53564 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput "c:Usersm011472DocumentsPython ScriptsWebTEST_dashboard.py" "
      * Serving Flask app "TEST_dashboard" (lazy loading) * Environment: production WARNING: Do not use the development server in a production environment.
      Use a production WSGI server instead.
      * Debug mode: off
      * Running on http://127.0.0.1:8050/ (Press CTRL+C to quit)
      127.0.0.1 - - [28/Mar/2019 14:57:02] "GET / HTTP/1.1" 200 -
      127.0.0.1 - - [28/Mar/2019 14:57:03] "GET /_dash-layout HTTP/1.1" 200 -
      127.0.0.1 - - [28/Mar/2019 14:57:03] "GET /_dash-dependencies HTTP/1.1" 200 -
      127.0.0.1 - - [28/Mar/2019 14:57:03] "POST /_dash-update-component HTTP/1.1" 200 -

      C:Usersm011472DocumentsPython ScriptsWeb>


      --- dashboard output:



      WORKING, trial: 0 ; 418



      b) EXPECTED RESULTS



      --- command line output:



      Program should execute POST every 10 sec and never end



      --- DASHBOARD OUTPUT:



      Numbers should be updated each 10 sec



      WORKING, trial: 0 ; XXX (any number)
      WORKING, trial: 1 ; XXY
      WORKING, trial: 2 ; XXZ







      python jmx plotly-dash jconsole






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 2 at 18:06









      marc_s

      605k137 gold badges1158 silver badges1291 bronze badges




      605k137 gold badges1158 silver badges1291 bronze badges










      asked Mar 28 at 14:25









      Adam BrzyskiAdam Brzyski

      61 bronze badge




      61 bronze badge

























          1 Answer
          1






          active

          oldest

          votes


















          0
















          Should someone be interested - I found partial solution. Issue caused by dcc.Interval because it creates new thread at each interval and JMX call requires JVM instance to be attached to current thread.



          1. Added jpype.attachThreadToJVM()

          def jmx_ThreadCount():
          print("State=", jpype.isThreadAttachedToJVM())
          if not jpype.isThreadAttachedToJVM():
          print ("Needs to attach...")
          jpype.attachThreadToJVM()
          print ("Check Attached=", jpype.isThreadAttachedToJVM())
          object="java.lang:type=Threading"
          attribute= "ThreadCount"
          attr = connection.getAttribute(javax.management.ObjectName(object),attribute)
          return attr


          Now the question is: how do I prevent dcc.Interval from creating new thread at each interval?






          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%2f55400057%2fjbeans-jmx-monitoring-with-plotly-dash-for-python%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
















            Should someone be interested - I found partial solution. Issue caused by dcc.Interval because it creates new thread at each interval and JMX call requires JVM instance to be attached to current thread.



            1. Added jpype.attachThreadToJVM()

            def jmx_ThreadCount():
            print("State=", jpype.isThreadAttachedToJVM())
            if not jpype.isThreadAttachedToJVM():
            print ("Needs to attach...")
            jpype.attachThreadToJVM()
            print ("Check Attached=", jpype.isThreadAttachedToJVM())
            object="java.lang:type=Threading"
            attribute= "ThreadCount"
            attr = connection.getAttribute(javax.management.ObjectName(object),attribute)
            return attr


            Now the question is: how do I prevent dcc.Interval from creating new thread at each interval?






            share|improve this answer





























              0
















              Should someone be interested - I found partial solution. Issue caused by dcc.Interval because it creates new thread at each interval and JMX call requires JVM instance to be attached to current thread.



              1. Added jpype.attachThreadToJVM()

              def jmx_ThreadCount():
              print("State=", jpype.isThreadAttachedToJVM())
              if not jpype.isThreadAttachedToJVM():
              print ("Needs to attach...")
              jpype.attachThreadToJVM()
              print ("Check Attached=", jpype.isThreadAttachedToJVM())
              object="java.lang:type=Threading"
              attribute= "ThreadCount"
              attr = connection.getAttribute(javax.management.ObjectName(object),attribute)
              return attr


              Now the question is: how do I prevent dcc.Interval from creating new thread at each interval?






              share|improve this answer



























                0














                0










                0









                Should someone be interested - I found partial solution. Issue caused by dcc.Interval because it creates new thread at each interval and JMX call requires JVM instance to be attached to current thread.



                1. Added jpype.attachThreadToJVM()

                def jmx_ThreadCount():
                print("State=", jpype.isThreadAttachedToJVM())
                if not jpype.isThreadAttachedToJVM():
                print ("Needs to attach...")
                jpype.attachThreadToJVM()
                print ("Check Attached=", jpype.isThreadAttachedToJVM())
                object="java.lang:type=Threading"
                attribute= "ThreadCount"
                attr = connection.getAttribute(javax.management.ObjectName(object),attribute)
                return attr


                Now the question is: how do I prevent dcc.Interval from creating new thread at each interval?






                share|improve this answer













                Should someone be interested - I found partial solution. Issue caused by dcc.Interval because it creates new thread at each interval and JMX call requires JVM instance to be attached to current thread.



                1. Added jpype.attachThreadToJVM()

                def jmx_ThreadCount():
                print("State=", jpype.isThreadAttachedToJVM())
                if not jpype.isThreadAttachedToJVM():
                print ("Needs to attach...")
                jpype.attachThreadToJVM()
                print ("Check Attached=", jpype.isThreadAttachedToJVM())
                object="java.lang:type=Threading"
                attribute= "ThreadCount"
                attr = connection.getAttribute(javax.management.ObjectName(object),attribute)
                return attr


                Now the question is: how do I prevent dcc.Interval from creating new thread at each interval?







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 18 at 14:29









                Adam BrzyskiAdam Brzyski

                61 bronze badge




                61 bronze badge





















                    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%2f55400057%2fjbeans-jmx-monitoring-with-plotly-dash-for-python%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

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해