Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Shared Variables and Jaguar PB Components?

5 posts in General Discussion (old) Last posting was on 2000-03-23 19:27:54.0Z
Andrew Hart Posted on 2000-03-21 20:03:38.0Z
Newsgroups: sybase.public.easerver
Date: Tue, 21 Mar 2000 14:03:38 -0600
From: Andrew Hart <Andrew_Hart@harcourt.com>
Organization: The Psychological Corporation
X-Mailer: Mozilla 4.7 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Shared Variables and Jaguar PB Components?
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 6
NNTP-Posting-Host: 167.208.175.68
Message-ID: <347_38D7D59A.CD7397E7@harcourt.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:25983
Article PK: 155997

What are the implications of using Shared Variables in Jaguar
components, if any? They're not accessible between instances of Jaguar
components because they're in separate threads, right?


Jim O'Neil [Sybase] Posted on 2000-03-21 20:51:17.0Z
Newsgroups: sybase.public.easerver
Date: Tue, 21 Mar 2000 15:51:17 -0500
From: "Jim O'Neil [Sybase]" <joneil@sybase.com>
Organization: Sybase, Inc.
X-Mailer: Mozilla 4.7 [en]C-CCK-MCD (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Re: Shared Variables and Jaguar PB Components?
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 9
NNTP-Posting-Host: joneil-nt.sybase.com 204.167.42.111
Message-ID: <347_38D7E0C5.E63FA380@sybase.com>
References: <347_38D7D59A.CD7397E7@harcourt.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:25975
Article PK: 154368


Andrew Hart wrote:

> What are the implications of using Shared Variables in Jaguar
> components, if any? They're not accessible between instances of Jaguar
> components because they're in separate threads, right?

Correct, they'd be in different PowerBuilder VM sessions.
--
Jim O'Neil
Senior Technical Support Engineer
Sybase, Inc


Scott McReynolds [Sybase] Posted on 2000-03-22 01:36:34.0Z
Newsgroups: sybase.public.easerver
From: "Scott McReynolds [Sybase]" <scottmc@sybase.com>
Subject: Re: Shared Variables and Jaguar PB Components?
Date: Tue, 21 Mar 2000 18:36:34 -0700
Lines: 17
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
NNTP-Posting-Host: 158.159.8.18
Message-ID: <347_T7LhH$5k$GA.285@forums.sybase.com>
References: <347_38D7D59A.CD7397E7@harcourt.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:25964
Article PK: 155985

Andrew,

Also, be aware that this type of component needs to be written very
carefully to be thread safe.

Scott

"Andrew Hart" <Andrew_Hart@harcourt.com> wrote in message
news:38D7D59A.CD7397E7@harcourt.com...
>
> What are the implications of using Shared Variables in Jaguar
> components, if any? They're not accessible between instances of Jaguar
> components because they're in separate threads, right?
>
>


Andrew Hart Posted on 2000-03-23 18:01:06.0Z
Newsgroups: sybase.public.easerver
Date: Thu, 23 Mar 2000 12:01:06 -0600
From: Andrew Hart <Andrew_Hart@harcourt.com>
Organization: The Psychological Corporation
X-Mailer: Mozilla 4.7 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Re: Shared Variables and Jaguar PB Components?
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 45
NNTP-Posting-Host: 167.208.175.68
Message-ID: <347_38DA5BE2.DFC455AF@harcourt.com>
References: <347_38D7D59A.CD7397E7@harcourt.com> <347_T7LhH$5k$GA.285@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:25813
Article PK: 155855

Hi Scott,

I wrote a stateless component to do comparisons of text files and to generate
a "diff" report. The component object itself does not declare any shared
variables, but uses another nvo_node object which is deployed along with the
component. In the nvo_node object, there is a shared object declared:
nvo_node nvo_root_node which is a pointer to the nvo_node instance that is
the root of a binary tree I've constructed. If you see any problems with
that, please let me know. What are some of the particular issues you were
referring to in order to assure thread safety?

For example, if you wrote a component which DID declare shared variables and
then the same client program created three instances of the same component
(not sure why you'd want to do that, but just suppose...) would all three of
those component instances have access to that shared variable? And component
instances created by another client would not?

As a final question, how thorough should I be in cleaning up after myself?
Will garbage collection take care of destroying the nodes in my tree, or
should I make it a point to go through and destroy them all in the deactivate
event? Does instance pooling affect how and when garbage collection takes
place?

"Scott McReynolds [Sybase]" wrote:

> Andrew,
>
> Also, be aware that this type of component needs to be written very
> carefully to be thread safe.
>
> Scott
>
> "Andrew Hart" <Andrew_Hart@harcourt.com> wrote in message
> news:38D7D59A.CD7397E7@harcourt.com...
> >
> > What are the implications of using Shared Variables in Jaguar
> > components, if any? They're not accessible between instances of Jaguar
> > components because they're in separate threads, right?
> >
> >


Jim O'Neil [Sybase] Posted on 2000-03-23 19:27:54.0Z
Newsgroups: sybase.public.easerver
Date: Thu, 23 Mar 2000 14:27:54 -0500
From: "Jim O'Neil [Sybase]" <joneil@sybase.com>
Organization: Sybase, Inc.
X-Mailer: Mozilla 4.7 [en]C-CCK-MCD (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Re: Shared Variables and Jaguar PB Components?
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 80
NNTP-Posting-Host: joneil-nt.sybase.com 204.167.42.111
Message-ID: <347_38DA7039.EBA34C69@sybase.com>
References: <347_38D7D59A.CD7397E7@harcourt.com> <347_T7LhH$5k$GA.285@forums.sybase.com> <347_38DA5BE2.DFC455AF@harcourt.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:25803
Article PK: 155847


Andrew Hart wrote:

> Hi Scott,
>
> I wrote a stateless component to do comparisons of text files and to generate
> a "diff" report. The component object itself does not declare any shared
> variables, but uses another nvo_node object which is deployed along with the
> component. In the nvo_node object, there is a shared object declared:
> nvo_node nvo_root_node which is a pointer to the nvo_node instance that is
> the root of a binary tree I've constructed. If you see any problems with
> that, please let me know. What are some of the particular issues you were
> referring to in order to assure thread safety?
>

I can't speak for Scott specifically, but the big issue on PB thread safety is
that you cannot have components that allow concurrent access and are also
shared. Since you are using shared objects versus shared components, I don't
think you should be at risk here. As long as your are not exposing these shared
objects as Jaguar components, the PB VM should be able to handle it.

>
> For example, if you wrote a component which DID declare shared variables and
> then the same client program created three instances of the same component
> (not sure why you'd want to do that, but just suppose...) would all three of
> those component instances have access to that shared variable? And component
> instances created by another client would not?
>

No, each component instance would have a separate VM session, regardless of the
client that created it, so the component instances basically would not be able to
shared the information this way. To do so, you'd want to actually deploy a
shared COMPONENT to Jaguar.

>
> As a final question, how thorough should I be in cleaning up after myself?
> Will garbage collection take care of destroying the nodes in my tree, or
> should I make it a point to go through and destroy them all in the deactivate
> event? Does instance pooling affect how and when garbage collection takes
> place?
>

A general rule is destroy what you've created - especially for the PB 5 and
earlier programmers like me who still don't 'trust' garbage collection.
Addtionally, if you don't 'clean' up you may be holding on to resources that are
no longer needed - who knows how long before the deactivated component will be
activated again? In general though, if something goes out of scope it should be
garbage collected, so I don't beleive that instance pooling would effect this.
It's the PBVM doing the garbage collection, Jaguar is controlling the pooling.

>
> "Scott McReynolds [Sybase]" wrote:
>
> > Andrew,
> >
> > Also, be aware that this type of component needs to be written very
> > carefully to be thread safe.
> >
> > Scott
> >
> > "Andrew Hart" <Andrew_Hart@harcourt.com> wrote in message
> > news:38D7D59A.CD7397E7@harcourt.com...
> > >
> > > What are the implications of using Shared Variables in Jaguar
> > > components, if any? They're not accessible between instances of Jaguar
> > > components because they're in separate threads, right?
> > >
> > >




--
Jim O'Neil
Senior Technical Support Engineer
Sybase, Inc