Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / October 2007

Tip: Looking for answers? Try searching our database.

reusable SessionBean

Thread view: 
Sascha Effert - 12 Oct 2007 10:08 GMT
Hello,

I am writing a Metadata-Server for a Storage virtualisation using JBoss
4.2.1. There I have a cupple of physical disks used to build a virtual
disk. There are EntityBeans for the the virtual disks and the physical
disk. Next there exists a SessionBean to be called by the storage servers
which decides which physical disk is to be used for a spcified area of the
virtual disk. The askes something like "On which physical Disk schall I
store block 1234 of Virtual Disk 9876?", the Session Bean initializes a
distribution algorithm over the physical disks of the virtual disks and
sends back which physical disk is to be used.

Now my problem: The initalisation of the distribution algorithm takes much
time (up to some minutes). The distribution could be reused for every
request to a virtual disk if the instance could survive between calls. So I
want something like a hashtable where I can store for any virtual disk an
initialised instance of the distribution algorithm. Is there any way to do
this in JBoss? Or do you have any other suggestion what I can do?

tschau

Sascha Effert
EricF - 13 Oct 2007 05:29 GMT
>Hello,
>
[quoted text clipped - 18 lines]
>
>Sascha Effert

In the past, I had a static member of a SLSB and initialized it if null. This
may not be the best way now.

Someling like:

public class MyBean implements SessionBean {
       private static Hashtable data;

       private void init ejbCreate()  {
               if (data == null)
                       initdata();
       }
       ....              
}

What you mightwant to look at is storing your data using JNDI and populate it
at the server startup. You shoul be able to inject it into your bean if using
EJB3.

Eric
Sascha Effert - 15 Oct 2007 10:03 GMT

> In the past, I had a static member of a SLSB and initialized it if null.
> This may not be the best way now.
[quoted text clipped - 16 lines]
>
> Eric

Hi,

its so easy... I thought it is not possible to use static fields in EJBs. I
will try it.

thanks a lot

Sascha Effert


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.