cancel
Showing results for 
Search instead for 
Did you mean: 

Maintaining Lock in the application

Former Member
0 Kudos

Hi Colleagues.

A java webdynpro application is deployed to a J2EE Engine. I would like to design a application where I can place a lock for it.

step 1. The application is launched (I want to place a lock)

step 2. When the same application is launched for the second time in new browser it should give a warning message since the application is already opened in step 1 and a lock is maintained for it.

3. Step3: When the application(step1) is closed, the lock should be removed.

I want to achieve the abvoe example . How can I store the lock in this usecase. Please let me know.

Regards

Bala

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

You can have a static boolean variable which holds true or false based on whether the application is launched or not. Set this static variable to true whenever the application starts and set to false when it exits. And in the init method check the status of this vaiable and based on that set your lock.

Regards,

Ponraj M

Former Member
0 Kudos

Hi Ponraj, Siar

Thanks for your inputs.

Also, I need to forcefully remove the lock(make it to false) in some cases, So I thought to create an application where I can put the logic there. Is it possible to make use of the static variable used in one view to be shared in another application? Can you let me know?

Regards

Bala

former_member186148
Active Participant
0 Kudos

Hi Balachandar!

I assume that you have a WD Project -> WD Component -> Component Controller -> Some views and one application for it.

Also I assume that you define and use your static variables in views. If yes your vars visible only for apllications used this view. My idea is that you should define your vars in Component Controller and should create public methods for get and set these vars. After that you can call these methods (and, therefore, can read and chage these vars) in any view which uses this Controller. After that you should just create a view which uses this Controller, window for this view and application which will be running with this window.

I think that this will be working.

Regards, Lev

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi Bala

The key moment here is the scope of the lock.

- If the lock is pure application specific and does not depends on logged in user then you can implement simple static boolean flag - just to check if the application active on the server. When the App is started set the flag to TRUE, when it's closed set the flag to FALSE.

- If the lock depends on user you can implement a static Map: User ID (string)->Application state (boolean).

BR, Siarhei