I have an interesting problem (at least for me). Say I have a session bean and a client that calls a method on that session bean. The session bean method performs a fairly long operation, say updating hundreds of rows in the database. The client, getting annoyed of waiting, decides to abort. The problem is, how do I implement abort? Since execution is still on the session bean, the call hasn't returned to the client yet. That means the client must make another call to abort to the session bean. But there is no guarantee that the abort call will be served by the same session bean. And you can't do the long operation on a different thread either, since you can't start a thread in a session bean. Anybody has a pattern or idea how to solve this problem?
thanks
mgop
-
Aborting a client-started operation on a session bean (8 messages)
- Posted by: mahesh gopalan
- Posted on: March 23 2001 15:24 EST
Threaded Messages (8)
- Aborting a client-started operation on a session bean by qing yan on March 23 2001 18:42 EST
- Aborting a client-started operation on a session bean by chilkuri rajireddy on March 24 2001 05:11 EST
- Aborting a client-started operation on a session bean by qing yan on March 24 2001 11:37 EST
-
Aborting a client-started operation on a session bean by qing yan on March 24 2001 11:38 EST
- Aborting a client-started operation on a session bean by Sivanandan Srilakshmanan on March 25 2001 08:18 EST
-
Aborting a client-started operation on a session bean by chilkuri rajireddy on March 26 2001 09:01 EST
- Aborting a client-started operation on a session bean by qing yan on March 26 2001 01:28 EST
-
Aborting a client-started operation on a session bean by qing yan on March 24 2001 11:38 EST
- Aborting a client-started operation on a session bean by qing yan on March 24 2001 11:37 EST
- Aborting a client-started operation on a session bean by Lofi Dewanto on March 24 2001 10:36 EST
-
Aborting a client-started operation on a session bean[ Go to top ]
- Posted by: qing yan
- Posted on: March 23 2001 18:42 EST
- in response to mahesh gopalan
I can think of two ideas:
1.Create checkpoints inside the long run operation,
set your continue flag somewhere and let those checkpoints verify it.
2.Create a conversation between client and server, so that
client has direct control, the drawback is the network roundtrips..
-
Aborting a client-started operation on a session bean[ Go to top ]
- Posted by: chilkuri rajireddy
- Posted on: March 24 2001 05:11 EST
- in response to mahesh gopalan
hi mahesh,
same problem i am also facing.please let me know at rajireddy at hexaware dot co dot in if you get the solution for your problem.i am having one idea.put one public volatile flag in your session bean which is doing long processing.if you want to abort that process,let other bean change that flag.during the processing allways check this flag.if flag is changed then abort your process.if get better idea or solution please let me know.
regards
raju -
Aborting a client-started operation on a session bean[ Go to top ]
- Posted by: qing yan
- Posted on: March 24 2001 11:37 EST
- in response to chilkuri rajireddy
<q>put one public volatile flag in your session bean which is doing long processing.if you want to abort that process,let other bean change that flag</q>
This is wrong,it won't work under EJB's single threaded
model,the wrong way is create a flag externally and poll it.
-
Aborting a client-started operation on a session bean[ Go to top ]
- Posted by: qing yan
- Posted on: March 24 2001 11:38 EST
- in response to qing yan
Oops..the second "wrong" should be "right". -
Aborting a client-started operation on a session bean[ Go to top ]
- Posted by: Sivanandan Srilakshmanan
- Posted on: March 25 2001 20:18 EST
- in response to qing yan
System.out.println("Create Transaction");
UserTx = (UserTransaction) context.lookup("javax.transaction.UserTransaction");
System.out.println("TimeOut set to 15 sec");
UserTx.setTransactionTimeout(15);
-
Aborting a client-started operation on a session bean[ Go to top ]
- Posted by: chilkuri rajireddy
- Posted on: March 26 2001 09:01 EST
- in response to qing yan
creating flag externally means where i have to put my flag.
with user transaction i cant time out my process.i don't want to roll back my transaction.i need up to what stage is my procssing is over i have to save this to my temporary table.in future i may continue the process where i left. -
Aborting a client-started operation on a session bean[ Go to top ]
- Posted by: qing yan
- Posted on: March 26 2001 13:28 EST
- in response to chilkuri rajireddy
database,JNDI,CORBA/RMI object... -
Aborting a client-started operation on a session bean[ Go to top ]
- Posted by: Lofi Dewanto
- Posted on: March 24 2001 10:36 EST
- in response to mahesh gopalan
Hi,
Why not using JMS? It will be easier for you to use ansynchronous communication.
Lofi.