Counting how many active sessions in a webapp

Hi folks,
I was wondering if it is possible to count how many active sessions that there currently are in a webapp? I've looked at the ServletContext and ServletConfig classes, but I can't find anything. Any ideas?
Cheers,
Raj.

HttpSessionListener was introduced in servlet spec 2.3 which is supported in Tomcat 4.0 but not 3.3.
If upgrading to 4.0 is not an option, there is no elegant way to get what you need. There is no API call that returns all the active sessions so you must do it yourself. One way is to create a class that implements HttpSessionBindingListener to track your sessions. Instantiate it on start-up and add its reference as a session attribute when the session is first created. You can then update your custom session info in the valueBound and valueUnbound methods.

Similar Messages

  • NSOperationQueue. How many active operations in progress?

    Hello,
    I am using NSOperationQueue for my threading and have setMaxConcurrentOperationCount: NSOperationQueueDefaultMaxConcurrentOperationCount so that the Queue itself decides how many threads are used based on available resources.
    How do I know exactly how many active operations there are at certain time?
    -maxConcurrentOperationCount returns -1
    [operations count] returns the number of operations added to array - not how many of them are active
    Do I need to manually iterate and ask each operation if it's active or is there some faster way?
    Thanks.
    -Mike

    Depending on your needs you could :
    - poll each operation when needed
    - alternatively you may observe the isExecuting property to be notified immediately in case of change.

  • Is there a way of finding out how many active hours you've worked on a Premiere project?

    If not, it'd be a very cool addition for Adobe to implement... so you know exactly how many hours a project is taking (and how much to charge clients etc.) Obviously we're all prone to leaving Premiere on and wandering away, so I guess it would need to be able to differentiate between active and non-active time...

    Is there a way of finding out how many active hours you've worked on a Premiere project?
    There are two things a client get's billed for, my time, and my computer's time.  If either one of us are working on a project, the client get's billed.  Even if Adobe spent (wasted?) time on adding such a feature, they'd never be able to include any time I've spent working on the project with PP closed, so this feature would have very, very, VERY limited usefulness.
    The method suggested by the images is still the best way.

  • I see people from different ages at my work and every month I need to count how many people from each age I've seen that month. How can I do to give the entries to numbers in a single cell and make numbers count them for me?

    I see people from different ages at my work and every month I need to count how many people from each age I've seen that month. How can I do to give the entries to numbers in a single cell and make numbers count them for me? The final result would be a spreadsheet telling there were 8 people from 20 to 39 years old, 14 peolple from 40 to 59 and so on...

    jpqcampos wrote:
    This appears to be an 'input form' using 'Radio Buttons' to select the category. Neither of these features are supported in Numbers '09.
    You can input the data on one table and summarize it on a second table, but the input table will continue to hold data for each event.
    And by using the Reorganize button, you can hide all but two rows of that table to approximate the appearance and performance of an input form.
    Here are the two tables, Data on the left and Summary on the right. Notes below.
    The grey-filled columns in both tables are 'working' columns, and may be hidden (as shown in the image below).
    Data table:
    D1 contains the word "TRUE" (in capital letters). (This row is always shown.)
    D2 is empty, or may contain any value except "TRUE" (This row is always hidden under the Reorganize rule.)The rest of Row 2 of this table requires the data shown: a number outside the range to be counted (999), and two checkboxes, both checked.
    D3 (and filled down the rest of column D):   =AND(OR(B2,C2),NOT(OR(B3,C3)))
    The formula returns TRUE only for the first unused row in the table (ie. the first row for which neither checkbox has been checked)
    Summary table:
    Column A contains labels for the age ranges to be counted.
    Column B contains the same information in the form necessary for the formulas in columns C and D. They need a numeric value, and that value must be the largest acceptable value in the range to be counted.
    C2 (and filled right to column D, then both filled down to row 5):
        =COUNTIFS(Data :: $A,"<="&$B,Data :: B,TRUE)-SUM(C$1:C1)
    Two changes from the previous example:
    COUNTIFS is used to separate the Native and Foreign counts as well as the age range to be counted.
    The amount subtracted from each result is the SUM of the earlier results, and includes the text value in the first cell of the column (which is interpreted by SUM as a zero).
    See note below regarding my earlier formula.
    When the greyed columns are hidden and the checkbox in the Reorganize pane is checked, the two tables will appear as shown below:
    Close the reorganize pane, and the 'data entry form' is ready to use.
    To use, enter the age first, then check one of the boxes.
    As soon as one box is checked, the row will be hidden, and the next (unused) row will be shown.
    Regards,
    Barry
    Note regarding formula in my earlier post:
    The earlier formula will give erroneous results as it subtracts only the count directly above it from its count of persons in the age range 0-n.
    In E2 of that table, replace "-E1" with "-SUM(E1:E$1)
    Fill down to E8.
    Ignore the instructions (in that post) following "Fill down to E8."
    B

  • Counting how many times my app has been opened

    I want to be able to count how many times a user has opened my application, and so every time the application launches, this number is added by one.
    Does anyone know how I store a long-time variable like this that will still need to be available across different runs of the application? I imagine this value would be stored in the application's preference file in Library, but I don't know how to do this.
    Can any of you please lend me some advice/code to achieve this (I am using Objective-C)?
    Thanks in advance,
    Ricky.

    Hi.
    It has been a while - but I finally got around to slapping some code together. I have successfully created and retrieved the value from the preference file, but for some reason, adding 1 to my value each run is not working. It only adds by one after each BUILD. So I have to rebuild it every time I want it to increment. See my code below;
    [NSUserDefaults init];
    int numberOfTimes;
    numberOfTimes = [[NSUserDefaults standardUserDefaults] integerForKey:@"used"];
    numberOfTimes = numberOfTimes++; //It is that that is not working.
    [[NSUserDefaults standardUserDefaults] setInteger:numberOfTimes forKey:@"used"];
    NSLog (@"%d", [[NSUserDefaults standardUserDefaults] integerForKey:@"used"]);
    I can't seem to stop anything wrong, but then again it is late.
    Do any of you see any errors here?
    Thanks,
    Ricky.

  • Any idea why in Numbers my COUNTIFS formula keeps breaking? For daycare purpose, I use a spreadsheet that helps me to count how many children I have at 3:15, 4:15 and 5:00. COUNTIFS works well when I create it but breaks after a while. Also I am using a p

    Any idea why in Numbers my COUNTIFS formula keeps breaking? For daycare purpose, I use a spreadsheet that helps me to count how many children I have at 3:15, 4:15 and 5:00. COUNTIFS works well when I create it but breaks after a while. Also I am using a pop-up menu in the cells in time format, does it have any consequence on the formula?

    Any idea why in Numbers my COUNTIFS formula keeps breaking? For daycare purpose, I use a spreadsheet that helps me to count how many children I have at 3:15, 4:15 and 5:00. COUNTIFS works well when I create it but breaks after a while. Also I am using a pop-up menu in the cells in time format, does it have any consequence on the formula?

  • How do count how many 'A' s in this string using sql stmt?

    hi all,
    i have a string like 'AAAAARAMAAAAKRISHNAAAA'.
    in this ,i want to find out how many 'A's .
    how do find out this using select stmt.

    (length(s) - nvl(length(replace(s, 'A')), 0)) / length('A')but consider (by modifying the question slightly to "how do count how many 'AA' s in this string using sql stmt? ")
    SQL>  select (length('AAAAARAMAAAAKRISHNAAAA') - nvl(length(replace('AAAAARAMAAAAKRISHNAAAA', 'AA')), 0)) / length('AA') x from dual
             X
             6
    1 row selected.couldn't I argue that the result should be 10 as e.g. in
    SQL>  select * from xmltable('let $str := "AAAAARAMAAAAKRISHNAAAA"
                            let $search := "AA"
                            for $i in 1 to string-length($str)
                              where substring($str, $i, string-length($search)) = $search
                              return substring($str, $i, string-length($search))' columns x varchar2(10) path '.')
    X        
    AA       
    AA       
    AA       
    AA       
    AA       
    AA       
    AA       
    AA       
    AA       
    AA       
    10 rows selected.Matter of definition I suppose .... ;)
    btw. regexp_count also yields 6:
    SQL>  select regexp_count('AAAAARAMAAAAKRISHNAAAA', 'AA') x from dual
             X
             6
    1 row selected.

  • Hi, I want to know if in the AppStore exist an app that count how many messages I have been used. Thanks

    Hi, I want to know if in the AppStore exist an app that count how many messages I have been used

    Some carriers have iOS apps that will tell you this info...see if yours does, or can't you just login to your account online & see such info?

  • Hey! On excel I want to count how many time a text come back in the spreadshit (sum) thx, hey! On excel I want to count how many time a text come back in the spreadshit (sum) thx

    Excel:
    line of cellule with 3 different text. I want to count have many time a text come in the line... Thx for helping me, it is for my job!!

    Hopefully I am understanding your question.
    A typical way to count how many times a word appears in a line of text in a cell is to substitute spaces for the word, one less space than the length of the word. Example:
    A1 has the string "brown red brown green"
    A2 =LEN(A1) - LEN(SUBSTITUTE(A1,"brown","    "))  
    "brown" has five letters so there are four spaces in the substitution text)
    If you want to do several cells at once, counting the total number of times the word appears, concatenate the cells with a space between them
    A1 and A2 have text in them
    A3 =LEN(A1&" "&A2) - LEN(SUBSTITUTE(A1&" "&A2,"brown","    "))

  • Count how many time we have each element

    I can't count how many the same element is on my array, I have an array [21, 12, 4, 21, 21, 4]
    I expect to have something like this:
    number exist number
    21 3
    12 1
    4 1
    below is the code
    System.out.printf("%10s,%10s \n", "number exist", "number");
              for(i = 0; i < list.size(); i++){
                   for(int j = 0; j < list.size(); j++){
                        if (list.get(i) == list.get(j))
                             v++;
              System.out.printf("%10s,%10s \n",v,list.get(i));     
    Edited by: ronisto on 11-Mar-2008 1:34 PM
    Edited by: ronisto on 11-Mar-2008 1:39 PM

    good actually I 'm using a List, I could'nt find where is wrong, I can print for the first one, but if I try to use the for it' s not working...look the code below with a list like this [5 , 1, 7, 1, 1, 5]
              System.out.printf("%10s,%10s \n", "Column1", "Column2");
                   for(j = 0; j < list.size(); j++){
                             if (list.get(j) == list.get(0))
                                  v++;
                   System.out.printf("%10s,%10s \n",v,list.get(0));
    result give me:
    Column1 Column1
    3 1
    til here is good but when I try to print samething for all elements of my list it doesn't work
    System.out.printf("%10s,%10s \n", "number exist", "number");
                   for (i = 0; i < list.size(); i++){
                        for(j = 0; j < list.size(); j++){
                             if (list.get(j) == list.get(i))
                                  v++;
                   System.out.printf("%10s,%10s \n",v,list.get(i));
    Edited by: ronisto on 11-Mar-2008 6:04 PM

  • How to count how many times the caller calls by using UCCX script?

    Hi there,
    My customer wants to do a few changes for their script as below:
    At the beginning of the script they are planning to add a new menu item, it will announce their new privacy policies and to continue the user must press the number one to continue to the Welcome.  If they do not press 1 then the message should repeat itself and if they again do not press 1 they should be transferred over to a live operator who will explain things and then be able to transfer them back to the message so that they can press 1 and continue.
    I modified their script as attached file, but i don't know how to count how many times the caller calls in "Get Reporting Statistic".
    Any helps would be appreciated.
    Thanks.

    Hi Aaron,
    At beginning, i want to use a variable to get number of mistake for the same caller, then we will send the call to right place to fulfill the customers' needs. 
    Do you have any suggestion for the new posted script?
    Thanks.

  • Connection Pooling: how many active connections?

    Hi, everybody.
    I have a very simple question about connection pooling...
    How many active connections should a database see once a connection pool has been opened?
    I mean, it should see only one connection (the pool itself) at any time, or the number of "logical" active connections in that moment?
    Thanks for any answer.

    Sorry...
    This is the wrong forum, I posted again my question in the JDBC Forum...

  • How to count " How many times the ' commit work ' Statement is executed.

    Hi all sap Champions,
    One of the client requirement, That is
    How to count " How many times the ' commit work ' Statement is executed.
    It's urgent.
    Please can anybody help me for this.
    Thanks
    Basu

    hi,
    when report try like this.
    declare a variable as
    data: counter type i value 0.
    COMMIT.
    counter = counter + 1.
    write:/10 counter 'NO. OF TIMES COMMIT WORKED'.

  • How do I count how many songs are on my iPod?

    How do I count how many songs are on my iPod? Also, how do I figure out how much space I have left on it?

    Hi.
    in the ipod under settings>about it says how much room is available. how many songs are on the ipod. other things to.

  • How do you count how many times a if/when/for statement runs?

    So this new program I'm trying to write is a changemaker (in euros for some reason). You enter a price of a product, amount paid, and it computes how much change you should get back in the form
    [number] x 2-euro
    [number] x euro
    [number] x 20-cent
    etc
    Where the number is the number of that kind of coin they should get back.
    Right now, I have it so that you enter price, and amount paid, and then I have a series of while statements that go like..
    while (surplus > 2.00);
    while (surplus > 1.00);
    etc. If the surplus > 2, I want to add 1 2-euro coin to the count, subtract 2, and then recheck the amount and either add another 2-euro or go onto the next coin. Only thing is, I don't know how to count how many times a while statement ran until it was false. Or I could be looking at this the wrong way entirely. What's the best way to go about a program like this?

    Well I finally figured it out with lots of help from other students in the class. It was much easier than it appeared to be. Thanks for the hints everyone (especially joker for doing the coding for it) wow :D much appreciated ^^
    Heres the code that I came up with and it works matches the assignment's example:
    import java.util.* ;
    public class ChangeMaker {
         private static int changeA [] = new int [7] ;
         private static float changeVar[] = new float [7] ;
         private static int changeVarNumb[] = new int [7] ;
         private static String changeNames[] = new String [7] ;
         // initialize Scanner
         private static Float getInput (String prompt){
              System.out.print (prompt.concat(" ")) ;
              Scanner sc1 = new Scanner (System.in) ;
              return (sc1.nextFloat ()) ;
         // put the change variables and change names into arrays
         private static void moneyArray (){
              changeVar[0] = (float) 2.0 ;
              changeVar[1] = (float) 1.00 ;
              changeVar[2] = (float) 0.20 ;
              changeVar[3] = (float) 0.10 ;
              changeVar[4] = (float) 0.05 ;
              changeVar[5] = (float) 0.02 ;
              changeVar[6] = (float) 0.01 ;
              changeVarNumb[0] = 2 ;
              changeVarNumb[1] = 1 ;
              changeVarNumb[2] = 20 ;
              changeVarNumb[3] = 10 ;
              changeVarNumb[4] = 5 ;
              changeVarNumb[5] = 2 ;
              changeVarNumb[6] = 1 ;
              changeNames[0] = (String) "Euro" ;
              changeNames[1] = (String) "Euro" ;
              changeNames[2] = (String) "Cent" ;
              changeNames[3] = (String) "Cent" ;
              changeNames[4] = (String) "Cent" ;
              changeNames[5] = (String) "Cent" ;
              changeNames[6] = (String) "Cent" ;
              return ;
         // calculate the change the user is going to receive
         private static void calcChange(float diffAmount) {
              for (int i = 0; i < changeVar.length ; i++) {
                   if (diffAmount > changeVar) {
                        changeA[i] = (int)(diffAmount / changeVar[i]);
                        diffAmount = diffAmount - (changeA[i] * changeVar[i]) ;
                        System.out.println(changeA[i] + " x " + changeVarNumb[i] + " " + changeNames[i]) ;
              return;
         // output
         public static void main(String[] args) {
              float itemPrice = getInput("Enter product price: ") ;
              float amountTendered = getInput("Enter amount paid: ") ;
              float diffAmount = amountTendered - itemPrice ;
              System.out.println() ;
              System.out.println("Your change is " + diffAmount + " euros") ;
              moneyArray() ;
              calcChange(diffAmount) ;
    And the output looks like this:
    Enter product price:  2.32
    Enter amount paid:  5.00
    Your change is 2.68 euros
    1 x 2 Euro
    3 x 20 Cent
    1 x 5 Cent
    1 x 2 Cent
    1 x 1 Cent                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • Video Not Working & Can't Share Screen

    Hello, I am having a slight problem... What happens is that in my group, I cannot share my screen nor use my webcam, as the video button is greyed out and "Share screen" isn't there. It says I cannot have more than 10 people in the call, but I only h

  • Acrobat X Pro does not print Excel charts from 2010 Word doc to PDF correctly

    Hi, I am trying to create a PDF from Word 2010 using Adobe Acrobat X and preserve hyperlinks but when I go through the PDF maker toolbar, the Excel charts in the Word file do not print correctly. They come up as large white boxes with a small grey ar

  • 24" iMac Issues- Hangs Up Consistently

    I have an early 2008 24". This thing has served me flawlessly until I first installed Mountain Lion. It's a 3.2Ghz, 4GB RAM, with now, a 120 GB SSD, with 100 GB free at this time. My only issue ever, was that my HDD failed a couple of years ago. Once

  • Can i Export as a catalog when building a Publishing or exporting plug in?

    I want to build a plugin for exporting collection or a group of collection as a catalog, but I dont find any documentation on the SDK about that option. Is it Possible to export as a catalog using this type of plugins or we are limited to export indi

  • Safari version does not support community tool bar

    Each time I open Safari 5.1.7 I get message "your browser version does not support community tool bar" does this mean I need to update safari?