Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » accessorKeys for EditModels
accessorKeys for EditModels [message #45760] Mon, 27 September 2004 14:33 Go to next message
Eclipse UserFriend
Originally posted by: dave_gray.versata.com

In the IBM supplied web tools, access to EditModel objects now requires an
"accessorKey". This was not used in the WSAD 5.0 version of these classes.
I assume the key is needed for some sort of consistency control.

These keys are typed simply as Objects. Any advice on how they are
selected? How unique should they be?
Re: accessorKeys for EditModels [message #46972 is a reply to message #45760] Wed, 29 September 2004 18:52 Go to previous message
Michael D. Elder is currently offline Michael D. ElderFriend
Messages: 62
Registered: July 2009
Member
Hi Dave,

"Accessor Keys" are used to track reference counts to Edit models.
Whenever you get an edit model for read or for write, the edit model will
save this "token" and remember where the edit model was accessed (e.g.
isolate the code path). We hold onto this accessor key in case you either
forget to release the edit model or you try to access the edit model again
when you have already accessed it.

You will see exceptions if you access the edit model again with the same
object (INVALID_ACCESS) or you fail to release the edit model and your
object is garbage collected (DANGLING_REFERENCE). You should always release
the edit model in a try ... finally block.

For example:

EJBEditModel ejbEditModel;
EJBNatureRuntime ejbNature;
...
try {
// create or get project
IProject ejbProject = ...;

// acquire the Nature
ejbNature = EJBNatureRuntime.getRuntime(ejbProject);

// an Accessor Key, "this", must be supplied to the Nature to access the
Edit Model
ejbEditModel = ejbNature.getEJBEditModelForWrite(this);

// work with Edit Model
...

} finally {
// the Accessor Key "this" must be used to release access to the Edit
Model
if(ejbEditModel != null)
ejbEditModel.releaseAccess(this);
}

In static contexts, you can create a simple new Object() reference, but be
sure that you release this or you will begin to see exceptions.
DANGLING_REFERENCE exceptions actually show you the code path (stack trace)
where the edit model was originally accessed.

Kind Regards,

Michael D. Elder


"Dave" <dave_gray@versata.com> wrote in message
news:cj98c1$t7m$1@eclipse.org...
> In the IBM supplied web tools, access to EditModel objects now requires an
> "accessorKey". This was not used in the WSAD 5.0 version of these classes.
> I assume the key is needed for some sort of consistency control.
>
> These keys are typed simply as Objects. Any advice on how they are
> selected? How unique should they be?
>
Previous Topic:Unable to download ibm.zip
Next Topic:Disable JSP Index?
Goto Forum:
  


Current Time: Wed Jan 15 11:32:07 GMT 2025

Powered by FUDForum. Page generated in 0.03069 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top