× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Phil,

I didn't answer because I don't have enough information to know whether
you would be able to use an alternate approach. I have not used the
ProfileTokenCredential but I have used direct API calls that definitely
work at the thread level. Are you sure the worker thread is performing
the work or could it be processed through another server? How are you
authenticating the user -- are you supplying a password or do you run
this with authority to the profile/*allobj? Are you willing to swap out
your existing code?
 
David Morris
 
-----Original Message-----
From: java400-l-bounces+david.morris=plumcreek.com@xxxxxxxxxxxx
[mailto:java400-l-bounces+david.morris=plumcreek.com@xxxxxxxxxxxx] On
Behalf Of DenisP@xxxxxxxxx
Sent: Thursday, July 20, 2006 3:33 PM
To: java400-l@xxxxxxxxxxxx
Subject: Re: ProfileTokenCredential and multithreaded application

I am sending this post a second time ... the first time was back in May 
and there has been no response in 2 months.  Is that because no-one
knows 
the answer??  Surely there is a list moderator that can shed some light
on 
the situation ...  This is now becoming a showstopper for my application

because I have had to make my application SINGLE THREADED to work
properly 
and it is about to get a lot more load.  Now tasks have to be handled 
serially instead of concurrently.  There must be a better way ...

Hopefully someone will respond this time ...

Thanks,
Phil

---------------------------------------------------
Original Message
---------------------------------------------------
I have a server daemon program written in Java that does the following:
        - Monitor a data queue waiting for a request to come in
        - When a request is read, spawn a worker thread to do the work
and 

go back to monitoring the queue
        - The worker thread uses ProfileTokenCredential to swap to a 
different user profile to do some work on behalf of that user and then 
swaps back and finishes.

According to the javadoc for ProfileTokenCredential:
"When referenced from a running process on the associated iSeries
system, 
a profile token can be used to modify or swap the OS/400 thread identity

and perform a specific task or tasks on behalf of the authenticated
user."

The problem is when one worker thread swaps user profiles it seems to
swap 

the thread identity of the ENTIRE JVM and not just that one worker
thread. 

 This causes the other worker threads to be working on behalf of the
wrong 

user, and all sorts of problems ensue.  The main thread that is
monitoring 

the data queue cannot read entries from it anymore without throwing 
"Password is not set" errors, the worker threads

My question is ... are native threads supported by the iseries JVM?  My 
thoughts are that if there is a native thread backing each of the worker

threads then maybe .. just maybe .. ProfileTokenCredential will only 
change that thread's os400 identity and not the others. 

Anyone have any ideas on this one?

Note - executing the following command from QSH does not work.  It just 
prints a help message and fails:
        java -native HelloWorld

Thanks,
Phil Denis


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.