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".