Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


I wantr to know, How many number of users logged in to
website? can any one answer

Answers were Sorted based on User's Feedback



I wantr to know, How many number of users logged in to website? can any one answer..

Answer / anket dhulekar

Use listeners. Since you want to to know how many users have
logged in, so the login info would be stored in a session.
You can create a filter by extending HttpSessionListener,
and update a static variable when the session is created.

The value of this variable will store the number of users
currently logged on.

Is This Answer Correct ?    18 Yes 1 No

I wantr to know, How many number of users logged in to website? can any one answer..

Answer / sunil

HttpSessionListener is Listener whenever session is created.

import javax.servlet.http.HttpSessionListener;
import javax.servlet.http.HttpSessionEvent;

public class SessionCounter implements HttpSessionListener {

private static int activeSessions = 0;

public void sessionCreated(HttpSessionEvent se) {
activeSessions++;
}

public void sessionDestroyed(HttpSessionEvent se) {
if(activeSessions > 0)
activeSessions--;
}

public static int getActiveSessions() {
return activeSessions;
}
}

Is This Answer Correct ?    15 Yes 0 No

I wantr to know, How many number of users logged in to website? can any one answer..

Answer / namy

Create a static variable and increment it every time the
page/sit gets loaded.

Is This Answer Correct ?    7 Yes 4 No

I wantr to know, How many number of users logged in to website? can any one answer..

Answer / ritesh parkhi

Number of users loged on website is depends on Pool Size of
there connection string. By Default MaxPoolSize=100 and
MinPolSize=0.
if Max pool size in 100 so only 100 user can loged in.If 101
user will try to simultaneously you will get TimeOut error
because your connectionstring wait to free one of connection
onject out of 100.

Is This Answer Correct ?    7 Yes 6 No

I wantr to know, How many number of users logged in to website? can any one answer..

Answer / pradeep

1. If the website is static pages no data base interaction
then using static variable we can find out how many users
loged into the system.
2.If the webpage is data base centric and for accessing
any page we are retriving data then we can find the max. no
of connections .

Is This Answer Correct ?    1 Yes 1 No

I wantr to know, How many number of users logged in to website? can any one answer..

Answer / raju

we need to write a servlet class, that is login servlet class. Whenever user going to login to the application ,server has to create login servelt object. so every time service method got executed for every user login. so write a private static int count variable as part of login servlet class and increment the counter value in service() method and store the counter value into application scope.

Is This Answer Correct ?    0 Yes 0 No

I wantr to know, How many number of users logged in to website? can any one answer..

Answer / raju ranjan sinha

The Number of threads can run simmultaneously by the server
is equal to the number of persons can log into a web site.

Is This Answer Correct ?    5 Yes 12 No

Post New Answer

More Advanced Java Interview Questions

What are the methods used for inter-thread communication? and in what class these methods are defined?

2 Answers  


Can I map more than one table in a cmp?

0 Answers  


What is a sessionfactory? Is it a thread-safe object?

0 Answers  


what is a Daemon Thread?

2 Answers  


How would you detect a keypress in a jcombobox?

0 Answers  


What are the various thread priorities?

1 Answers  


What is Connection Pooling?

1 Answers   Enteg Technologies, Infosys, Polaris,


If I define a method in JSP scriplet <%..%>, where will it go after translation into a servlet?

8 Answers   HeadStrong,


what is heepStored?

1 Answers  


How JNDI is used in JMS ?

1 Answers  


What are the types of scaling?

0 Answers  


Why won’t the jvm terminate when I close all the application windows?

0 Answers  


Categories