How to get total no. of threads in JVM?

I am trying to monitor the thread activity to detect any thread-leak in our system. Is there a way to get total number of threads so far being created in the JVM?
Thanks in advance.
- David

Thanks for the suggestion of getParent(). I actually found that the "activeCount()" method always returm me a number larger than I expect. I have to enumerate the thread group to get an array of Thread objects and count the array one by one. Then I will get the correct number of threads as I expected.
Don't know exactly the meaning of "active" threads.
- David

Similar Messages

  • How to get total in ALV report in same Internal table?

    Data : Begin of it_data,
            kunnr type kunnr,
            name1 type name1,
            amt1  type btrt01, " CURR 15,2
           end of it_data.
    loop at it_data into wa_data
    endloop.      
    Hello friends,
    I am developing one ALV report with 20 rows.
    I have filled one internal table with some fileds like amount.
    I want to get total of all amount1 in AMT1 field.
    So, How to get total of amount in same internal table in ALV report ?
    It is ok if i get duplicate rows in internal table.
    Points 'll be awarded soon.
    Regards,
    NVM

    Hi Ronny,
    the alv output will display the sum at the last row.
    for this functionality u have do this logic.
    data: lw_fcat type slis_fieldcat_alv.
    data: lt_fcat type slis_t_fieldcat_alv/
    wa_fcat-fieldname = 'AMT1'.
    wa_fcat-tabname = 'ITAB'.
    wa_fcat-do_sum = 'X'.
    append wa_fcat to lt_fcat.
    and then pass it to reuse_alv_grid_display function,
    regards,
    Santosh Thorat

  • How to get total number of days

    Hi All,
    how to get total number of days , for example if month eq 05 then need to get total number of days until MAY 31.
    and how to get total number of days in a month.
    Thank You,,
    Sriii..

    Hi Sridhar,
    Pls Try to search before posting general questions.
    Try this,
    CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
        EXPORTING
          i_datum_bis                   = p_lv_date1
          i_datum_von                   = p_lv_date2
       IMPORTING
         e_tage                        = p_e_date_difference
       EXCEPTIONS
         days_method_not_defined       = 1
         OTHERS                        = 2
      IF sy-subrc  0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Regards,
    Sunil kairam.

  • How to get total of any field in sapscript?

    Hello ,
    i m making sapscript...
    How to get total of any field in sapscript?

    Hi
    Yes, you can define a variabe in your print program and pass it to the SAPScript.
    LIKE:
    Define L_SUM in the Global data.
    DATA: L_SUM TYPE BSEG-DMBTR.
    LOOP AT ITAB.
    L_SUM = L_SUM + ITAB-AMOUNT.
    ENDLOOP.
    CALL FUNCTION 'WRITE_FORM'
    WINDOW = 'MAIN'
    ELEMENT = 'TOTAL'.
    Now, in your SAPScript, create a text element in MAIN window
    /E TOTAL
    Total,, &L_SUM&.
    Go through below link
    http://sap-img.com/sapscripts/sapscript-how-to-calculate-totals-and-subtotals.htm
    Regards,
    Chandru

  • How to get total at each hierarchy

    Hello Gurus,
    Does anybody know how to get total at each  level.
    I mean, if I have the following structure...
    Level 1
    Level 2
    Level 3
    Level 4
    Level 5
    At level 5 we have the following calculation
    Volume      Price    Amount(From Formula Volume * price)
    5                 2           10,00
    6                 3           12,00
    7                 4            28,00
    My question is how to get  a sum of (10,00 + 12,00 +28,00 = 50,00) at level 4?
    Thanks in advance.
    With regards,
    Anand

    Does anybody know how to get total at each level.
    I mean, if I have the following structure...
    Level 1
    Level 2
    Level 3
    Level 4
    Level 5
    At level 5 we have the following calculation
    Volume       Price       Amount(From Formula Volume * price)
    5                     2                 10,00
    6                     3                 12,00
    7                     4                  28,00
    I am getting following results : It is adding volume and price then multiplying volume * price and giving results.
    18                  9                18 * 9 = 162,00
    But I have to get sum of  ( 10,00 + 12,00 +28,00 = 50,00) at level 4.
    My question is how to get a sum of (10,00 + 12,00 +28,00 = 50,00) at level 4?
    Thanks.
    With regards,
    Anand

  • How to get total available RAM

    Hi
    How to get total available RAM of the system. I used Runtime.getInstance().totalMemory(), it is not giving total memory of the system. I appreciate any help on this pl.
    Thx
    PK

    If there would be any operating system command
    displaying the desired result,
    we could execute it as runtime command and parse the
    output.
    But I don't know if such a command exists.
    I tried "mem", but it does not show the value I
    expected.For windows XP the following command (either in the cmd window or executed by Runtime.exec) will provide the physical memory size.
    systeminfo | find "Total Physical Memory"I don't know if it works in other Windows versions.

  • How to get total numbers and total price in query reports

    Hi,
    how to get total numbers and total price in query reports.for example:
    particular item is issued 3 times a week...I need total quantity of item issued
    my query...
    SELECT T0.[DocNum], T1.[ItemCode], T1.[Quantity], T1.[Price] FROM OIGE T0  INNER JOIN IGE1 T1 ON T0.DocEntry = T1.DocEntry WHERE T1.[ItemCode]  Like '%%[%1]%%'  and  T1.[U_WOType]='[%0]'

    Hi,
    Try this:
    SELECT T1.[ItemCode], SUM (T1.[Quantity]) as [Total Quantity], SUM (T1.[Quantity] * T1.[Price]) as [Total Price] FROM OIGE T0  INNER JOIN IGE1 T1 ON T0.DocEntry = T1.DocEntry WHERE T1.[ItemCode]  Like '%%[%1]%%'  and  T1.[U_WOType]='[%0]'
    Group By T1.[ItemCode]
    Beni.

  • How to get total number of result count for particular key on cluster

    Hi-
    My application requirement is client side require only limited number of data for 'Search Key' form total records found in cluster. Also i need 'total number of result count' for that key present on the custer.
    To get subset of record i'm using IndexAwarefilter and returning only limited set each individual node. though i get total number of records present on the individual node, it is not possible to return this count to client form IndexAwarefilter (filter return only Binary set).
    Is there anyway i can get this number (total result size) on client side without returning whole chunk of data?
    Thanks in advance.
    Prashant

    user11100190 wrote:
    Hi,
    Thanks for suggesting a soultion, it works well.
    But apart from the count (cardinality), the client also expects the actual results. In this case, it seems that the filter will be executed twice (once for counting, then once again for generating actual resultset)
    Actually, we need to perform the paging. In order to achieve paging in efficient manner we need that filter returns only the PAGESIZE records and it also returns the total 'count' that meets the criteria.
    If you want to do paging, you can use the LimitFilter class.
    If you want to have paging AND total number of results, then at the moment you have to use two passes if you want to use out-of-the-box features because LimitFilter does not return the total number of results (which by the way may change between two page retrieval).
    What we currently do is, the filter puts the total count in a static variable and but returns only the first N records. The aggregator then clubs these info into a single list and returns to the client. (The List returned by aggregator contains a special entry representing the count).
    This is not really a good idea because if you have more than one user doing this operation then you will have problems storing more than one values in a single static variable and you used a cache service with a thread-pool (thread-count set to larger than one).
    We assume that the aggregator will execute immediately after the filter on the same node, this way aggregator will always read the count set by the filter.
    You can't assume this if you have multiple client threads doing the same kind of filtering operation and you have a thread-pool configured for the cache service.
    Please tell us if our approach will always work, and whether it will be efficient as compared to using Count class which requires executing filter twice.
    No it won't if you used a thread-pool. Also, it might happen that Coherence will execute the filtering and the aggregation from the same client thread multiple times on the same node if some partitions were newly moved to the node which already executed the filtering+aggregation once. I don't know anything which would even prevent this being executed on a separate thread concurrently.
    The following solution may be working, but I can't fully recommend it as it may leak memory depending on how exactly the filtering and aggregation is implemented (if it is possible that a filtering pass is done but the corresponding aggregation is not executed on the node because of some partitions moved away).
    At sending the cache.aggregate(Filter, EntryAggregator) call you should specify a unique key for each such filtering operation to both the filter and the aggregator.
    On the storage node you should have a static HashMap.
    The filter should do the following two steps while being synchronized on the HashMap.
    1. Ensure that a ConcurrentLinkedQueue object exists in a HashMap keyed by that unique key, and
    2. Enqueue the total number count you want to pass to the aggregator into that queue.
    The parallel aggregator should do the following two steps while being synchronized on the HashMap.
    1. Dequeue a single element from the queue, and return it as a partial total count.
    2. If the queue is now empty, then remove it from the HashMap.
    The parallel aggregator should return the popped number as a partial total count as part of the partial result.
    The client side of the parallel aware aggregator should sum the total counts in the partial result.
    Since the enqueueing and dequeueing may be interleaved from multiple threads, it may be possible that the partial total count returned in a result does not correspond to the data in the partial result, so you should not base anything on that assumption.
    Once again, that approach may leak memory based on how Coherence is internally implemented, so I can't recommend this approach but it may work.
    Another thought is that since returning entire cached values from an aggregation is more expensive than filtering (you have to deserialize and reserialize objects), you may still be better off by running a separate count and filter pass from the client, since for that you may not need to deserialize entries at all, so the cost on the server may be lower.
    Best regards,
    Robert

  • How to get total number of nodes in a JTree?

    Hi,
    I am trying to get total number of nodes in a JTree, and cannot find a way to do it.
    The current getRowCount() method returns the number of rows that are currently being displayed.
    Is there a way to do this or I am missing something?
    thanks,

    How many nodes does this tree have?
    import java.awt.EventQueue;
    import javax.swing.*;
    import javax.swing.event.TreeModelListener;
    import javax.swing.tree.*;
    public class BigTree {
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    TreeModel model = new TreeModel() {
                        private String node = "Node!";
                        @Override
                        public void valueForPathChanged(TreePath path,
                                Object newValue) {
                            // not mutable
                        @Override
                        public void removeTreeModelListener(TreeModelListener l) {
                            // not mutable
                        @Override
                        public boolean isLeaf(Object node) {
                            return false;
                        @Override
                        public Object getRoot() {
                            return node;
                        @Override
                        public int getIndexOfChild(Object parent, Object child) {
                            return child == node ? 0 : -1;
                        @Override
                        public int getChildCount(Object parent) {
                            return 1;
                        @Override
                        public Object getChild(Object parent, int index) {
                            return node;
                        @Override
                        public void addTreeModelListener(TreeModelListener l) {
                            // not mutable
                    JFrame frame = new JFrame("Test");
                    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                    frame.getContentPane().add(new JScrollPane(new JTree(model)));
                    frame.pack();
                    frame.setLocationRelativeTo(null);
                    frame.setVisible(true);
    }But for bounded tree model using DefaultMutableTreeNode look at bread/depth/preorder enumeration methods to walk the entire tree. Or look at the source code for those and adapt them to work with the TreeModel interface.

  • How to get total number of pages from .doc file without using Office interop?

    Hi,
    Kindly help me in getting the total number of pages from a .doc file not .docx file using C#. I know how to get by using Office interop but I do not want to use Office interop.
    So, without office automation in C# let me know how to get the total number of pages from a .doc file.
    Regards,
    Ashok

    Hi Ashok,
    >> I know how to get by using Office interop but I do not want to use Office interop
    Could you tell us why you don't want to use Office interop?
    As far as I know, this is the easiest way to achieve.Hmmm,this is my answer
    http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.pagenumbers.startingnumber(v=office.14).aspx
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to get total number of licenses

    Hi everyone,
    Who knows how to get the total number of licenses, I am using SBO 2005 PL07+VB.Net. from SDK help file I saw there is a SAP Business One License API, but I cann't find this API from object browse, who knows which file contents the license API.
    Thanks in advance!
    Kathy

    Hi Kathy,
    Since (un-?)fortunately the license server has been moved from DCOM to CORBA, this information is currently obsolete (I still hope we will get this information through the SDK some time in future...).
    As an interim solution you will have to get this information from the B1LicenseFile.txt file through some small application you write (you could have e.g. a service that writes the information you are interested in into some table in some database - and retrieve this information through a SQL statement).
    HTH,
    Frank

  • MCBZ report how to get total stock qty calculation?

    Dear Guru,
            if i checking one material in Tcode:MMBE having unrestricted stock is 356 & reserved qty is 56. After this when i am executing report MCBZ-- Current stock reqmt list & get Total stock qty is 120 for same material.
    can any one tell me how it is calculated (i.e. Total Stock).
    My requirement is we want to see a report which shows diffrence bewtwwen satfey stock & total stock. so i am using this report, if any othere suggestion then please reply me.
    Best Regards,
    Dev

    Dear,
           You can see in MD04 t-code here u can find safety stock and inventory stock.
    Regards
    Ravi

  • How to get totals at top in script????

    Hello Experts,
    I am developing Account Statement script .
    There are many text elements exist in script like 510, 511, ..............580.
    I want totals of debit, credit, opening and closing balance in first text element i.e 510 and in std it is calculated in 540.
    Can you plz tell me how to get this values in 510?
    Plz help me!!
    Thanks & Regards,
    Manisha
    Edited by: PATIL MANISHA on Jul 19, 2010 12:09 PM

    hi ,
    you can collect the final total value into anthore variable in the driver program ,print that into your text element 510 . if you don't want print actuval text element just you can use condition fo aviod that , try this may be it help you.
    Regards ,
    Nagu

  • MDX How to get total distict count and SUM of subgroups?

    with
    MEMBER Measures.[EmailCount] as IIF(ISEMPTY([Measures].[Tran Count]), 0 ,[Measures].[Tran Count])
    MEMBER Measures.AdvGroupTotal as
    SUM (
    FILTER( EXISTING ([Dim IFA Details].[Parent Key].[Adviser Group].Members * [Dim Date].[Fiscal].[Fiscal Year].members )
    , Measures.[Amount] > 100 )
    , Measures.[Amount])
    MEMBER Measures.[AdvGrpCount] as
    distinctCOUNT(Existing([Dim IFA Details].[Parent Key].[Adviser Group].Members * [Dim Date].[Fiscal].[Fiscal Year].members))
    member Measures.IncomePerEmail as Measures.AdvGroupTotal /Measures.[EmailCount]
    member Measures.AvgIncomePerFirm as Measures.AdvGroupTotal/ Measures.AdvGrpCount
    SELECT { [Measures].[Amount] , Measures.[EmailCount], Measures.AdvGroupTotal, Measures.[AdvGrpCount],
    Measures.IncomePerEmail, Measures.AvgIncomePerFirm }
    ON COLUMNS,
    [Dim Date].[Fiscal Year].[Fiscal Year].ALLMEMBERS * [Dim Date].[Fiscal Quarter].[Fiscal Quarter].ALLMEMBERS *
    Except( [Dim Income Range].[Hierarchy].[Range ID].Members , [Dim Income Range].[Hierarchy].[All].UNKNOWNMEMBER.UNKNOWNMEMBER )
    on rows
    FROM [Income and Emails Cube]
    where
    [Dim Date].[Fiscal].[Fiscal Year].&[FY 13/14]
    The query above returns :
    How can I get Totals for AdvGroupTotal and AdvGroupCount for the year ?
    In the above case I want to tally up 1586 + 67 + 155 + 12 + 1718 for AdvGroupCount, same applies for the corresponding
    AdvGroupTotal figures.
    Seems simple enough, but I seem unable to come up with a way around this.
    Jon

    I worked it out with the help of Simon from another forum.
    Using a filtered set will get me the result required. It is however not very quick, so I probably should look into building it into the cube.
    WITH SET [Filtered Groups] AS
    ( Filter (
    { [Dim IFA Details].[Parent Key].[Adviser Group] } *
    { [Dim Date].[Fiscal Year].CurrentMember },
    [Measures].[Amount] > 100
    MEMBER [Measures].[Annual] AS
    Sum ( [Filtered Groups], Measures.[Amount] )
    MEMBER [Measures].[Firm Count] AS
    DistinctCount ( [Filtered Groups] )
    MEMBER [Measures].[Avg Income Per Firm] AS
    [Measures].[Annual] / [Measures].[Firm Count]
    MEMBER [Measures].[Test] AS
    Sum (
    { [Dim Date].[Fiscal Quarter].[Fiscal Quarter] } * { [Dim Income Range].[Hierarchy].[Range ID] } * { [Filtered Groups] },
    [Measures].[Amount]
    MEMBER [Measures].[TotalCount] AS
    DistinctCount (
    { [Dim Income Range].[Hierarchy].[Range ID] } * { [Filtered Groups] }
    MEMBER [Measures].[TotalAvg] as [Measures].[Test]/ [Measures].[TotalCount]
    MEMBER [Measures].[Quarter] as [Measures].[Amount]
    SELECT
    { [Measures].[Quarter], [Measures].[Annual], [Measures].[Firm Count], [Measures].[Avg Income Per Firm],
    [Measures].[Test], [Measures].[TotalCount], [Measures].[TotalAvg] } ON COLUMNS,
    [Dim Date].[Fiscal Year].[Fiscal Year].AllMembers * [Dim Date].[Fiscal Quarter].[Fiscal Quarter].AllMembers *
    Except ( [Dim Income Range].[Hierarchy].[Range ID].Members, [Dim Income Range].[Hierarchy].[All].UnknownMember.UnknownMember )
    DIMENSION PROPERTIES Member_Unique_Name, MEMBER_CAPTION
    ON ROWS
    FROM [Income and Emails Cube]
    WHERE [Dim Date].[Fiscal].[Fiscal Year].&[FY 13/14]

  • Bex query question:How to get total value ?

    For material level we can get value(quantityamount), but for the result is total quantitytotal amount, the result is wrong. How to get the total value correctly?
    I checked some material.which need coding. but I want to know if I can get easier way for that.
    Thanks.

    hi, i jus tried. .this works for me..
    set calculate result as summation and formula collision nothing defined...
    *reward if helpful*

Maybe you are looking for

  • Big reports!!

    Hi all, I want to publish one report that generates lots of rows (it has about 15 columns). And I also want it to be exported to Excel. The problem is when the report has a lot of rows, it doesn't work: - Is there any configuration file to limit the

  • IPhone purchase question.....?

    I recently ordered my iPhone 4 through the Apple site. But I already have on on preorder at Best Buy. So my question is, if Best Buy calls me and says my iPhone 4 is in, can I pick it up from them, then cancel my purchase that I made through the Appl

  • X-Fi Elite Pro Noise issues

    Greetings, I've had this x-Fi Elite Pro for 3 years now, and since about 6 months ago it started missbehaving like I'll describe. If the computer has been on for a long time the speaker output of the card starts making a crackling noise. Here's a pho

  • Errorneous messages is shopping cart

    Hi Friends,      I am getting messages that could be irrelevant in shopping cart. We are on SRM5.0 ECS, SP15. All our landscapes were up and running fine. All of sudden our sandbox started giving strange errors. There has been no config or developmen

  • Lost device password BB9900 bold. Now what? I have full data backup on laptop.

    Hi can someone advise what I should do after 10th wrong device password? what will happen ? I have data back-up on laptop. Can I reload all?? Thanks . Ashutosh