Hi Dave,
It is the client that gets interrupted in the code written by Kristijan. In
the example the client creates a stateful session bean, and then calls
bean.executeRule in a loop. So he doesn't interrupt the bean.
/Kaj
~~~~~~~~~ ~~~~ ~~~ ~~ ~ ~ ~ ~
[EMAIL PROTECTED]
+46 70 4200148
> -----Ursprungligt meddelande-----
> Fr�n: Dave Wolf [mailto:[EMAIL PROTECTED]]
> Skickat: Wednesday, September 13, 2000 6:57 PM
> Till: [EMAIL PROTECTED]
> �mne: Re: Restarting facility in stateless bean
>
>
> But how would be interupt the running process? In other
> words, he says that
> another thread could set the boolean value to keep running to
> be false.
> Since EJB forbids concurrent access to the bean, he can spawn
> all the client
> threads he wants, but only one thread at a time can be running in the
> session bean. So its impossible to interrupt the process.
>
> Dave Wolf
> Internet Applications Division
> Sybase
>
>
> > -----Original Message-----
> > From: A mailing list for Enterprise JavaBeans development
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Francis Pouatcha
> > Sent: Wednesday, September 13, 2000 11:43 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Restarting facility in stateless bean
> >
> >
> > Dave,
> >
> > Kristijan is using thread synch. primitives in the client
> code and not
> > in the bean code. This isn't vorbidden.
> >
> > /Francis.
> >
> > Dave Wolf wrote:
> > >
> > > Kristan,
> > >
> > > Creating your own thread, using thread syncrhonization
> > primitives etc are
> > > all expressly forbidden in EJB. See section 18 of the
> EJB 1.1 spec.
> > >
> > > Dave Wolf
> > > Internet Applications Division
> > >
> > > > -----Original Message-----
> > > > From: A mailing list for Enterprise JavaBeans development
> > > > [mailto:[EMAIL PROTECTED]]On Behalf Of
> Kristijan Cvetkovic
> > > > Sent: Wednesday, September 13, 2000 7:25 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: Restarting facility in stateless bean
> > > >
> > > >
> > > > Hello Ravi,
> > > >
> > > > > Is it possible to give a restart facility in stateless
> > session bean ?
> > > > >
> > > >
> > > > I think you could get some serious problems with stateless
> > session beans
> > > > (ssb). How do you want to suspend the exeution of
> > executeRule()? And even
> > > > when you can suspend it somehow you cannot be sure to get the
> > same bean
> > > > instance at the next method call because of pooling.
> > > >
> > > > > When a client selects executeRule from the screen, then
> > this procedure
> > > > > get activated. But I have to give a facility, through which
> > client can
> > > > stop
> > > > > this process and restart it from the point (For ex: if
> > client stops this
> > > > > when
> > > > > it processed 500 records, and when he restart the process, it
> > > > should start
> > > > > processing from 501 records).
> > > >
> > > > I would suggest to use statefull session beans. You could
> > provide a number
> > > > of files to be procced in the create method of that bean and
> > your client
> > > > code could look like this:
> > > >
> > > > WorkingBean bean = WorkingBeanHome.create(10);
> > > >
> > > > boolean done = false;
> > > >
> > > > // another thread could set it to true
> > > > boolean suspended = false;
> > > >
> > > > while (!done) {
> > > > (if !suspended) {
> > > > done = bean.executeRule();
> > > > } else {
> > > > this.wait();
> > > > }
> > > > }
> > > >
> > > > bean.remove();
> > > >
> > > >
> > > > Your BeanCode could look like this:
> > > >
> > > > ...
> > > > private number = 0;
> > > > private current = 1;
> > > > ...
> > > > public void ejbCreate(int n) {
> > > > number = n
> > > > }
> > > >
> > > > executeRule(){
> > > >
> > > > while (EOF && (current%numberer != 0)){
> > > > read current record from file
> > > > process it
> > > > write back it to file
> > > > }
> > > >
> > > > if (EOF) return true else false;
> > > > }
> > > >
> > > > regards,
> > > > --
> > > > [EMAIL PROTECTED]
> > > >
> > > > MATHEMA Software GmbH
> > > > N�gelsbachstra�e 25 b
> > > > 91052 E r l a n g e n
> > > > D e u t s c h l a n d
> > > > Tel +49(0)9131/8903-0
> > > > Fax +49(0)9131/8903-55
> > > > http://www.mathema.de
> > > >
> > > >
> ==================================================================
> > > > =========
> > > > To unsubscribe, send email to [EMAIL PROTECTED] and include
> > > > in the body
> > > > of the message "signoff EJB-INTEREST". For general help,
> > send email to
> > > > [EMAIL PROTECTED] and include in the body of the
> message "help".
> > > >
> > > >
> > >
> > >
> > ==================================================================
> > =========
> > > To unsubscribe, send email to [EMAIL PROTECTED] and include
> > in the body
> > > of the message "signoff EJB-INTEREST". For general help,
> send email to
> > > [EMAIL PROTECTED] and include in the body of the
> message "help".
> >
> > --
> > [EMAIL PROTECTED]
> >
> > MATHEMA Software GmbH
> > N�gelsbachstra�e 25 b
> > 91052 E r l a n g e n
> > D e u t s c h l a n d
> > Tel +49(0)9131/8903-0
> > Fax +49(0)9131/8903-55
> > http://www.mathema.de
> >
> > ==================================================================
> > =========
> > To unsubscribe, send email to [EMAIL PROTECTED] and include
> > in the body
> > of the message "signoff EJB-INTEREST". For general help,
> send email to
> > [EMAIL PROTECTED] and include in the body of the message "help".
> >
> >
>
> ==============================================================
> =============
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff EJB-INTEREST". For general help,
> send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".