Count all active Session

Hey all,
I want to know how many users are on my site. So I tryed so count all activ session:
int countActiveSessions = FacesContext.getCurrentInstance().
          getExternalContext().getSessionMap().size();But it returns allways 0. Is the method false or how can I count all sessions?
Thanks for help

You are OT. Your question concertn much more servlet than JavaServer Faces.
Anyway sessionMap is not the map of all sessions. It is the map of your own session. With a session map you can retrieve the session attributes.
Look there if you want count the active sessions:
http://www.java.happycodings.com/Java_Servlets/code10.html

Similar Messages

  • Count of active sessions in OC4J

    is there any way i can get the count of active sessions in my servlet in OC4J container?
    any and all help is appreciated.
    thanks
    nik

    Hi,
    I am not sure whether it works. But try starting server with -console option. This opens up a graphic console and try if you can find the info you wanted there.
    srinath

  • How to get all active session id's

    hai,
    i am new to servlet. i am tring to find out all active session id's for security perpose.
    and also i want to deactive a perticular session using that session id.
    but i don't know how to do. please help me.
    thanks in advance.

    Well to me.. I wud like to write a Listener class implementing HttpSessionListener in the following way....
    import javax.servlet.http.HttpSession;
    import javax.servlet.http.HttpSessionListener;
    import javax.servlet.http.HttpSessionEvent;
    import java.util.HashMap;
    public class SessionHandler implements HttpSessionListener{
    public static HashMap<String,HttpSession> SessionsMap = new HashMap<String,HttpSession>();
    public void sessionCreated(HttpSessionEvent se) {
    SessionsMap.put(se.getSession().getId(),se.getSession());
    public void sessionDestroyed(HttpSessionEvent se) {
    SessionMap.remove(se.getSession().getId());
    public static invalidateSession(String SessionId){
    HttpSession session =  SessionsMap.get(SessionId);
    SessionMap.remove(SessionId);
    session.invalidate();
    }Note:I'm assuming tht you are running the code on Jdk/jre 1.5+
    However, i think its more of core way of implementing this specially usage of static members howevr @ the given situation can very well cater your resources.added to it you add ActivationListener depending on your requirement.
    Hope this might help :)
    REGARDS,
    RaHuL

  • I want to get List of all active sessions in current system

    Hi experts
    How to get list of all active sessions in current system in any internal table along with details.
    A sample code wud be helpful
    Thanks in advance.

    try this code it might help u.
    Below report execution gets the active Session list to ABAP memory
    submit rsm04000_alv and return exporting list to memory.
    refresh: gt_listobj.
    Below FM get the List output from ABAP memory to gt_listobj in HEX
    call function 'LIST_FROM_MEMORY'
      tables
        listobject = gt_listobj
      exceptions
        not_found  = 1
        others     = 2.
    if sy-subrc <> 0. " Executed successfully ?
      message id sy-msgid type sy-msgty number sy-msgno
      with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    This FM converts ITAB gt_listobj from HEX to ASCII
    call function 'LIST_TO_ASCI'
      tables
        listasci           = it_list
        listobject         = gt_listobj
      exceptions
        empty_list         = 1
        list_index_invalid = 2
        others             = 3.
    if sy-subrc <> 0. " Executed successfully ?
      message id sy-msgid type sy-msgty number sy-msgno
      with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    This Shows the output in List format on screen
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
       i_structure_name                  = 'line'
      tables
        t_outtab                          = it_list
    exceptions
       program_error                     = 1
       others                            = 2.
    if sy-subrc <> 0. " Executed successfully ?
    message id sy-msgid type sy-msgty number sy-msgno
             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.

  • Broadcast message to all active sessions

    All,
    We have regular nightly restarts for our BO Enterprise ( SIA and tomcat) XI 3.1 SP2 - and it unfortunately is rather abrupt and some-times some users who are working late end up losing some of their work.
    I was wondering if there is a way to broadcast a warning message to all active infoview sessions before the system goes down? Can anyone suggest some ideas on how this can be done?
    Regards

    Hi,
    There's no way within the BOE system that I can think of, but here's a possibility.
    All actions essentially go through your application server so you could parse the last 30 or so minutes of the application servers access logs to get the IP addresses of the clients.  From there, you could use a net send or some other kind of utility to let those users know that the system is going offline.
    either that or your application server may have a way of sending a message to the client browsers that have open sessions.
    Thanks
    Jonathan

  • Possible to sign out of all active sessions?

    Is it possible to see what sessions are 'active' and sign out of them centrally from your online account. 
    I am sure I have signed out of my PC, Ipad and phone however people can still see me online, and with an old status from months ago. 
    thanks
    Solved!
    Go to Solution.

    stix wrote:
    Is it possible to see what sessions are 'active' and sign out of them centrally from your online account. 
    I am sure I have signed out of my PC, Ipad and phone however people can still see me online, and with an old status from months ago. 
    thanks
    unfortunately, such option is not offered yet.
    stix wrote:
    Is it possible to see what sessions are 'active' and sign out of them centrally from your online account. 
    I am sure I have signed out of my PC, Ipad and phone however people can still see me online, and with an old status from months ago. 
    thanks
    in that case case, you just need to change your password so you will be signed out from any computer/device where your account is logged in.
    IF YOU FOUND OUR POST USEFUL THEN PLEASE GIVE "KUDOS". IF IT HELPED TO FIX YOUR ISSUE PLEASE MARK IT AS A "SOLUTION" TO HELP OTHERS. THANKS!
    ALTERNATIVE SKYPE DOWNLOAD LINKS | HOW TO RECORD SKYPE VIDEO CALLS | HOW TO HANDLE SUSPICIOS CALLS AND MESSAGES

  • Any way to get number of active sessions

    Hi,
              With the deprecation of the HttpSessionContext interface as of Servlet API
              2.1 for security reasons, is there any way to know how many sessions are
              currently active in a given WebLogic instance?
              Thanks,
              Sanjiv
              

    You could make it a singleton. The overhead is nothing ... trust me. Run
              WebLogic through a profiler if you don't ;-)
              Good luck,
              Cameron Purdy, LiveWater
              "Sanjiv Gulati" <[email protected]> wrote in message
              news:[email protected]...
              > Thanks for sharing this technique. Although I haven't used the
              > HttpSessionBindingListener interface myself, this will work as long as I
              add
              > an instance of SessionCounter in each new session. The only modifications
              > I'll add to the code below would be a synchronized block within the
              > valueBound and valueUnbound methods so that modifications to m_cSessions
              are
              > thread safe.
              >
              > The overhead associated with this approach will be the following:
              > 1) For every session there will be an associated SessionCounter, and
              > 2) Serialization of requests that end up invoking the valueBound &
              > valueUnbound methods.
              >
              > But I guess this cannot be avoided.
              >
              > Thanks,
              > Sanjiv
              >
              > Cameron Purdy <[email protected]> wrote in message
              > news:[email protected]...
              > > The only portable implementation is to have all requests go through your
              > > servlet code (or JSP code) and check if the session is new
              > > (HttpSession.isNew). If so, register a value with the session that
              > > implements HttpSessionBindingListener. Something like:
              > >
              > > class SessionCounter implements HttpSessionBindingListener {
              > > // count of active sessions
              > > private static int m_cSessions;
              > > // accessor for count of active sessions
              > > public int getSessionCount() {
              > > return m_cSessions;
              > > }
              > > // this object placed on a session
              > > void valueBound(...) {
              > > ++m_cSessions;
              > > }
              > > // this object removed from a session
              > > void valueUnound(...) {
              > > --m_cSessions;
              > > }
              > > // end class
              > > }
              > >
              > > It is host-local ... meaning it only tracks one host in a cluster.
              > > Actually, it only tracks sessions within one classloader on one host in
              a
              > > cluster, but don't worry about that distinction.
              > >
              > > And no, I've never done it, but it is apparent that you could, if you
              > chose
              > > to:
              > >
              > > 1) Count sessions
              > > 2) Track all session instances
              > > 3) Have session-level events, such as onCreate/onDestroy
              > >
              > > Hope it helps,
              > >
              > > Cameron Purdy, LiveWater
              > >
              > > "Sanjiv Gulati" <[email protected]> wrote in message
              > > news:[email protected]...
              > > > Hi,
              > > >
              > > > With the deprecation of the HttpSessionContext interface as of Servlet
              > API
              > > > 2.1 for security reasons, is there any way to know how many sessions
              are
              > > > currently active in a given WebLogic instance?
              > > >
              > > > Thanks,
              > > > Sanjiv
              > > >
              > > >
              > >
              > >
              >
              >
              

  • How to display active Session ?

    hi,
    i would like to implement for an administrative usage, a jsp page that list all active session. I notice in the J2EE api that there's a HttpSessionListener interfaces wich enables listener to receive notification when creating and deleting session. Is it a good way to implement this functionnality, thanks in advance for your help.
    PS : i am sure, others persons have already implement a solution, perhaps there is a Design Pattern for that.

    Hi ,
    Its really simple....
    See the following code
    public class SessionCounter implements HttpSessionListener {
    int sessionCount = 0;
    public void sessionCreated(HttpSessionEvent evt) {
    sessionCount ++;
    evt.getSession().setAttribute("Count", sessionCount);
    public void sessionDestroyed(HttpSessionEvent evt) {
    sessionCount --;
    evt.getSession().setAttribute("Count", sessionCount);
    now add this Listener to your web.xml
    and you can get it anywhere (in jsp or servlet) using session.getAttribute("Count");
    Is this you want.
    Please let me know.
    cheers
    kuttus

  • Modifying an "ssl-proxy-list" without disturbing the active sessions.

    Hello,
    I would like to know if it is possible to have two SSL modules installed in a CSS11503 with each one having it's own "ssl-proxy-list" ("ssl-proxy-list list1" and "ssl-proxy-list list2"), but the two lists (list1 and list2) are exactly the same.
    I will explain my idea:
    In normal situation the two "ssl-proxy-list" are active and the user's encrypted sessions are load balanced between the two SSL modules. But when we need to make a change to the "ssl-proxy-list", like changing a server's certificate, I would like to be able to suspend one service (type ssl-accel with the "ssl-proxy-list List1" attached to it for example) and wait for all active sessions to terminate before suspending the "ssl-proxy-list list1" for applying the changes.
    Once the first "ssl-proxy-list" is updated I would make it active again and apply the same changes to the second "ssl-proxy-list".
    Doing this this way I would like to be able to upgrade the servers's certificate during the working houres without disturbing the connected users...
    Do you think this way of doing would be possible, or do you have an other solution to modify a "ssl-proxy-list" without disturbing the active running sessions ?
    Thank you for your answer,
    Best regards

    Hi Francois,
    An SSL proxy list may belong to multiple SSL services (one SSL proxy list per service), and an SSL service may belong to multiple content rules. You can apply the services to content rules that allow the CSS to direct SSL requests for content.
    The CSS supports one active SSL service for each SSL module in the CSS, one SSL service per slot. You can configure more than one SSL service for a slot but only a single SSL service can be active at a time.
    No modifications to an SSL proxy list are permitted on an active list. Suspend the list prior to making changes, and then reactivate the SSL proxy list once the changes are complete. Once you have modified the SSL proxy list, suspend the SSL service, reactivate the SSL proxy list, and then reactivate the SSL service.
    You can use maximum 4 different certificates at a time.
    Use the suspend command to suspend an active SSL proxy list.
    To suspend an active SSL proxy list, enter:
    (config-ssl-proxy-list[ssl_list1])# suspend
    use the url below for your reference:
    http://www.cisco.com/en/US/docs/app_ntwk_services/data_center_app_services/css11500series/v7.10/command/reference/CmdSSLC.html
    Kind regards,
    Sachin Garg
    Senior Specialist Security
    HCL Comnet Ltd.
    http://www.hclcomnet.co.in
    A-10, Sector 3, Noida- 201301
    INDIA
    Mob: +91-9911757733
    Email: [email protected]

  • The number of active sessions isn't decreasing in OC4J instance

    Hi Guru’s,
    Could you help me, please?
    The number of active sessions isn’t decreasing in OC4J instance after our clients closed the application.
    Our partner use Oracle AS 10gR3 (10.1.3.4.0) with J2EE and HTTP mode.
    When we monitoring our OC4J instance with Performance tab on Oracle EM, we appreciate that the value of Active Sessions on ‘Servlets and JSPs’ are very high. If users close our applications, then number of active sessions isn’t decreasing and active status isn’t becoming inactive.
    Which OC4J settings responsible for managing active sessions and how can I get more information about the active session details?
    Thanks in advance,
    Zoltan

    Dinesh.Rajak wrote:
    When I deployed this code Tomcat, it is giving the output as 0, hence tried with accessing the jsp file in multiple browsers but still it is showing the count of active session as 0 - plz helpPlease, don't resurrect old threads, and it's still the wrong forum. Create a new thread if you have a specific question, and create the thread in the correct forum. I'm closing this thread.
    Kaj

  • How to find active sessions count on a server in weblogic server console

    Hi All,
    I would like to know how to find active sessions count on a server in weblogic console. I am using weblogic 11g.
    Regards,
    Sunil.

    On the deployment, monitoring tab, you can select web applications. Here the number of current sessions are listed per web application deployed on the domain.
    The deployment itself (deployments, application, monitoring, sessions) shows a list of sessions and where it is located. Unfortunately, there is no aggregation (but that is something you can so yourself as well).
    When you are using a load balancer in front, the count of sessions on per web application on the domain gives you some clue how many sessions there are present on each server.
    That is to say, when load balancer is using round-robin (and does that correct), you can take the total number of sessions divide it by the number of servers.

  • 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.

  • Active session count of an user

    Hi,
    Could you help me understand the concept of active user session count and the factors influencing the active sesssion count of an user
    1) Does running multiple queries in a number of query windows in SQL developer lead to increase active session count?
    2) Does a high degree of parallel option ( e.g. Parallel (Degree 8)) provided in a query lead to a higher session count?
    3) Does the size of data processed in a query influence session count?
    4) Does the complexity of a query influence session count?
    5) Can a session remain active even after completion of a query and thereby increase the active sessioncount?
    Regards
    -Learnsequel

    910874 wrote:
    Could you help me understand the concept of active user session count and the factors influencing the active sesssion count of an userThat depends on the client. Does the client use some form of multi-threading? If so, the client needs a separate and active Oracle session servicing each of its running threads.
    The user may only initiate a single connection to the database - but the application remembers the authentication and connection details and can transparently establish multiple additional sessions. (a common behaviour by TOAD and SQL-Developer)
    1) Does running multiple queries in a number of query windows in SQL developer lead to increase active session count?Yes - as an Oracle session is serialised. It can only execute a single client request at a time. Thus if the client has 3 windows/tabs with each running a SQL query - then 3 Oracle sessions are required to service that client.
    2) Does a high degree of parallel option ( e.g. Parallel (Degree 8)) provided in a query lead to a higher session count?No. PX slave processes are database processes. They only "assist" a session at specific times. Then they can "assist" other sessions with other parallel query processing. The database has a configurable PQ processing pool of processes. You can specify the minimum number of processes to create in the pool at startup. You can specify the ceiling of the pool.
    So no number of sessions can grow the number of PQ processes beyond the maximum size of the pool. And the pool is there to service all sessions. Not just a single session.
    3) Does the size of data processed in a query influence session count?No.
    4) Does the complexity of a query influence session count?No.
    5) Can a session remain active even after completion of a query and thereby increase the active sessioncount?This is default behaviour. If that session terminates, the client looses its database connection.
    In the case of a multi-threaded client, it can decide to close one or more of the transparent "background" sessions it created to the database, when no longer needing such a session. However, it will keep its initial (first) session open as its primary connection to the database.

  • List all active login sessions IDs

    Hi,
    I want to enumrate all active login sessions for session IDs. I found some api SessionGetInfo which gives current user
    session ID. and getutmpxent which gives process id of (as i understand id of process creating session) all sessions. I
    want to map pid to session id. or is there any other way to list the session IDs of all logged in users.
    Thanks.

    Hi Nagendra,
    You can get the informamtion through one more option also. In case of function module you need to execute the module again and again for each user or may be need to write a report. I would like to suggest you an alternative. That is making use of queries.
    1. Go to transaction SQVI.
    2. In the input field Quick View give the any name for query for example Z_EMAIL_ADD.
    3. Choose create option. In the resulting pop up give description in Title field. In data source choose TABLE JOIN. Select Basis mode.
    4. In the next screen choose INSERT TABLE pushbutton and in the pop up give USR21. Then again choose INSERT TABLE pushbutton and this time give ADR6.
    5. Now go back using back arrow or F3.
    6. Now in the new screen you will be under the tab strip List fld select.. From that entries under available filed (on right hand side) select User name in user master record and the first entry for Internet mail (SMTP) address. Now using single arrow pushbutton poitning towards left move these fields to tabstrip List fld select.
    7. Now go to tabstrip selection filed. As done in step 6 move User name in user master record under it.
    8. Save the changes and go back. A pop up will come asking you to save quick view Z_EMAIL_ADD. Choose yes.
    9. Now execute the query. In the input field you can give one user or multiple users at a given time.
    Regards,
    Rajesh

  • Count number of Session Hosts active in RD Connection Broker farm.

    Hello,
    Is there a way to count how many session hosts are active (not drained) in RD Connection broker farm at a given point of time.
    Thank you, 
    Kashif

    Hi,
    What operating system version is this?
    If Server 2012/2012 R2 you could use Get-RDSessionHost cmdlet:
    Get-RDSessionHost
    http://technet.microsoft.com/en-us/library/jj215469.aspx
    -TP

