java - What is the difference between getDefaultInstance() and getInstance() in Session class? -


what difference between session.getdefaultinstance(props, authenticator) , getinstance(props, authenticator)? in general, when choose 1 on other?

i read java doc on getdefaultinstance(props, authenticator), still couldn't able make out difference distinctly/clearly.

hope experts can me in understanding better.

update: actual reason triggered ask question is: we've used session.getdefaultinstance() method in places within our web-based application. sometimes, throws java.lang.securityexception: access default session denied, on quick googling, suggested use session.getinstance() method instead. hence, when 1 choose 1 on other?

if read documentation, see that

getdefaultinstance default session object. if default has not yet been setup, new session object created , installed default.

therefore, if 1 not exist, call getinstance()

getinstance new session object.

so, new session object created, regardless of whether 1 exists.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -