on 04-18-2007 10:28 AM
Hi All,
I'm using the 'WDServerState.getActualApplications()' to see how many times a <b>specific</b> application is currently running on my portal.
However, I'm having 2 issues:
1) Say I'm counting how many instances of application1 are running. If I navigate to application2 the counter will decrease but if logoff from the portal (by the 'log off' link or by closing the browser), the counter stays at the same value and I need to
wait to the timeout in order it to decrease. Is there a way to control this?
2) On a load balancing system the ''WDServerState.getActualApplications()' sometimes throws an exception (I don't know why because exception details doesn't contain any information). Any idea what's causing this?
Also, any suggestions for counting the number of instances of a specific WD application are welcomed...
Regards,
Omri
One more try...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Omri,
Never tried API you mentioned, so here what I would do if this API never exists:
1. Create Entity Bean with primary key as string and sole counter field of type int
2. In wdDoInit of root component controller (root component == top-level component used by application)
-- get Entity Bean by primary key (application name) and increment counter;
-- if bean does not exists then create it and set counter to 1
3. In wdDoExit of same controller decrement counter and / or optionally remove bean.
To make operations transactional, I'd even combine steps in [2] and [3] and expose them via some stateless session bean operations, like the following pseudocode:
[Transaction=Required]
incrementCount(String appName) {
try {
bean = getByPK(appName);
bean.counter++;
}
catch (NotFoundException) {
bean = create(appName);
bean.counter = 1;
}
}
[Transaction=Required]
decrementCount(appName) {
try {
bean = getByPK(appName);
bean.counter--;
}
catch (NotFoundException) {
/* Nothing to do */
}
}
Valery Silaev
SaM Solutions
Hi Valery,
Some questions about wdDoExit:
1) Will it be called when I close the browser?
2) Will it be called when I logoff from the portal?
Does it matter if I use a cluster?
Say I have 3 applications server in the cluster (3 machines). Will the the counter work for the cluster or will it be for each application server?
Thanks,
Omri
Omri,
Definitely it must work in cluster while it's mandatory requirement to synchronize entity beans across all cluster nodes.
What I'm sure about is that wdDoExit is invoked when you are closing browser with stand-alone WD application. Not sure about portal, but I firmly believe it should. Just try a cheap test: add code to wdDoExit that saves some file at predefined location and see what happens when logging-out in portal or closing browser window with portal.
Valery Silaev
SaM Solutions
Hi Valery,
I've written some text to a filename and it worked for all 3 cases (navigating to other application, closing the browser, logoff from portal).
Before using a bean I tried to implement a quick solution by using jdbc java code.
in wdDoinit I wrote a query that increases counter - this is always working
in wdDoExit I wrote a query that decreases counter - this isn't working
How do I know what kind of code in wdDoExit will be executed (why jdbc doesn't work and writing to a file/using entity bean should work)?
Thanks,
Omri
Hi Valery,
I've written some text to a filename and it worked for all 3 cases (navigating to other application, closing the browser, logoff from portal).
Before using a bean I tried to implement a quick solution by using jdbc java code.
in wdDoinit I wrote a query that increases counter - this is always working
in wdDoExit I wrote a query that decreases counter - this isn't working
How do I know what kind of code in wdDoExit will be executed (why jdbc doesn't work and writing to a file/using entity bean should work)?
Thanks,
Omri
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.