Maybe you are looking for

  • I have to tell the world . . .

    THIS POST WAS ACTUALLY TAKEN FROM MY BLOG. <Edited by Moderator> "I have something to tell you." That was the phrase I uttered to my wonderful husband, when I got home from work the other day. But, before I tell you why, let me back up. You see, for

  • Payment details are missing in the file generated by driver program RFFOJP_T

    Hello Friends – We send the payment files generated by driver program RFFOJP_T (Payment Medium Japan - Domestic DME (and Bank Charges)).  Now, we see issue that couple of payment details are missing in Output file/AL11. If 20 payment documents are cr

  • Oracle 10.1.0.3 download

    Hi, Can someone please help me to find Oracle 10.1.0.3 Installation where I can download it from.. Thanks!! Pubudu

  • Question about transport system configure

    I have two system dev & prd,  the prd is domain controller, the router is from dev to prd. I want to delete all transport configure and reconfigure it.   Now I login to prd 000, and delete dev from transport system, and use se06 to initial the stms, 

  • Dreamweaver cs3 crashed after cute ftp installation

    Hi Guys! After i've installed the cute ftp program an error has occured - "Adobe Dreamweaver CS3 has encountered a problem and needs to close.  We are sorry for the inconvenience." Deleting the WinFileCache-.... didn't worked. What should i do? Thank