T.J. Jankun-Kelly wrote:
> Question 1: New Sessions
> In the middle of a transaction, I occasionally have the need to force
> a new session to be created to replace the current session.
> Invalidating the session and then calling session again does not work
> since it always returns the (invalidated) session. Neither does
> setting the current session to None (via Transaction.setSession) and
> then requesting a new session (similar problem). Any suggestions?

If you're willing to live with the same session object with the same session
ID,  you can clear all values out of the session with
self.session().values().clear().  I use this and it works fine.

> Question 2: Long Tasks
> Someone has probably asked this one before, but I could not find an
> answer (see question 4). Occasionally, I perform a long operation on
> the app server. If I wait around for the response, the HTML page
> returns "timeout" or "client reset by peer" messages. What is the
> Webware-ish approach to solving this problem?

One approach is to start a separate thread to do the operation (either using
TaskKit or just the built-in threading module), and have the servlet refresh
itself periodically, monitoring the status of the task until it is done.  If
you search the archives (see below) you might find some code samples, since
I know this has been asked before.  Also, check the Webware Wiki if you
haven't already.

> Question 3: Threading
> I have not found a good description of how Webware uses its various
> threads. My main question is this: I have on part of code that has
> have only one thread in it at a time (i.e., if two clients connect to
> the app server, only one can be using this object at a time). Again,
> what is the Webware-ish approach to this?

Create a global threading.RLock object at module level, and lock/unlock it
around that code:

mylock = threading.RLock()

class MyPage(Page):
        def writeBody(self):
                ...
                mylock.acquire()
                try:
                        <code that must only run in one thread at a time>
                finally:
                        mylock.release()
                ...

> Question 4: Searching
> This is not a Webware question per se, more of one on the mailing
> list. I cannot find the search functionality for the
> webware-discuss mailing
> list from the SF page. I think some of my questions may have been
> addressed before, so searching would be preferred. Can someone point
> me to this?

http://sourceforge.net/mailarchive/forum.php?forum=webware-discuss

There's a search box on the left side of the page.

- Geoff


-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to