× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Comment inline...

>         else if ( request.getParameter( "step" ).equals( "step2" ) )
>         {
>             String code ;
>             String duration ;
>             VMRatesBean vmRates ;
>             ClientListBean clientList ;

These are not instance variables.  They are local variables, which are
allocated dynamically on the stack when the method is invoked and so by
definition are threadsafe!  Instance variables are those variables you
define in your class definition.

>             synchronized( session )

This is unnecessary.  Since both the session and the local variables are
threadsafe, the following code is also threadsafe.  The only question is
whether your constructors are threadsafe, and unless you're doing something
crazy, they should be.

>             {
>                 code = (String)session.getValue( "code" );
>                 duration = (String)session.getValue( "duration" );
>
>                 code = request.getParameter( "code" );
>                 duration = request.getParameter( "duration" );
>                 session.putValue( "code" , code );
>                 session.putValue( "duration" , duration );
>
>                 vmRates = (VMRatesBean)session.getValue( "vmRates" );
>                 vmRates = new VMRatesBean( code );
>                 session.putValue( "vmRates" , vmRates );
>
>                 clientList = new ClientListBean();
>                 session.putValue( "clientList" , clientList );
>             }
>
>           // do stuff with code, duration, vmRates, etc.

> Let's say
> I put that into some storage object and put the storage object in the
> session.  Now, of course to use the storage object I have to get it OUT of
> session.  Where am I going to put it but in a variable???

I hope I cleared up the confusion.  The following code is overkill, as well
as potentially a performance problem:

>             Storage storage ;
>
>             synchronized( session )
>             {
>                 storage = session.getValue( "storage" );
>             }

Replace it with the simple code:

JP>           Storage storage = session.getValue( "storage" );

Remember, "storage" is a LOCAL variable, not an INSTANCE variable.  These
are two totally different concepts.  Have I cleared it up at all?

Joe



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.