Thread pool attribute change

I am using JMX monitoring tool for monitor tomcat 6. I need to change the MaxSpareThreads in Catalina-Threadpool under Mbeans. The default value for write attribute is false. How to change the attribute to true.So that i can modify the value.
Please help
--rujin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Hey,
The writeable attribute is defined by the code of the mbean; it is not an authorization thing. If a setting is not writeable you need to look for other ways to change it. In this case you'll have to edit the server.xml for tomcat.
Cheers,
Hugo

Similar Messages

  • 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.)

  • Need help configuring Attribute Change in WLS 6.1

    Hi there,
    I did all it said in the documentation, lacking any sight of an SNMP
    trap. I want to receive a SNMP trap if the
    InvalidLoginAttemptsTotalCount changes (MBean: ServerSecurityRuntime).
    I use
    Attribute MBean Type: ServerSecurityRuntime
    Attribute MBean Name:
    petstore:Location=petstoreServer,Name=petstoreServer,Type=ServerSecurityRuntime
    Attribute Name: InvalidLoginAttemptsTotalCount
    I enabled SNMP, configure my TrapHost and started my trapdaemon. But I
    don't get any trap even though I increased the counter by doing some
    logins with the wrong password. Parallel to my attribute change I also
    configured a counter monitor on the same attribute, with the same
    disappointing result =:-(
    Can anyone help ?
    Greetings,
    Alex

    You need to set a target for the pool. Without target
    pool service won't start. Also you need to provide
    initial and maximum size for the pool.
    Regards,
    Slava Imeshev
    "Nadeem" <[email protected]> wrote in message
    news:3d6d9268$[email protected]..
    >
    Hi Slava, thanks for the reply. Here is the connection pool definition asextracted
    from config.xml. Do you see any errors in this which would cause theexception
    mentioned below?
    -Nadeem
    ************* Connection Pool element in config.xml ********
    <JDBCConnectionPool DriverName="oracle.jdbc.driver.OracleDriver"
    Name="MyJDBC Connection Pool"
    Properties="user=system;password=manager" TestTableName="cabin"URL="192.168.0.11:1521:tacit"/>
    "Slava Imeshev" <[email protected]> wrote:
    Hi Nadeem,
    Could you show us the connection pool definition?
    It can be extracted from config.xml
    Regards,
    Slava Imeshev
    "Nadeem" <[email protected]> wrote in message
    news:[email protected]..
    Hi,
    I need to create a connection pool in WLS 7. Here are the specificsof my
    environment:
    1. RDBMS: Oracle 8i
    2. Driver I want to use: Oracle thin 8.17 (provided with WLS 7)
    3. IP address of machine on which database resides: 192.168.0.5
    4. Port number: 1521
    5. Name of database: MyDB
    6. user: scott
    7. password: tiger
    Given the above,I do not know exactly what to fill out in the
    following
    fields
    that appear in the Admin Console's connection pool creation form:
    1. Name of connection pool (OK, this one I know!)
    2. URL string (exactly what should it be, given above info?)
    3. Driver Classname (I want to use Oracle thin 8.17, so what shouldI fill
    here?)
    4. Properties (exactly what should I fill here, given above info?)
    5. ACL Name (completely stumped here! Documentation says ACLs havebeen
    replaced
    by policies in WLS 7 - so what to fill here?)
    Could someone please help me correctly fill out these fields usingthe
    information
    I provided in the first paragraph.
    BTW, I'm logged into WLS as Administrator.
    Much obliged,
    Nadeem

  • Thread pool

    Hi everybody.
    How can I change the number of threads available in the thread pool in the JRE ?
    Any hint is very welcome.
    Best regards
    Susanne

    Hi.
    No, I mean some settings of the Java Runtime . In a application (byed one) I am getting the following errormessage:
    Java.lang.RuntimeException: "Request timed out waiting for an available thread. You May want to consider increasing the number of active threads in the thread pool."
    JRE is 1.4, Operation System is Solaris 8.
    How I may increase this number of active threads ? Is it an argument to java -Dsomething or is it rather an OS issue ?
    Regards
    Susanne
    Message was edited by:
    SusanneK

  • Thread pool library

    Hello all,
    Does anybody know an open-source library that provides a thread pool with the following behavior?
    When a task is submitted...
    if (there are idle threads in the pool) {
        use an idle thread to execute the task.
    } else {
        if (currentThreadCount < maximumPoolSize) {
            create new thread to execute the task.
        } else {
            put the task in the queue.
            (tasks in the queue will be processed when threads are available).
    }If a thread remains idle for X time, it dies.
    Thank you

    I ran your code and it ran it just fine, I prefixed your println to print out the currentTimeMillis to show it ran right after each other.
    System.out.println(System.currentTimeMillis() +  "{code}
    Here is the result:
    1244482518471 Starting main.
    1244482518483 Running a task
    Here is code fragments from ThreadPoolExecutor I generated my sudo code from.
    {code}
         * Executes the given task sometime in the future.  The task
         * may execute in a new thread or in an existing pooled thread.
         * If the task cannot be submitted for execution, either because this
         * executor has been shutdown or because its capacity has been reached,
         * the task is handled by the current <tt>RejectedExecutionHandler</tt>.
         * @param command the task to execute
         * @throws RejectedExecutionException at discretion of
         * <tt>RejectedExecutionHandler</tt>, if task cannot be accepted
         * for execution
         * @throws NullPointerException if command is null
        public void execute(Runnable command) {
            if (command == null)
                throw new NullPointerException();
            if (poolSize >= corePoolSize || !addIfUnderCorePoolSize(command)) {
                if (runState == RUNNING && workQueue.offer(command)) {
                    if (runState != RUNNING || poolSize == 0)
                        ensureQueuedTaskHandled(command);
                else if (!addIfUnderMaximumPoolSize(command))
                    reject(command); // is shutdown or saturated
         * Creates and starts a new thread running firstTask as its first
         * task, only if fewer than corePoolSize threads are running
         * and the pool is not shut down.
         * @param firstTask the task the new thread should run first (or
         * null if none)
         * @return true if successful
        private boolean addIfUnderCorePoolSize(Runnable firstTask) {
            Thread t = null;
            final ReentrantLock mainLock = this.mainLock;
            mainLock.lock();
            try {
                if (poolSize < corePoolSize && runState == RUNNING)
                    t = addThread(firstTask);
            } finally {
                mainLock.unlock();
            if (t == null)
                return false;
            t.start();
            return true;
         * Rechecks state after queuing a task. Called from execute when
         * pool state has been observed to change after queuing a task. If
         * the task was queued concurrently with a call to shutdownNow,
         * and is still present in the queue, this task must be removed
         * and rejected to preserve shutdownNow guarantees.  Otherwise,
         * this method ensures (unless addThread fails) that there is at
         * least one live thread to handle this task
         * @param command the task
        private void ensureQueuedTaskHandled(Runnable command) {
            final ReentrantLock mainLock = this.mainLock;
            mainLock.lock();
            boolean reject = false;
            Thread t = null;
            try {
                int state = runState;
                if (state != RUNNING && workQueue.remove(command))
                    reject = true;
                else if (state < STOP &&
                         poolSize < Math.max(corePoolSize, 1) &&
                         !workQueue.isEmpty())
                    t = addThread(null);
            } finally {
                mainLock.unlock();
            if (reject)
                reject(command);
            else if (t != null)
                t.start();
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Submit submit a large number of task to a thread pool (more than 10,000)

    i want to submit a large number of task to a thread pool (more than 10,000).
    Since a thread pool take runnable as input i have to create as many objects of Runnable as the number of task, but since the number of task is very large it causes the memory overflow and my application crashes.
    Can you suggest me some way to overcome this problem?

    Ravi_Gupta wrote:
    I have to serve them infinitely depending upon the choice of the user.
    Take a look at my code (code of MyCustomRunnable is already posted)
    public void start(Vector<String> addresses)
    searching = true;What is this for? Is it a kind of comment?
    >
    Vector<MyCustomRunnable> runnables = new Vector<MyCustomRunnable>(1,1);
    for (String address : addresses)
    try
    runnables.addElement(new MyCustomRunnable(address));
    catch (IOException ex)
    ex.printStackTrace();
    }Why does MyCustomRunnable throw an IOException? Why is using up resources when it hasn't started. Why build this vector at all?
    >
    //ThreadPoolExecutor pool = new ThreadPoolExecutor(100,100,50000L,TimeUnit.MILLISECONDS,new LinkedBlockingQueue());
    ExecutorService pool = Executors.newFixedThreadPool(100);You have 100 CPUs wow! I can only assume your operations are blocking on a Socket connection most of the time.
    >
    boolean interrupted = false;
    Vector<Future<String>> futures = new Vector<Future<String>>(1,1);You don't save much by reusing your vector here.
    for(int i=1; !interrupted; i++)You are looping here until the thread is interrupted, why are you doing this? Are you trying to generate loading on a remote server?
    System.out.println("Cycle: " + i);
    for(MyCustomRunnable runnable : runnables)Change the name of you Runnable as it clearly does much more than that. Typically a Runnable is executed once and does not create resources in its constructor nor have a cleanup method.
    futures.addElement((Future<String>) pool.submit(runnable));Again, it unclear why you would use a vector rather than a list here.
    >
    for(Future<String> future : futures)
    try
    future.get();
    catch (InterruptedException ex)
    interrupted = true;If you want this to break the loop put the try/catch outside the loop.
    ex.printStackTrace();
    catch (ExecutionException ex)
    ex.printStackTrace();If you are generating a load test you may want to record this kind of failure. e.g. count them.
    futures.clear();
    try
    Thread.sleep(60000);Why do you sleep even if you have been interrupted? For better timing, you should sleep, before check if you futures have finished.
    catch(InterruptedException e)
    searching = false;again does nothing.
    System.out.println("Thread pool terminated..................");
    //return;remove this comment. its dangerous.
    break;why do you have two way of breaking the loop. why not interrupted = true here.
    searching = false;
    System.out.println("Shut downing pool");
    pool.shutdownNow();
    try
    for(MyCustomRunnable runnable : runnables)
    runnable.close(); //release resources associated with it.
    catch(IOException e)put the try/catch inside the loop. You may want to ignore the exception but if one fails, the rest of the resources won't get cleaned up.
    The above code serve the task infinitely untill it is terminated by user.
    i had created a large number of runnables and future objects and they remain in memory until
    user terminates the operation might be the cause of the memory overflow.It could be the size of the resources each runnable holds. Have you tried increasing your maximum memory? e.g. -Xmx512m

  • Combining the fixed and cached thread pools

    Is there a way to 'combine' the behavior of cached and fixed thread pools ? I have a requirement where
    - at startup, I need to execute a fixed number of short-lived tasks at the background
    - after startup, on demand, I need to run one short-lived task at a time
    If I use a fixed thread pool for my startup processing, it creates the fixed number of threads to process the tasks. But subsequently, those many threads are not required since my task submission is going to be one at a time. The remaining (n-1) threads therefore are really sitting idle & useless.
    If I use a cached thread pool, then I cannot constrain the number of threads to run at startup (since it creates one for each task). Though it ends up taking those threads out after they are idle for a fixed period. But I'm worried that it might create many threads and possibly slowing down the startup ?
    Is there a way to create a pool with a fixed number of threads but 'remove' a set of threads when they are idle ?
    TIA

    v_bala wrote:
    Thanks. The SynchronousQueue worked as expected. But I tried a LinkedBlockingQueue with size 1 hoping that would cause the second task submission to cause a new thread creation. It didn't. Instead it queues up the request (maybe the doc in ThreadPoolExecutor says that when it mentions "If corePoolSize or more threads are running, the Executor always prefers queuing a request rather than adding a new thread"). I suppose if I were to try another it would create another thread ? (I was testing with only two tasks - the first one ended up creating a thread for the task and the next got queued since the queue capacity is 1)yes, the TPE will not start adding threads until the queue starts rejecting them. kind of odd in my opinion, but that's how it works.
    Btw, that was an interesting idea to add a task that scale the core pool number down ! Currently it comes back down to just the one thread (my core pool size is one) after the idle timeout but your idea may give me a slightly better response since it will scale down the core pool size quicker....I suppose if there was a task submission before that idle time there maybe a performance hit (but I don't anticipate that in my case )?actually, that won't scale things down any faster. changing the core pool size will not ditch the other threads immediately, they will still stick around until they idle timeout. changing the core pool size allows you to not worry about the queue implementation (the first solution). you can set the initial core pool size to your "max" size on startup, then drop it down for the normal processing, all the while using a linkedblockingqueue of unlimited size.

  • ExecutorService - thread pool

    I am using a thread pool to handle requests. Is there a way to know who is doing what?
    This is the code I used to assign new tasks to my pool:
    for (;;) {
    this.pool.execute(new Handler(this.sSocket.accept(),Identifier);
    Is there a way to get the thread that will execute it?

    You don't explain the context in which this application is launched - applications can be restricted by security policies too.
    shutdown requires two permissions: one from the installed SecurityManager if any, and the other directly from the AccessController. Your installed SecurityManager may be saying "yes" while the AccessController says "no". There is a change in Java 6 such that only the security manager is queried.

  • How can I use the same thread pool implementation for different tasks?

    Dear java programmers,
    I have written a class which submits Callable tasks to a thread pool while illustrating the progress of the overall procedure in a JFrame with a progress bar and text area. I want to use this class for several applications in which the process and consequently the Callable object varies. I simplified my code and looks like this:
            threadPoolSize = 4;
            String[] chainArray = predock.PrepareDockEnvironment();
            int chainArrayLength = chainArray.length;
            String score = "null";
            ExecutorService executor = Executors.newFixedThreadPool(threadPoolSize);
            CompletionService<String> referee = new ExecutorCompletionService<String>(executor);
            for (int i = 0; i < threadPoolSize - 1; i++) {
                System.out.println("Submiting new thread for chain " + chainArray);
    referee.submit(new Parser(chainArray[i]));
    for (int chainIndex = threadPoolSize; chainIndex < chainArrayLength; chainIndex++) {
    try {
    System.out.println("Submiting new thread for chain " + chainArray[chainIndex]);
    referee.submit(new Parser(chainArray[i]));
    score = referee.poll(10, TimeUnit.MINUTES).get();
    System.out.println("The next score is " + score);
    executor.shutdown();
    int index = chainArrayLength - threadPoolSize;
    score = "null";
    while (!executor.isTerminated()) {
    score = referee.poll(10, TimeUnit.MINUTES).get();
    System.out.println("The next score is " + score);
    index++;
    My question is how can I replace Parser object with something changeable, so that I can set it accordingly whenever I call this method to conduct a different task?
    thanks,
    Tom                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    OK lets's start from the beginning with more details. I have that class called ProgressGUI which opens a small window with 2 buttons ("start" and "stop"), a progress bar and a text area. It also implements a thread pool to conducts the analysis of multiple files.
    My main GUI, which is much bigger that the latter, is in a class named GUI. There are 3 types of operations which implement the thread pool, each one encapsulated in a different class (SMAP, Dock, EP). The user can set the necessary parameters and when clicking on a button, opens the ProgressGUI window which depicts the progress of the respective operation at each time step.
    The code I posted is taken from ProgressGui.class and at the moment, in order to conduct one of the supported operations, I replace "new Parser(chainArray)" with either "new SMAP(chainArray[i])", "new Dock(chainArray[i])", "new EP(chainArray[i])". It would be redundant to have exactly the same thread pool implementation (shown in my first post) written 3 different times, when the only thing that needs to be changed is "new Parser(chainArray[i])".
    What I though at first was defining an abstract method named MainOperation and replace "new Parser(chainArray[i])" with:
    new Callable() {
      public void call() {
        MainOperation();
    });For instance when one wants to use SMAP.class, he would initialize MainOperation as:
    public abstract String MainOperation(){
        return new SMAP(chainArray));
    That's the most reasonable explanation I can give, but apparently an abstract method cannot be called anywhere else in the abstract class (ProgressGUI.class in my case).
    Firstly it should be Callable not Runnable.Can you explain why? You are just running a method and ignoring any result or exception. However, it makes little difference.ExecutorCompletionService takes Future objects as input, that's why it should be Callable and not Runnable. The returned value is a score (String).
    Secondly how can I change that runMyNewMethod() on demand, can I do it by defining it as abstract?How do you want to determine which method to run?The user will click on the appropriate button and the GUI will initialize (perhaps implicitly) the body of the abstract method MainOperation accordingly. Don't worry about that, this is not the point.
    Edited by: tevang2 on Dec 28, 2008 7:18 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to trigger attribute change run manaully

    Hi all,
    i need to update a master data object with new data. i have the flat file. i scheduled info package and exected DTP (datasource -
    >Master data object). now I need to trigger attibute change run manually. How would i do that?
    Pls help
    Please search the forum before posting a thread
    Edited by: Pravender on Feb 4, 2012 11:16 AM

    HI Ramya,
    Activation master data is different than running Attribute change run.
    Activate master data will only activate the master data in info object(Change the records in M version to A version.
    Attribute Change Run will activate the master data in info object and updates the aggregates with new data if you have any aggregates built on this info object.
    Be specific while asking the question.
    Regards,
    Venkatesh

  • Roll Up & Attribute Change Run

    Which is first -- Roll Up / Attribute Change Run.
    Why?
    Pls help me.

    Hello Indira,
    http://help.sap.com/saphelp_nw04/helpdata/en/9a/33853bbc188f2be10000000a114084/content.htm
    That link provides information that explains 'Roll Up'
    Here is a link to another thread that says as stated to do the Attribute Change run then do the Roll up.
    Re: Attribute Change Run
    It may help you,
    Nick
    Message was edited by:
            Nick Bertz

  • BWonHANA: Attribute Change Runs (ACR)

    Dear all,
    I have a question regarding Attribute Change Runs (ACR) in BW system running on HANA.
    According document: Attribute Change Run it suggests that ACR may not be needed in BW running on HANA DB. However I'm looking for some experience in this topic. So is ACR needed? If so does it run faster comparing to legacy DB?
    thank you
    m./

    Hi Martin,
    go through below thread for existing experience:
    Program to run Attribute Change run
    Attribute Change Run – Strategies and Parameters
    Attribute Change Run concepts - SAP NetWeaver Business Warehouse - SCN Wiki
    LET'S BE BETTER IN SAP BI: Why Attribute Change Run in SAP BI 7.0 is required?
    Regards,
    V Srinivasan

  • Aplication server thread pool problem

    I'm using sun app server 8.
    After some time from starting (and using) the server, it stops responding to clients.
    When I change the max number of threads on server the number of clients it can serve before hanging folows the change. So I guess that some threads are not recycled.
    But, I can't get full thread dump to see what's happening.
    Also I can't get any thread pool monitoring information through asadmin.
    (I can see that EJB's are all removed successfuly)
    Any suggestions.
    Thanks in advance.

    First of all, thank you for helping me.
    The client wasn't making problems, but server did. (I didn't said that I use the app. server on XP.)
    For now I solved the problem by installing the new beta 2004Q4. It works fine now, it also has some thread monitoring in web console...
    I was getting this, when I tried to monitor the thread-pool (it is set on HIGH):
    asadmin> get -m server.thread-pools.thread-pool.thread-pool-1.*
    No matches resulted from the wildcard expression.
    CLI137 Command get failed.
    If it means anything this is what I was getting when I do ctrl-break. (this thread dump stays the same even after server stops responding...)
    Full thread dump Java HotSpot(TM) Client VM (1.4.2_04-b04 mixed mode):
    "Thread-6" prio=5 tid=0x02edad08 nid=0xb40 runnable [331f000..331fd8c]
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:177)
    at org.apache.commons.launcher.StreamConnector.run(StreamConnector.java:
    115)
    "Thread-5" prio=5 tid=0x02ebbb98 nid=0x8ac runnable [32df000..32dfd8c]
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:194)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:220)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:277)
    - locked <0x10089900> (a java.io.BufferedInputStream)
    at java.io.FilterInputStream.read(FilterInputStream.java:90)
    at org.apache.commons.launcher.StreamConnector.run(StreamConnector.java:
    115)
    "Signal Dispatcher" daemon prio=10 tid=0x0093dc18 nid=0x930 waiting on condition
    [0..0]
    "Finalizer" daemon prio=9 tid=0x008a5c20 nid=0xbd0 in Object.wait() [2b5f000..2b
    5fd8c]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x10502a00> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
    - locked <0x10502a00> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
    "Reference Handler" daemon prio=10 tid=0x008a47f0 nid=0xb4 in Object.wait() [2b1
    f000..2b1fd8c]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x10502a68> (a java.lang.ref.Reference$Lock)
    at java.lang.Object.wait(Object.java:429)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:115)
    - locked <0x10502a68> (a java.lang.ref.Reference$Lock)
    "main" prio=5 tid=0x000362a0 nid=0xc38 runnable [7f000..7fc3c]
    at java.lang.Win32Process.waitFor(Native Method)
    at org.apache.commons.launcher.LaunchTask.execute(LaunchTask.java:705)
    at org.apache.tools.ant.Task.perform(Task.java:341)
    at org.apache.tools.ant.Target.execute(Target.java:309)
    at org.apache.tools.ant.Target.performTasks(Target.java:336)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
    at org.apache.commons.launcher.Launcher.start(Launcher.java:402)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at LauncherBootstrap.main(LauncherBootstrap.java:185)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.sun.enterprise.admin.servermgmt.pe.PEInstancesManager.startInstan
    ce(PEInstancesManager.java:115)
    at com.sun.enterprise.admin.servermgmt.pe.PEDomainsManager.startDomain(P
    EDomainsManager.java:126)
    at com.sun.enterprise.cli.commands.StartDomainCommand.runCommand(StartDo
    mainCommand.java:59)
    at com.sun.enterprise.cli.framework.CLIMain.invokeCommand(CLIMain.java:1
    23)
    at com.sun.enterprise.cli.framework.CLIMain.main(CLIMain.java:39)
    "VM Thread" prio=5 tid=0x0093c698 nid=0x9b4 runnable
    "VM Periodic Task Thread" prio=10 tid=0x00940438 nid=0xbd4 waiting on condition
    "Suspend Checker Thread" prio=10 tid=0x0093d2b8 nid=0x2c0 runnable

  • ExecutorService thread pool shutdown exception

    Hello,
    We are developing a desktop application (no applets etc) on the Netbeans plaform. I am trying to add a thread pool via the Java5 ExecutorService. I think we have a very standard implementation using static methods - we copied it from some basic examples in blogs. Please see the class below.
    Everything seems OK until I try to run shutdown. During the application shutdown we catch an exception that says
    access denied (java.lang.RuntimePermission modifyThread)The exception is raised when running the ExecutorService "shutdown()" method.
    Please note that this is a desktop application, and we DO check the permission with the SecurityManager (see code) and we do seem to have the correct permission (no exception raised during check).
    Firstly, this is the first time we've used ExecutorService, so maybe we just have just implemented it incorrectly. Secondly, all "googling" on the issue reveals very little. It only seems to happen to applets.
    ANY SUGGESTIONS, ADVICE, GUIDANCE, HINTS would be MUCH appreciated.
    public final class ThreadPool {
        private static ExecutorService threadPool = Executors.newFixedThreadPool(3);
        public static void execute(Runnable worker) {
            threadPool.submit(worker);
        public static void shutdown() {
            SecurityManager s = System.getSecurityManager ();
            if (s!=null) {
                try {
                    s.checkPermission(new RuntimePermission("modifyThread"));
                    // we apparently have permission, so proceed to shutdown ...
                    threadPool.shutdown();  // EXCEPTION RAISED HERE !!!!!
                    threadPool.awaitTermination(15L, TimeUnit.SECONDS);
                    threadPool.shutdownNow(); // brutal mop up
                } catch (Exception e) {
                    logger.warn("ThreadPool.shutdown(): ex=" + e.getMessage());
    }

    You don't explain the context in which this application is launched - applications can be restricted by security policies too.
    shutdown requires two permissions: one from the installed SecurityManager if any, and the other directly from the AccessController. Your installed SecurityManager may be saying "yes" while the AccessController says "no". There is a change in Java 6 such that only the security manager is queried.

  • Basics of Thread Pool and MDB

    Hi,
    I am not able to connects the dots between Self-Tuning Thread Pool Threads ,number of MDB's and Open connection to Queue Manager (Listeners).
    Following is my setting
    1 Self-Tuning Thread Pool : Default i.e 5
    2) Initial Beans in Free Pool: 100
    3) Max Beans in Free Pool : 200
    What i see
    Pool Current Count :- 100 (this is as expected)
    On start up of server 105 MDB's are created (No problem with this ) (Have put static variable incrementing in constructor)
    When Messages are sent to MQ (50-100) the "Beans In Use Count" under Monitoring never shows more then 16
    and finally the "open MQ Count" on MQ Explorer is always 16.
    Questions.
    1) What do i need to change, for increasing the count of "Beans In Use Count" and "open MQ Count" on MQ Explorer to be more than 16?
    2)If the Self-Tuning thread pool is 5, how come 16 beans are executed at once? or its just that 16 are picked from pool and only 5 are executed at given time?
    NOTE:- I am using weblogic app server to connecto IBM MQ with JMS Module, so creating the customer WorkManager and attaching it to my listener (MDB) is not supported by weblogic, it says the mdb is not under webloic thread pool so this settingt will have no effect
    -thnaks

    Hi ,
    You have to create a custom work manager and then you have to associate this customer work manager to the dispatch policy of the MDB to increase the threads.
    Following links would surely help you as TomB has explained the same issue very well, do have a look at them.
    Re: WorkManager Max thread constraints not applied to MDB
    Also you can also go through this links which would help you get more information:
    Topic: Configuring Enterprise Beans in WebLogic Search for "To map an EJB to a workmanager"
    http://middlewaremagic.com/weblogic/?p=5665
    Topic: WebLogic WorkManager with EJB3 And MaxThread Constraint
    http://middlewaremagic.com/weblogic/?p=5507
    Regards,
    Ravish Mody
    http://middlewaremagic.com/weblogic/
    Come, Join Us and Experience The Magic…

Maybe you are looking for

  • Error while accesing ABAP web dynpro application

    Hi Experts, We are getting warning symbol on web page status bar, when we are accessing the ABAP web dynpro application only first page of application is getting loaded and when we click on page it is showing error on status bar and we can perform an

  • Is my LaserJet 2100tn compatible with Mac OS 10.9 Mavericks?

    I would like to upgrade my Mac to OS 10.9 Mavericks, but I have an old HP LaserJet 2100tn.  Will that printer be compatible with the new OS?  I am currently printing to the 2100tn from OS 10.7.5 - Lion.   This question was solved. View Solution.

  • Fax Setup Problem: Networked MacBook can't find HP 2160 Fax

    I have a recent MacBook Intel Duo OS X (10.4.10) that I have connected to base station via Airport. (Airport Extreme Base station, works fine for everything else) Base station is connected to cable modem (WAN) and Intel iMac is connected to base stat

  • .pdf files come up as web links instead of documents

    when I send adobe standard XI produced files to a certain customer they come up as web links instead of documents.  This customer says that they are having no problem opening documents from other people. Any help with this will be appreciated.

  • My First CSS Site

    Hi everyone, I have created my first CSS based page and was wondering if people could take a look at it and let me know if there are any "Best Practices" I should be aware of that will help streamline my code. The link is at http://jjcstudios.com/woo