grouper-dev - RE: [grouper-dev] When to use GrouperSession.staticGrouperSession() ?
Subject: Grouper Developers Forum
List archive
- From: Chris Hyzer <>
- To: Tom Zeller <>
- Cc: Grouper Dev <>
- Subject: RE: [grouper-dev] When to use GrouperSession.staticGrouperSession() ?
- Date: Wed, 14 Apr 2010 23:45:13 -0400
- Accept-language: en-US
- Acceptlanguage: en-US
Right, there is only one slot for the threadlocal.
So you start as who you want it to run as. Then if you need a root session,
you can call session.internal_getRootSession().
If you need to use the threadlocal for a root session temporarily, that is
the inverse of control... inside the block the static session is root, but
afterward it is what it used to be...
GrouperSession.callbackGrouperSession(GrouperSession.staticGrouperSession().internal_getRootSession(),
new GrouperSessionHandler() {
public Object callback(GrouperSession grouperSession)
throws GrouperSessionException {
Group.this.revokePriv(AccessPrivilege.ADMIN);
Group.this.revokePriv(AccessPrivilege.OPTIN);
return null;
}
});
Chris
-----Original Message-----
From:
[mailto:]
On Behalf Of Tom Zeller
Sent: Wednesday, April 14, 2010 11:41 PM
To: Chris Hyzer
Cc: Grouper Dev
Subject: Re: [grouper-dev] When to use GrouperSession.staticGrouperSession() ?
Right. I guess I was looking for a method like
GrouperSession.staticGrouperSession(Subject) which would return a
threadlocal session started by the given subject. A junit test wasn't
passing and I realized I started a threadlocal root session in the
test setup ... oops.
On Wed, Apr 14, 2010 at 9:41 PM, Chris Hyzer
<>
wrote:
> Well, the staticGrouperSession is not a traditional static, it's a
> threadlocal. So when your thread starts one, then anywhere in the thread
> can use that with GrouperSession.staticGrouperSession()... we created that
> so we don't have to pass it around or store it somewhere, so might as well
> use it, right?
>
> Thanks,
> Chris
>
> -----Original Message-----
> From:
>
>
> [mailto:]
> On Behalf Of Tom Zeller
> Sent: Wednesday, April 14, 2010 5:42 PM
> To: Grouper Dev
> Subject: [grouper-dev] When to use GrouperSession.staticGrouperSession() ?
>
> Chris,
>
> Should the grouper DataConnectors for shibboleth use
> GrouperSession.staticGrouperSession() ? (No)
>
> Instead, they should call GrouperSession.start(Subject) and then store
> the GrouperSession as a class variable ? (Yes)
>
> It's OK for the stored GrouperSession class variable to be long-lived ?
> (Yes)
>
> Or should I start a new session every time I query Grouper for data ? (No)
>
> I started using GrouperSession.staticGrouperSession(), but then
> realized that this would use any grouper session stored in the jvm,
> which wasn't what I wanted, since the subjectId used to start the
> session needs to be configurable.
>
> Thanks!
> TomZ
>
- When to use GrouperSession.staticGrouperSession() ?, Tom Zeller, 04/14/2010
- RE: [grouper-dev] When to use GrouperSession.staticGrouperSession() ?, Chris Hyzer, 04/14/2010
- Re: [grouper-dev] When to use GrouperSession.staticGrouperSession() ?, Tom Zeller, 04/14/2010
- RE: [grouper-dev] When to use GrouperSession.staticGrouperSession() ?, Chris Hyzer, 04/14/2010
- Re: [grouper-dev] When to use GrouperSession.staticGrouperSession() ?, Tom Zeller, 04/14/2010
- RE: [grouper-dev] When to use GrouperSession.staticGrouperSession() ?, Chris Hyzer, 04/14/2010
Archive powered by MHonArc 2.6.16.