Thread pool in servlet container

Hello all,
I'm working on this webapp that has some bad response times and I've identified an area were we could shave off a considerable amount of time. The app is invoking a component that causes data to be catched for subsequently targeted apps in the environemnt. Our app does not need to wait for a response so I'd like to make this an asyncronous call. So, how best to implement this?...I considered JMS, but started working on a solution using the Java 1.4 backport of JSR 166 (java.util.concurrent).
I've been testing the use of a ThreadPoolExecutor, using an ArrayBlockingQueue. The work that each Runnable will perform involves a lot of waiting (the component we call invokes a web service, among a couple other distributed calls). So I figure the pool will be much larger than the queue. Our container has 35 execute threads, so I've been testing with a thread pool size of 25, and a queue of 10.
Any thoughts on this approach? I understand that some of this work could be simplified by JMS, but if I don't need to be tied to the container, I'd prefer not to. The code if much easier to unit test, and plays nicely with our continious build integration (which runs our junit test for us and notifies on errors).
Any thoughts are greatly appreciated...Thanks!!

Well, if it works, that's by far the best way to go - but note that creating threads in a servlet container means those threads are outside of the container's control. Many containers will refuse to give the new threads access to the JNDI context, even, and some may prevent you from creating threads at all.

Similar Messages

  • Thread pool for Servlets

              Hi all,
              I am facing a big problem while doing a concurrent testing of my web application.
              I am testing with 60 concurrent users.
              I have set the database connection pool minimum capacity to 50, capacity increment
              to 10 and maximum capacity to 100.
              While there is no problem in getting database connection, the session variables
              are getting mixed up (i.e. the session variable for one user is coming up as that
              for another user!!!).
              Does it have something to do with configuring some pool for servlets threads or
              something?
              Please help.
              Thanks a lot in advance and best regards,
              Jaya
              

              Hi all,
              I am facing a big problem while doing a concurrent testing of my web application.
              I am testing with 60 concurrent users.
              I have set the database connection pool minimum capacity to 50, capacity increment
              to 10 and maximum capacity to 100.
              While there is no problem in getting database connection, the session variables
              are getting mixed up (i.e. the session variable for one user is coming up as that
              for another user!!!).
              Does it have something to do with configuring some pool for servlets threads or
              something?
              Please help.
              Thanks a lot in advance and best regards,
              Jaya
              

  • Restricting Thread Pool for Servlet instances

    I am using WebLogic5.1.0 version wherein I am registering a Servlet which
    would be called by all the clients connecting
    to my aplication. The servlet's service methods is taking some time to
    execute. Since the servlet is following a SingleThreadModel, when there are
    a large number of Clients connected, the number instances of Servlets
    created are very high and the number of thread in the Application Server
    process becomes very high affecting the performance of the other
    applications.
    Is it possible to restrict the number of instances of the servlets that get
    created in the Application server ?
    What are the setting required to achieve this ?
    Sandeep

    Hi.
    I'm not aware of a property setting that allows you to restrict the number of
    servlet instances in WLS for the SingleThreadModel. The number of execute
    threads is fixed - it does not grow depending on load. You can set this value
    in the weblogic.properties file by setting weblogic.system.executeThreadCount.
    This value is 15 by default.
    It does sound like you are reaching the max capability of your
    server/hardware. You should try tuning WLS.
    Here are a couple of suggestions:
    1. Try adjusting the executeThreadCount value to a higher value. Start by
    setting it to 30 - see if that makes any difference.
    2. Check out the following tuning guide:
    http://www.weblogic.com/docs51/admindocs/tuning.html
    3. Here is a list of admin properties that might aid in tuning:
    http://www.weblogic.com/docs51/adminhelp/AdminPropertyHelp.html
    4. If you are still having problems you might do better by posting this issue
    to the performance newsgroup.
    Regards,
    Michael
    Sandeep Rajpathak wrote:
    I am using WebLogic5.1.0 version wherein I am registering a Servlet which
    would be called by all the clients connecting
    to my aplication. The servlet's service methods is taking some time to
    execute. Since the servlet is following a SingleThreadModel, when there are
    a large number of Clients connected, the number instances of Servlets
    created are very high and the number of thread in the Application Server
    process becomes very high affecting the performance of the other
    applications.
    Is it possible to restrict the number of instances of the servlets that get
    created in the Application server ?
    What are the setting required to achieve this ?
    Sandeep--
    Michael Young
    Developer Relations Engineer
    BEA Support

  • Servlet Thread Pools for iPlanet WS 4.1

    We have iPlanet WS 4.1 SP 5, running on HP UX. Wanted to make sure servlets run fast, so set up servlet thread pool. Initial result was that even the startup servlet could not be loaded, got stack overflow. Reduced number of threads from 60 to 5. Now startup servlet kicked off OK, but a subsequent servlet processing a request bombed with same error. This is obviously some kind of resource issue; how does one allocate enough memory or whatever it needs to handle the thread pool? Do I really even need a thread pool?

    Thanks, and a follow-up question: at that reference, it seemed to imply there is really no need to allocate a user thread pool if running on Unix. Could even slow down the application. Am I likely to be OK with about 300 concurrent users if I don't allocate a thread pool? I was afraid they'd be single-threaded through the front controller servlet if I did not specifically allocate and use a thread pool, but perhaps multiple threads are already built into the container?

  • Configuration of Thread Pool for CQ's Web Container

    I am trying to detrmine whether there is any specific configuration for tuning the web container thread pool for CQ. The only configuration I observe is OSGi 's Apache Sling Event Thread Pool but tuning this does not directly correlate to the thread pool that is used for serving web requests by the publish instance.
    Any help would be greatly appreciated as I work through tuning our CQ instance.

    Unfortunately, the max thread settings is not exposed in CQ 5.5.However, all the other configurable settings (equivalent for server.xml) can be seen at [1]
    [1] http://localhost:4502/system/console/configMgr/org.apache.felix.http
    This is fixed in CQ 5.6 current release.
    Thanks,
    Varun

  • Servlet thread pool

    Is there any way I can create my own init() for the threads in the servlet thread pool (by overriding some method or through other means)? (Not to be confused with the servlet's init().)

    web server itself is a thread pool implementation, unlesss your thread has other purpose, if not it is suited and enough for you do not implement another thread for it. If you want some init method, you can call from other class before start of your thread pooling.
    Hopefully can help you...

  • Thread management in servlet

    Here is the problem that i am trying to solve - and get better understanding of issues to look out for.
    1) Problem to solve
    Clients sends an http request to an distributor server. The request contains a list of tasks. Each such task can be sent to a particular handling server (out of a known set) which can handle the request. Each task has a task type, which identifies which server the request needs to be passed to. The responses from the handler servers are then to be collected and passed back the client as a consolidated response.
    On the distributor server, the servlet thread that is handling the request will
    a. need to spread the requests for various handling servers
    b. send the requests in parallel to handling servers
    b. get all the responses , consolidate and send back
    2)Proposed solution
    I was thinking of having a thread pool - one thread for each handling server, initialized within servlet . When the distributor server receives a request - the tasks would be spread to these handling threads. The distributor thread would then wait, until the handling threads notify.
    When a notification is received - the distributor thread will need to check if all responses are received. If not - it would need to wait (till a max_timeout) else return the response to client
    3)Questions
    - This involves waiting on the thread created by serlvet container (the distributor thread) and creating a threadpool. Thread creation and management by application in web-container is generally dissuaded - but given this issue - i see no other alternative
    suggestions ? Its been a long email - thanks for considering
    Fred

    How many clients for the entry server do you presume for the application ? I ask this because it is very possible that the server to remain without available threads and give errors. If you use different servers for the final requests I suppose that are some very time consuming processes. What kind of application are running on these servers so that you want to use this kind of distributed computing ?
    Why did you choose as an entry point a servlet container and http request for this kind of problem ? Do you need a graphic response in the browser ? If the response time is too long, the browser (Internet Explorer) will show exception and will not wait for the response (for this you must set some variabiles on client). Also the J2EE server must be set so that not to throw a time-out exception.
    To prevent these, you could do so that not to block the distributor thread and let it send the answer back to the client. Then you can tell to client browser to query the server from time to time to check the status of the execution (you can do that from javascript). When the execution is ready you can retrun the response to the client. Doing this way you will not block the application server threads.
    Now in the back end, you must somehow to take some identificators from the processes and sent them back to the client.
    You can use a database to make the bridge between the central server and the other processes (here you can put the processes identificators). When the processes end up they update their results in the database.
    The client, when will make the repetitive requests, will check the status of the processes in the database with given identificators.
    Sounds like an interesting project.

  • Thread ID for servlets implementing SingleThreadModel

    Container creates different instances for every request to a Servlet implementing SingleThreadModel. So I tried to print thread IDs for such a Servlet by calling Thread.currentThread().getId(). I expected different thread IDs for every request to this Servlet. But what I noticed is - the same thread ID is logged several times (I got thread id 98 and 99 more than once). Can someone please explain why this is behaving like that?

    If container creates a thread pool and if it assigns different requests to same thread (fetched from the pool), then what's the point in creating multiple instances of one servlet?

  • Using worker threads in a Servlet

    Hello friends.
    I am hoping for a sanity check on a design decision I am considering. I have a Servlet that implements a web service that generates an XML document on demand. Depending on the request, the servlet will assemble the XML document from a number of external web services. I guess its somewhat like a mashup.
    I am seeing some significant performance issues doing the external web service requests synchronously. So I am considering using some kind of ThreadPool collect all my data from the web services. Once all the data is available, I will assemble my XML document and return the Response from the Servlet.
    I would appreciate any comments or feedback on this approach. Specifically:
    - Are there any concerns in using a ThreadPool of some kind within a Servlet? I know the Servlet container is multi-threaded, so I guess the ThreadPool would be shared across all threads. Or I suppose I could have a thread local instance of a thread pool. Thoughts?
    - I am using Tomcat 6 as my Servlet container. Any issues with this approach on that container?
    - I have done a lot of multi-threaded programming in the past, but have not used anything from the java.util.concurrency package yet. Are there any classes in this package that might help with my approach? Any other resources worth checking out?
    Thank you all for your help.
    Jeff

    Thanks sjasja.
    I definitely think I should use a ThreadPool. For me its not about how many threads can be created then destroyed in 1 second, its how many simultaneous threads can run at once. I am using Tomcat servlet container, with the default configuration of 200 maxThreads. If my application gets a heavy load and each of those threads creates 50 worker threads, I am going to reach an OutOfMemoryException for sure.
    My only concern is that if all 200 Tomcat threads really are being used, will most of the worker threads jobs spend too much time waiting in the ThreadPool queue? I guess that will have to just take some testing to find the optimal number of threadpool threads.
    Thanks for your additional thoughts.
    Jeff

  • JRun Thread Pool Issue

    I'm running CF 9.0.1 on Ubuntu on an "Medium" Amazon EC2 instance. CF has been crashing intermittently (several times per day). At such times, running top gets me this (or something similar):
    PID
    USER
    PR
    NI
    VIRT
    RES
    SHR
    S
    %CPU
    %MEM
    TIME+COMMAND                                                                                                   
    15855
    wwwrun
    20
    0
    1762m
    730m
    20m
    S
    99.3
    19.4
    13:22.96 coldfusion9
    So, it's obviously consuming most of the server resources. The following error has been showing up in my cfserver.log in the leadup to each crash:
    java.lang.RuntimeException: Request timed out waiting for an available thread to run. You may want to consider increasing the number of active threads in the thread pool.
    If I run /opt/coldfusion9/bin/coldfusion status, I get:
    Pg/Sec  DB/Sec  CP/Sec  Reqs  Reqs  Reqs  AvgQ   AvgReq AvgDB  Bytes  Bytes
    Now Hi  Now Hi  Now Hi  Q'ed  Run'g TO'ed Time   Time   Time   In/Sec Out/Sec
    0   0   0   0   -1  -1  150   25    0     0      -1352560      0      0
    In the administrator, under Server Settings > Request Tuning, the setting for Maximum number of simultaneous Template requests is 25. So this makes sense so far. I could just increase the thread pool to cover these sort of load spikes. I could make it 200. (Which I did just now as a test.)
    However, there's also this file /opt/coldfusion9/runtime/servers/coldfusion/SERVER-INF/jrun.xml. And some of the settings in there appear to conflict. For example, it reads:
    <service class="jrunx.scheduler.SchedulerService" name="SchedulerService">
      <attribute name="bindToJNDI">true</attribute>
      <attribute name="activeHandlerThreads">25</attribute>
      <attribute name="maxHandlerThreads">1000</attribute>
      <attribute name="minHandlerThreads">20</attribute>
      <attribute name="threadWaitTimeout">180</attribute>
      <attribute name="timeout">600</attribute>
    </service>
    Which a) has fewer active threads (what does this mean?), and b) has a max threads that exceed the simultaneous request limit set in the admin. So, I'm not sure. Are these independent configs that need to be made to match manually? Or is the jrun.xml file supposed to be written by the CF Admin when changes are made there? Hmm. But maybe this is different because presumably the CF Scheduler should only use a subset of all available threads, right...so we'd always have some threads for real live users. We also have this in there:
    <service class="jrun.servlet.http.WebService" name="WebService">
      <attribute name="port">8500</attribute>
      <attribute name="interface">*</attribute>
      <attribute name="deactivated">true</attribute>
      <attribute name="activeHandlerThreads">200</attribute>
      <attribute name="minHandlerThreads">1</attribute>
      <attribute name="maxHandlerThreads">1000</attribute>
      <attribute name="mapCheck">0</attribute>
      <attribute name="threadWaitTimeout">300</attribute>
      <attribute name="backlog">500</attribute>
      <attribute name="timeout">300</attribute>
    </service>
    This appears to have changed when I changed the CF Admin setting...maybe...but it's the activeHandlerThreads that matches my new maximum simulataneous requests setting...rather than the maxHandlerThreads, which again exceeds it. Finally, we have this:
    <service class="jrun.servlet.jrpp.JRunProxyService" name="ProxyService">
      <attribute name="activeHandlerThreads">200</attribute>
      <attribute name="minHandlerThreads">1</attribute>
      <attribute name="maxHandlerThreads">1000</attribute>
      <attribute name="mapCheck">0</attribute>
      <attribute name="threadWaitTimeout">300</attribute>
      <attribute name="backlog">500</attribute>
      <attribute name="deactivated">false</attribute>
      <attribute name="interface">*</attribute>
      <attribute name="port">51800</attribute>
      <attribute name="timeout">300</attribute>
      <attribute name="cacheRealPath">true</attribute>
    </service>
    So, I'm not certain which (if any) of these I should change and what exactly the relationship is between maximum requests and maximum threads. Also, since several of these list the maxHandlerThreads as 1000, I'm wondering if I should just set the maximum simultaneous requests to 1000. There must be some upper limit that depends on available server resources...but I'm not sure what it is and I don't really want to play around with it since it's a production environment.
    I'm not sure if it pertains to this issue at all, but when I run a ps aux | grep coldfusion I get the following:
    wwwrun   15853  0.0  0.0   8704   760 pts/1
    S
    20:22   0:00 /opt/coldfusion9/runtime/bin/coldfusion9 -jar jrun.jar -autorestart -start coldfusion
    wwwrun   15855  5.4 18.2 1678552 701932 pts/1  
    Sl
    20:22   1:38 /opt/coldfusion9/runtime/bin/coldfusion9 -jar jrun.jar -start coldfusion
    There are always these two and never more than these two processes. So there does not appear to be a one-to-one relationship between processes and threads. I recall from an MX 6.1 install I maintained for many years that additional CF processes were visible in the process list. It seemed to me at the time like I had a process for each thread...so either I was wrong or something is quite different in version 9 since it's reporting 25 running requests and only showing these two processes. If a single process can have multiple threads in the background, then I'm given to wonder why I have two processes instead of one...just curious.
    So, anyway, I've been experimenting while composing this post. As noted above I adjusted the maximum simulataneous requests up to 200. I was hoping this would solve my problem, but CF just crashed again (rather it slogged down and requests started timing out...so effectively "crashed"). This time, top looked similar (still consuming more than 99% of the CPU), but CF status looked different:
    Pg/Sec  DB/Sec  CP/Sec  Reqs  Reqs  Reqs  AvgQ   AvgReq AvgDB  Bytes  Bytes
    Now Hi  Now Hi  Now Hi  Q'ed  Run'g TO'ed Time   Time   Time   In/Sec Out/Sec
    0   0   0   0   -1  -1  0     150   0     0      0      0      0      0
    Obviously, since I'd increased the maximum simultaneous requests, it was allowing more requests to run simultaneously...but it was still maxing out the server resources.
    Further experiments (after restarting CF) showed me that the server became unusably slogged after about 30-35 "Reqs Run'g", with all additional requests headed for an inevitible timeout:
    Pg/Sec  DB/Sec  CP/Sec  Reqs  Reqs  Reqs  AvgQ   AvgReq AvgDB  Bytes  Bytes
    Now Hi  Now Hi  Now Hi  Q'ed  Run'g TO'ed Time   Time   Time   In/Sec Out/Sec
    0   0   0   0   -1  -1  0     33    0     0      -492   0      0      0
    So, it's clear that increasing the maximum simultaneous requests has not helped. I guess what it comes down to is this: What is it having such a hard time with? Where are these spikes coming from? Bursts of traffic? On what pages? What requests are running at any given time? I guess I simply need more information to continue troubleshooting. If there are long-running requests, or other issues, I'm not seeing it in the logs (although I do have that option checked in the admin). I need to know which requests exactly are those responsible for these spikes. Any help would be much appreciated. Thanks.
    ~Day

    I really appreciate your help. However, I haven't been able to find the JRun Thread settings you describe above.
    Under Request Tuning, I see:
    Server Settings > Request Tuning
    Request Limits
    Maximum number of simultaneous Template requests
      Restricts the number of simultaneously processed requests. Use this setting to increase overall system performance for heavy load applications. Requests beyond the specified limit are queued. On Standard Edition, you must restart ColdFusion to enable this setting. 
    Maximum number of simultaneous Flash Remoting requests
      The number of Flash Remoting requests that can be processed concurrently.
    Maximum number of simultaneous Web Service requests
      The number of Web Service requests that can be processed concurrently.
    Maximum number of simultaneous CFC function requests
      The number of ColdFusion Component methods that can be processed concurrently via HTTP. This does not affect invocation of CFC methods from within CFML, only methods requested via an HTTP request.
    Tag Limit Settings
    Maximum number of simultaneous Report threads
      The maximum number of ColdFusion reports that can be processed concurrently.
    Maximum number of threads available for CFTHREAD
      The maximum number of threads created by CFTHREAD that will be run concurrently. Threads created by CFTHREAD in excess of this are queued.  On Standard Edition, the maximum limit is 10. 
    And under Java and JVM, I see:
    Server Settings > Java and JVM
        Java and JVM settings control the way ColdFusion starts the Java Virtual Machine when it starts.  You can control settings like what classpaths are used and how memory is allocated as well as add custom command line arguments.  Changing these settings requires restarting ColdFusion.  If you enter an incorrect setting, ColdFusion may not restart properly. 
       Backups of the jvm.config file are created when you hit the submit button. You can use this backup to restore from a critical change. 
       Java Virtual Machine Path
      Specifies the location of the Java Virtual Machine.
       Minimum JVM Heap Size (MB)         Maximum JVM Heap Size  (MB)       
       The Memory Size settings determine the amount of memory that the JVM can use for programs and data. 
       ColdFusion Class Path
      Specifies any additional class paths for the JVM, with multiple directories separated by  commas.
       JVM Arguments
      -server -Dsun.io.useCanonCaches=false -XX:MaxPermSize=192m -XX:+UseParallelGC -Xbatch -Dcoldfusion.rootDir={application.home}/../ -Dcoldfusion.libPath={application.home}/../lib
      Specifies any specific JVM initialization options, separated by spaces.
    I did go take a look at FusionReactor and found it's not free (which would be fine, of course, if it would actually help). It looks like there's a fully functional demo, which is cool...but I've haven't been able to get it to install yet, so we'll see.
    Thanks again!
    ~Day
    (By the way, I've cross-posted this inquiry on StackOverflow. So if you're able to help me arrive at a solution you might want to answer there as well.)

  • Pattern for Thread Pool?

    Hi
    i want to build a kind of download manager. The application should be able to handle some concurrent threads, each representing a download in progress.
    I thought i might be more efficient to reuse a download thread after the download has ended as to create a new thread each time (like the connection object for db queries). Is this right? If yes, i thought to build a thread pool that serves a limited number of threaded download objects as requested (am I on the right way?).
    Now, I have to basic problems: (a) is it right, that, if the run() method of a thread has ended, the whole thread gets destroved? if yes, how should i prevent the thread from being destroyed, so i can reuse it later on? Second (b) how would that pool mechnism look like, means, there must be some kind of vector where i put in and take out the threads.
    As you see, these are basic "pool" technique questions. So, I thought, maybe there is a design pattern that would give me the basic mechanism, Does anyone know such a pattern?
    Thanks for your help
    josh

    I thought i might be more efficient to reuse a
    download thread after the download has ended as to
    create a new thread each time (like the connection
    object for db queries). Is this right? If yes, iIt may be right, if creating new threads is wasting enough CPU cycles to justify the complication of a thread pool. Maybe for a high-load server it would be more efficient. You'll have to figure that out for your own specific application.
    Another good use for thread pools is to avoid putting time-consuming operations in ActionListeners, etc. Instead you can have them pass the task off to a thread pool, keeping the GUI responsive.
    Now, I have to basic problems: (a) is it right, that,
    if the run() method of a thread has ended, the whole
    thread gets destroved? if yes, how should i prevent
    the thread from being destroyed, so i can reuse it
    later on? Second (b) how would that pool mechnism look
    like, means, there must be some kind of vector where i
    put in and take out the threads. (a) You are right. Therefore, the worker threads should not exit their run() methods until interrupted. (b) Worker threads could check a job queue (containing Runnables, perhaps) and if there are none, they should wait() on some object. When another thread adds a new job to the queue, it should call notify() on the same object, thus waking up one of the worker threads to perform the task.
    I wrote a thread pool once, just as an exercise. You will run into a number of problems and design issues (such as, what should the worker threads do when interrupted, exit immediately or clear the job queue and then exit?) If you have any more questions, ask in this thead.
    Krum

  • Cold Fusion in a generic thread pool and enabling JAVA don't mix

    I've got Cold Fusion MX installed on a server running Sun One 6.1. I ran into a problem trying to enable JAVA (for servlet support) which I had previous disabled because I didn't use it.
    Well, when I went to enable JAVA on the server last week, the service wouldn't restart and the error logs gave me no indication of the problem.
    Through a tedious trial-and-error process I've found that having Cold Fusion running under a generic thread pool while trying to have JAVA (the j2ee plugin) running under Sun One simply doesn't work (for whatever reason).
    Once I killed the pool, everything runs fine.
    Does anyone happen to know why this is? I keep CFMX under its own thread pool because there are certain elements to CFMX that aren't wholly stable and can result in CFMX crashing. If it crashes, the process keeps accepting requests, but never processes them. I'd like to keep the native thread pool free to keep accepting non-CFMX requests even when CFMX crashes.
    Thus the separate thread pool for CFMX.
    But now I can't run CFMX in a separate thread pool with JAVA enabled.
    Anyone have any insights into why this is?
    Thanks

    Two things. Firstly, it's better to use     private static final Object classLock = new Object();because that saves you worrying about whether any other code synchronises on it. Secondly, if you do decide to go for the delegation route then java.lang.reflect.Proxy may be a good way forward.

  • Using JDO in a Servlet container/app server

    Hi,
    I was just wondering what Solarmetric recommends when using Kodo in a
    servlet container/app server. Specifically the following:
    1. Should each user session maintain a PersistenceManager or should the
    PM be created per request? I am thinking it might be expensive to
    maintain PMs across requests since you may have idle sessions and the
    PMs may hold database resources? But since PMs aren't pooled in Kodo is
    creating/closing a PM per request expensive or is it offset by Kodo's
    connection pooling?
    2. Is it advisable to store data to be displayed on a JSP by storing the
    JDO instances themselves or serializable proxies (simple data beans) of
    these objects in a user's session?
    3. If you can store the JDO instances in the session, do you need to
    make them transient instances using makeTransient() and call close() the
    PersistenceManager?
    Thanks in advance,
    Khamsouk

    These are all very good questions. There really is no one right answer to any
    of them, so I'll just try to educate you on the issues involved and you can
    make your own decision. Hopefully other people who are actually using Kodo
    in a servlet/JSP environment will chime in too.
    1. Should each user session maintain a PersistenceManager or should the
    PM be created per request? I am thinking it might be expensive to
    maintain PMs across requests since you may have idle sessions and the
    PMs may hold database resources? But since PMs aren't pooled in Kodo is
    creating/closing a PM per request expensive or is it offset by Kodo's
    connection pooling?As long as you are outside of a datastore transaction, a PM does not maintain
    any database resources. The only significant state it maintains is a soft
    cache of persistent objects that have already been instantiated. If you are
    using Kodo 2.3 RC1 and have no set the
    com.solarmetric.kodo.DefaultFetchThreshold property to -1, then some
    large collections you obtain from query results or relation traversals may be
    scrollable result sets on the back-end, in which case they obviously maintain
    some database resources.
    2. Is it advisable to store data to be displayed on a JSP by storing the
    JDO instances themselves or serializable proxies (simple data beans) of
    these objects in a user's session?
    3. If you can store the JDO instances in the session, do you need to
    make them transient instances using makeTransient() and call close() the
    PersistenceManager?I'll address these together. JDO fully supports serialization, and in fact
    I think you'll find it does so in exactly the way that you want. If you choose
    to store serialized persistent objects in the session, then during
    serialization the objects will transparently pull in all of their persistent
    state and relations, so the entire object graph is serialized. When you
    deserialize, the objects will no longer be attached to their persistence
    manager -- they will be transient.
    Another options is to store the object IDs in the session, and re-retrieve
    the persistent objects for each web request.
    One design pattern that can probably net very good performance is to maintain
    a global read-only persistence manager that you use to dereference these IDs.
    Of course, if you ever want to change an object, you'll have to re-fetch it
    in a new persistence manager, and evict it from the global manager's cache.
    I hope this helps.

  • Runtime process not working from servlet container

              Hello,
              I'm executing a standalone executable from the Runtime class, using exec.
              Process process = Runtime.getRuntime().exec(buildCommand.toString());
              There are threads monitoring the input and error streams. This same use of the Runtime
              class is used at least 5 other times in the servlet with no problems. The same method
              is also called from a JUnit test and also executes properly.
              The method called from the servlet however does not work. the executable it's calling
              is a C++ executable that uses an ODBC alias set up on the machine to connect to the
              Oracle database. For some reason the ODBC layer throws an exception while trying
              to connect when the executable is called from the servlet, rather than called from
              the command line or JUnit test.
              Does the servlet have a different environment than a client call from the JUnit test?
              Would it not have access to ODBC drivers it needs? Could there be some sort of security
              setting that the servlet container is set too low?
              Any information would be terrific.
              Thanks,
              Sara
              

    Thanks!
    I borrowed a DVD drive and everything installed correctly.

  • How to get list of jar files loaded by servlet container.

    Hi,
    I need to display in my servlet program about the list of jar files loaded by servlet container. Does it vary for each servlet container or is it same. Where can I get those details.
    I need to write code to support tomcat 4x, iplanet 5.0 and websphere 6.0.
    Thanks & Regards,
    Nasrin.N

    For curious, here are output prints for all 3 methods:
    1) parsing system property
    2) tschodt
    3) overcast SystemClassLoader to URLClassLoader
    /home/espinosa/workspace/jboss_embedded_test1/target/test-classes
    /home/espinosa/workspace/jboss_embedded_test1/target/classes
    /opt/javalibs/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar
    /opt/javalibs/javax/jms/jms/1.1/jms-1.1.jar
    /opt/javalibs/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
    package com.sun.org.apache.xerces.internal.impl.validation, Java Platform API Specification, version 1.6
    package com.thoughtworks.qdox.directorywalker
    package com.sun.org.apache.xerces.internal.parsers, Java Platform API Specification, version 1.6
    package java.util.jar, Java Platform API Specification, version 1.6
    package org.testng.internal.thread
    package com.sun.org.apache.xerces.internal.util, Java Platform API Specification, version 1.6
    package java.net, Java Platform API Specification, version 1.6
    package sun.reflect.misc, Java Platform API Specification, version 1.6
    package esp.ejb.samples1.test
    package sun.security.provider, Java Platform API Specification, version 1.
    file:/home/espinosa/workspace/jboss_embedded_test1/target/test-classes/
    file:/home/espinosa/workspace/jboss_embedded_test1/target/classes/
    file:/opt/javalibs/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar
    file:/opt/javalibs/javax/jms/jms/1.1/jms-1.1.jar
    file:/opt/javalibs/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
    ...Interestingly, method 1 and 3 gives the same list, same order, same count, just format of item is a little bit different. The order is same as in Eclipse .classpath file.
    Method 2 (tschodt) give significantly more items! rougly 3x! Different order (somewhat random it seems to me). Some items contain extra information, like version and string "Java Platform API Specification".
    It prints not absolute paths but logical Java names.

Maybe you are looking for

  • Error Installing SQL SERVER 2012 Express

    Hello Everyone, i have this problem: When i try to install SQL SERVER Express 2012 on Windows 7 Ultimate 64b, appears the error "Can't fin registry key (MSDTC)", i try to follow the instructions of other forums, but the file "msdtc.exe" not found in

  • Why can't i connect to my wifi after ios6 update

    why can't i connect to my wifi after ios6 update

  • LSMW field with 5 decimal points

    Hi All, I need to pass a field in the LSMW with 5 decimal points. we cannot pass the data type as "PAC5". can any one suggest how this can be done in LSMW. Also, I am passing the currency key as USDN in the LSMW using Idoc method. But it is taking on

  • Download via proxy unstable

    We use BM3.8 as a proxy server. We have big problems downloading some files, but others work fine. One example which never works are downloading drivers from hp.com. Just hanging ....... Another download not working is NW65SP7.zip from novell downloa

  • Weird Problem trying to sign into my App Store Account ?  Please Help !!

    Im having a very weird problem trying to sign into my App store account to update my apps and to purchase new Apps. Ive tried to search the net but I cant seem to solve my problem. Here is whats happening My Email address is correct in my iTunes Acco