How to reference running tasks in ThreadPoolExecutor?

Hi all!
So this is a scenario: Thread pool size is 10 and there were 100 submitted callables)
threadPoolExecutor.submit(callable); // times 100Assuming that the tasks are still running, how do I find out which callables are currently being executed?
Thanks,
Andre

You're never going to get that because it's implementation-specific. It could be that the implementation doesn't even have it on a java thread but is using native threads to handle the execution. I'm not certain of all the rules of the specs but I'm sure there's enough leeway that a method which tells you which ones are on separate threads would eliminate optimization techniques.
What you CAN do is make your callable class have method which tell you if it's executing or not.
public class MyCallable implements Callable
     private volatile boolean isRunning = false;
     public void call() throws Exception
         try
                    ...open a lock...
                    isRunning = true;
                    ...close lock...
          finally
                    ...open a lock...
                    isRunning = false;
                    ...close lock...
     public boolean isRunning()
          boolean isRunningTmp = false;
               ...open a lock...
                   isRunningTmp = isRunning;
               ...close lock...
          return isRunningTmp;
}

Similar Messages

  • How to get running Daqmx task handles

    HI,
    We are creating a TestStand module using CVI 8.5, in that module we have to close all the running Daqmx tasks, please provide help on how to get running Daqmx task handles. We could not find any API function which can return list of running Daqmx task handles so that we can close one by one.
    Thanks in advance for the help

    I just had a similar issue.  Stumbled on this forum in the hopes of getting an answer and found no reply to the original message.  I think this is what we are both looking for DAQmxGetSysTasks.  
    I havent used it yet.  Still in the excited I found something stage.

  • How to run tasks with priority?

    Hello everyone,
    I want to run tasks with priority, i.e. among several simultaneous running tasks, the task with the higher priority will have more chances to occupy CPU time. I have the following 2 issues dealing with the implementation of such feature.
    - To define each task as a thread or as a method? How to change the priority of each task dynamically when they are running?
    - The priority feature of Java thread does not meet my requirement, since I can not define priority precisely. For example, I want to define that a task with priority A will occupy CPU time 3 times than a task with priority B.
    I am wondering whether I can find similar open source projects or tutorials?
    Thanks in advance,
    George

    how to run autoconfig with out effecting database
    or
    which mode i have to run What do you mean by not affecting the database?
    The database and the database listener should be up and running when you run AutoConfig on the Application/Database tier nodes.
    Please see (Autoconfig FAQ [ID 218089.1]) -- Which files / profile options get changed when I run AutoConfig?
    Thanks,
    Hussein

  • How can I run all tasks in sequence container in sequence instead parllel

    Hi,
    I Have a foreach loop container. in that container having multiple execute process tasks. when I am executing the package all tasks are running parallel instead of sequential.
    so please kindly help me, how can I run the tasks sequential?
    Thanks

    As Sorna already wrote, connect the Tasks with a precedence constraint = green arrow, then they will be executed one by one.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • How increase number of concurent schedule running task?

    Hi
    Does anyone know, how increase number of concurrent running schedule task?
    I was created ten instances of report (as user administrator). They were run every hour on the same time, but only 5 instances have status running on the same time. When one is finish, the next one is going to run.
    I don't know where can I increase value concurrent running task.
    I use BO XI R2 SP4 on AIX 5.3 TL7
    Best Regards,
    Krzysztof

    With Webi, Webi Job server does "administrative" tasks of scheduling webi reports, they are actualy run by Webi report server.
    So be carefull in increasing this value without increasing number of webi report servers !!
    There should be XIR2 sizing guide in articles section of this site - review it.

  • How SAP standard run the interest calculation in AR module

    Dear expert,
    would like to seek for your advise, how SAP standard run the interest calculation in AR module ?
    Also advise,does the interest calculation generate the interest base on the dunning run?What are relationship between interest calculation generate ?
    What are the T-code for running the interest so that able to generate the interest posting according to baseline due date?
    On top of that, does SAP have standard AR interest calculation report and what are the T-code ?
    Between, do you have any ideal the Interest Indicator ZB stand and reminder date it is the last reminder date,waive,KIV and charge Interest and also noted item amount mean for in the AR Interest Calculation report?
    Please help.
    Regards,
    Karen

    Hi,
    Thank you for the promtp reply.
    I still have query would like to seek for your advise.
    1.Does the interest calculation generate the interest base on the dunning run?For example, the interest is only can be post/generated when there is dunning run and vise versa.
    2.What are relationship between interest calculation generate ?Does interest generation depand on the dunning run?
    On top of that, does SAP have standard AR interest calculation report and what are the T-code ?
    3.Between, do you have any ideal the reminder date it is the last reminder date,waive,KIV and charge Interest and also noted item amount mean for in the AR Interest Calculation report?
    4.For posting use F.2B and that will calculate interest on open items of customers. Does this posting is post as noted item or posting document? Beside, do we every day need to run this posting  F.2B in order to update the AR interest calculation report and post the interest for the overdue invoice?
    5.Do you have any reference link/document /SAP notes on calculate interest on arres F.2B?
    a)How the program calculate those overdue invoice for example: does sap calculate the interest  base on interest + due amount until the customer made the payment?
    b) If customer made payment on the due amount and not the interest and vise versa? How theF.2B program logic work on the calculation ?
    Please help.
    Regards,
    KH

  • Failed to run task sequence - 80004005. DNS working though.

    I seem to be getting a fairly common generic error but with possibly with a slight difference then some of the other problems/answers I have seen.  Generally it looks like this is a DNS issue but I am not sure in my case.
    Let me 1<sup>st</sup> describe my infrastructure and what I am trying to accomplish.  System Center 2012 R2, trying to deploy server 2012.  We use PKI on the main MPs/DPs.  I have another DP that I will use for OSD content that
    won’t use PKI.  I am 1<sup>st</sup> attempting to use boot media, vs PXE, to image a computer.  I have distributed the content to the DP, created a boot media USB and everything looks good there as far as I can tell.  My boot media
    selects the PKI MP and we have created the client cert and I direct it to the non-http DP.  The process seems to accept the certificate and the boot media creation completes.  Next boot off the media on the computer and drop into Windows PE where
    I can manually enter the IP information.  When I click next the process fails.
    Error:
    Failed to Run Task Sequence
    An error occurred while retrieving policy for this computer (0x80004005).
    So starting some of the troubleshooting I F8.
    -Can I ping the SCCM site servers?  Yes, I can ping, both short and FQDN, the primary, MP, DP.
    Looking at the SMSTSLog I see the following lines/errors.
    1)Failed to open PXE registry key.  Not a PXE boot.
    2)Failed to find the source drive where WinPE was booted from
    But then the next line is:  Executing from Media WinPE
    These 2 are at the top of the log and the process seems to continue on with the IP and variable information.  These are the lines of information later in the log with the error(s):
    -CLibSMSMessageWinHTTPTransport::Send:URL: (my MP)
    -In SSL, but with no client cert
    -Error.  Received 0x80072ee7 from WinHttpSendRequest.
    -Hr,HRESULT=80072ee7
    -sending with winhttp failed, 80072ee7
    -m_pHttp Transport -> (etc….)
    -MPKeyInformation.RequestMPKeyInformationForMedia
    -Failed to get information of MP: https//(my MP)
    So I am wondering where I start.  I don’t see that unknown host line that seems to indicate that it is a DNS issue.  I see some stuff about the in SSL but with no cert.  Does this mean that the cert we had to create isn’t working correctly? 
    We pretty much followed
    http://www.jamesbannanit.com/2012/05/how-to-build-and-capture-in-configuration-manager-2012-using-https/
    I have also looked through this
    http://blogs.technet.com/b/configurationmgr/archive/2009/07/27/a-step-by-step-for-using-osd-through-system-center-configuration-manager-2007.aspx
    And I have pretty much everything done there except a network access account.  Looking at my settings I am set to, “Use the computer account of the Configuration Manager client”  However, my computer I am trying to image is a “WORKGROUP” and not
    joining the domain.  But.. am I really getting that far in the process?  Would I be failing to get policy because of this or does this just come into play when I try to get the OS from the DP?

    Have you seen this thread?
    http://social.technet.microsoft.com/Forums/systemcenter/en-US/528c2b54-55ef-4926-bebb-f73ca18a059b/trouble-deploying-windows-7-using-osd-using-pxe-in-sccm-2007-sp2-r3-error-80072ee7?forum=configmgrosd
    I have some free manuals http://1drv.ms/1kk6u6j

  • Waiting for the previously running task to complete issue

    I am running the full extract process , and one task SDE_ORA_InventoryProductDimension running for 18 hours and its status is "Waiting for the previously running task to complete"
    but all running tasked are completed and left tasks are queued by this task, so what make this issue happen?
    I restart the informatica server and the task running now!
    but for this task I run before it has ten million records , and it always make the dataware house server's cache full and server down,
    so how to handle this problem?
    Edited by: Yu Yang on Apr 16, 2013 4:58 AM

    Check if /*+ FULL(PER_ALL_PEOPLE_F) */ hint existed in the SDE_ORA_INVENTORYPRODUCTDIMENSION_FULL mapping Source qualifier?.
    I suggest you to raise an SR and check with your DBA's if they can do something to improve the Performance.
    Mark helpfull if it helps.
    Regards,
    Veeresh Rayan

  • How do I run Safari with a proxy on start up by command line?

    Hello,
    I am using a piece of software called Sahi to perform automated testing of websites. It uses a local proxy to accomplish this task, so it runs the browser with parameters needed so that that instance of the browser is running with the proxy settings. For some reason it's not correctly setup by default with Safari on the Mac. But it has a configuration file where you can set the command line parameters that it runs the browser with.
    So when I use Sahi in its default configuration, it doesn't work because the proxy is not configured, and I get an error ( http://sahi.co.in/forums/discussion/4607/sahi-doesn039t-work-with-safari-5-0-1-o n-macosx )
    So I need to set the proxy. When I set the 127.0.0.1:9999 proxy in the System Preferences it works. My question is how do I run Safari so that it provides the proxy settings as a command line option?
    This way I can add the command line option to the Sahi configuration file so that it runs Safari properly. I don't want to have the proxy settings system wide because I need other programs to work. I don't want to have the proxy settings set for Safari permanently because I also need to be able to run Safari normally outside of this special context.
    Any assistance would be appreciated.

    I should mention this is Safari 5.0.1

  • Download content locally when needed by running task sequence functionality with Windows PE.

    I am trying to understand what happens when the "Download content locally when needed by running task sequence" option in chosen on a task sequence deployment. My assumption is that any needed packages would not be identified
    and downloaded until task sequence is kicked off. 
    Using task sequence boot media, it looks likes a package has been obtained before any task sequence has been selected. I am assuming the package was acquired during the WinPE boot process. Can anyone confirm that this is
    the correct behavior when using the "Download content locally when needed by running task sequence" option? If not, how would WinPE be obtaining the PS100292 SCCM package?
    This specific package contains and HTA file. Only one of  several task sequences deployed to the All Unknown Computers make a call to the HTA file. The one that does, the HTA call is the very first step of the task sequence.
    --Tony

    Hi everyone! I figured what was going on here. I was using an ESX VM and the package was stored on the c:\ from previous attempts and troubleshooting. Long story short, I had to rip the HDD from the VM and add a new one to set every thing back.

  • Long Running Task ...

    I have a requirement where a user kicks off a long running task ( usually 2
    to 5 minutes). I want to show a 'In Progress' message while the task is
    procesing. The long running process needs to be passed an ArrayList. To
    achieve this , I use a ServerSessionPool and a QueueListener.
    In the servlet I assign a unique ID to the task , send a JMS message ( with
    the serialized ArrayList) on the queue. The servlet returns to the
    user saying 'In progress' message . When the user hits refresh , I want to
    know if the message has been consumed ( or the process is over ) and
    I need get the 'processed' ArrayList back in the servlet. How do I achieve
    this ?
    Thanks in advance
    ~ J

    instead of asking the user to hit refresh, you can have the browser
    automatically refresh the page every X seconds by putting in a header
    parameter.
    I forgot the actual parameter, but this is pure HTML so look it up in that
    spec
    Filip
    ~
    Namaste - I bow to the divine in you
    ~
    Filip Hanik
    Software Architect
    [email protected]
    www.filip.net
    "Cameron Purdy" <[email protected]> wrote in message
    news:[email protected]..
    http://dima.dhs.org/misc/LongRunningTask.jsp
    Peace,
    Cameron Purdy
    Tangosol Inc.
    << Tangosol Server: How Weblogic applications are customized >>
    << Download now from http://www.tangosol.com/registration.jsp >>
    "John Doe" <[email protected]> wrote in message
    news:[email protected]..
    I have a requirement where a user kicks off a long running task
    usually
    2
    to 5 minutes). I want to show a 'In Progress' message while the task is
    procesing. The long running process needs to be passed an ArrayList. To
    achieve this , I use a ServerSessionPool and a QueueListener.
    In the servlet I assign a unique ID to the task , send a JMS message (with
    the serialized ArrayList) on the queue. The servlet returns to the
    user saying 'In progress' message . When the user hits refresh , I want
    to
    know if the message has been consumed ( or the process is over ) and
    I need get the 'processed' ArrayList back in the servlet. How do Iachieve
    this ?
    Thanks in advance
    ~ J

  • How do i run a servlet??????

    running servlets:i downloaded jsdk but how do i run a servlet? i got the error
    C:\WINDOWS\Desktop>javac HTTPGetServlet.java
    Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/javac/M
    ain
    when i tried to run my servlet, please help
    thanks

    As mentioned in another post in the thread, servlets run from within a web server that has pre-loaded the jvm and serves web requests. Often they are called 'sevlet containers' as they act like a wrapper program for the actual vm. Tomcat is such a web server, quite a popular one for running servlets, and is considered the reference implementation for a sevlet/jsp server. you can read up on it at...
    http://jakarta.apache.org/tomcat/index.html
    To get you started, this is what i did to set up tomcat. Im using RedHat Linux at home, so this may differ to what you have to do initially.
    First, make sure you have at least the jsdk and jsdk ee installed and the appropiate JAVA_HOME and J2EE_HOME environment variables set.
    I am using the Apache web server to handle web page requests on my box. If the request is for a context containing a servlet or jsp file (context is a tomcat term for a particular location or path in the url) then apache passes the request to tomcat via a apache module and a special protocol. Tomcat then runs the .class file or .jsp file, returns the output to apache which then returns the output back to the browser. So initially you should set up and have the apache web server running.
    Next download and install the jserv or tomcat module for apache, which apache uses to communicate with tomcat via a special protocol, and the tomcat rpms from...
    http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.3/rpms/
    ...Im using 3.2.3 which works fine. you may try the later versions if you like.
    Install the tomcat rpms. They should dump a whole lot of stuff in a /var/tomcat directry, including some nice sample and admin apps. if you had downloaded and installed the tomcat-manuals rpm you can find lots of helpful information in the /usr/doc/tomcat-{your version here}/ directry. This is what you should probably read through now!
    Once that is done, its simply a matter of adding a reference in your httpd.conf file to the tomcat.conf file in the tomcat/conf dir (if you want to have complete control over the tomcat module and contexts) or tomcat-apache.conf (in the same directry) if youd like tomcat to handel its own configuration of apache. something like...
    include /var/tomcat/conf/tomcat.conf
    ...should do.
    then run tomcat start (in /usr/bin/) and apache and away you go. You should be able to point your browser to your.server.com/admin/ and get the tomcat admin tools. This allows you to add view and delete contexts to your server (say for separating different server-side applications). your.server.com/examples/ has some nice stuff as well.
    Hope this helps. I warn you im not an expert and haven't looked at this stuff for some time. I probably have something wrong so please, experts, if you see something stuffed up let us know.

  • How to start/run Rule Author GUI?

    hi,
    how we can start / run Oracle Rule Author GUI (part of Oracle Business Rules of Oracle AS)?
    as iv seen most of documentations n tutorials state only the 'usage' of it n none of those describe that how to start / run Rule author gui,,
    Best Regards

    hi ,
    i did all the tasks specified in this guide,,,but it is not mentioned here that how to restart RULEAUTHOR? and when i tried to start it by :
    http://machinename:7777/ruleauthor/
    it gives me HTTP 404 Not Found.
    plz tell me what to do ?
    Best Regards

  • How to get Process Task Retry Count using API (OIM 10g)

    Hi ,
    I want to get all the process task which are failed after retried 5 times.
    For e.g Create user task in AD retried for 5 times but still it is in failed state. I want to get all such process task.
    I am stuck at point how to get process task retry count from process definition?
    Thanks

    You can reference the code in the "Task Timed Retry" scheduled task to get what you are looking for. Here is the decompiled code:
    >
    package com.thortech.xl.schedule.tasks;
    import Thor.API.Operations.tcScheduleTaskOperationsIntf;
    import com.thortech.util.logging.Logger;
    import com.thortech.xl.dataaccess.tcDataSetException;
    import com.thortech.xl.dataobj.tcDataSet;
    import com.thortech.xl.scheduler.tasks.SchedulerBaseTask;
    import com.thortech.xl.util.logging.LoggerMessages;
    import java.sql.Date;
    import java.util.Hashtable;
    public class tcTskTimedRetry extends SchedulerBaseTask
    private static Logger logger = Logger.getLogger("Xellerate.Scheduler.Task");
    Date isCurrentDate;
    public void init()
    logger.debug(LoggerMessages.getMessage("EnteredMethodDebug", "tcTskTimedRetry/init"));
    this.isCurrentDate = new Date(System.currentTimeMillis());
    logger.debug(LoggerMessages.getMessage("LeftMethodDebug", "tcTskTimedRetry/init"));
    public void execute()
    logger.debug(LoggerMessages.getMessage("EnteredMethodDebug", "tcTskTimedRetry/execute"));
    tcDataSet localtcDataSet1 = new tcDataSet();
    tcDataSet localtcDataSet2 = new tcDataSet();
    tcDataSet localtcDataSet3 = new tcDataSet();
    try
    if (isStopped())
    return;
    localtcDataSet2.setQuery(getDataBase(), "select osi_retry_on from osi where 1=2");
    localtcDataSet2.executeQuery();
    if (isStopped())
    return;
    localtcDataSet2.setDate("osi_retry_on", this.isCurrentDate);
    localtcDataSet1.setQuery(getDataBase(), "select osi.sch_key, osi.mil_key, osi.orc_key, osi.osi_rowver, sch.sch_rowver, osi.osi_retry_for, osi.osi_retry_on, osi.osi_retry_counter, sch.sch_note from osi osi,sch sch where osi.osi_retry_on <=" + localtcDataSet2.getSqlText("osi_retry_on") + " and osi.sch_key = sch.sch_key" + " and sch.sch_status='R'" + " and osi_retry_counter>0 order by osi.sch_key");
    localtcDataSet1.executeQuery();
    if (isStopped())
    return;
    int i = localtcDataSet1.getRowCount();
    logger.debug("tcTskTimedRetry:execute:Number of Process tasks retrieved is=" + i);
    tcScheduleTaskOperationsIntf localtcScheduleTaskOperationsIntf = (tcScheduleTaskOperationsIntf)getUtility("Thor.API.Operations.tcScheduleTaskOperationsIntf");
    tcDataSet localtcDataSet4 = new tcDataSet();
    localtcDataSet4.setQuery(getDataBase(), "select osi_retry_for, osi_retry_counter from osi where 1=2");
    localtcDataSet4.executeQuery();
    Hashtable localHashtable = new Hashtable();
    if (isStopped())
    return;
    for (int j = 0; j < i; j++)
    if (isStopped())
    return;
    localtcDataSet1.goToRow(j);
    localtcDataSet3.setQuery(getDataBase(), "select count(*) as counter from osi osi,sch sch where osi.sch_key = sch.sch_key and osi_retry_for=" + localtcDataSet1.getLong("sch_key"));
    localtcDataSet3.executeQuery();
    if (isStopped())
    return;
    if (localtcDataSet3.getInt("counter") > 0)
    continue;
    localHashtable.put("osi_retry_for", String.valueOf(localtcDataSet1.getLong("sch_key")));
    localHashtable.put("sch_note", localtcDataSet1.getString("sch_note"));
    long l = localtcDataSet1.getLong("osi_retry_counter");
    if (isStopped())
    return;
    try
    localtcScheduleTaskOperationsIntf.createScheduleItem(localtcDataSet1.getString("orc_key"), localtcDataSet1.getString("mil_key"), localHashtable, l - 1L);
    catch (Exception localException2)
    logger.error(LoggerMessages.getMessage("ErrorMethodDebug", "tcTskTimedRetry/execute", localException2.getMessage()), localException2);
    catch (tcDataSetException localtcDataSetException)
    logger.error(LoggerMessages.getMessage("ErrorMethodDebug", "tcTskTimedRetry/execute", localtcDataSetException.getMessage()), localtcDataSetException);
    logger.debug("PJ:tcTskTimedRetry:execute:DataSetexception has occured");
    catch (Exception localException1)
    logger.error(LoggerMessages.getMessage("ErrorMethodDebug", "tcTskTimedRetry/execute", localException1.getMessage()), localException1);
    logger.debug(LoggerMessages.getMessage("LeftMethodDebug", "tcTskTimedRetry/execute"));
    public boolean stop()
    logger.debug("tcTskTimedRetry:stop:Task being stopped");
    return true;
    >
    -Kevin

  • Display All Running Task image corrupted or tampered with

    My task scheduler reports of a number of corrupted task images. Now I want to display all running task on the server and it say the task image is corrupted or tampered with. 
    How do I recreate this task or repair it? Is there another way of viewing all task, running and inactive ones? What is causing these task image corruptions because my backup tasks are all now corrupted.

    Hi,
    Before going further, would you please let me know if you do some changes (such as: install updates, configure or modify certain setting) before this issue occurred?
    Please refer to the solutions that Ronnie Vernon provided in the following similar question. And then check if this issue can be solved.
    Vista Task Scheduler task image is corrupt
    http://social.technet.microsoft.com/Forums/windows/en-US/f86919c0-6a09-4f08-955a-76084a37db73/vista-task-scheduler-task-image-is-corrup?forum=itprovistaapps
    In addition, you can export and import those tasks. After importing, please check if those tasks can run normally. For detailed operations, please refer to the following
    articles.
    Export a Task
    http://technet.microsoft.com/en-us/library/cc709661.aspx
    Import a Task
    http://technet.microsoft.com/en-us/library/cc722156.aspx
    If your issue still exists, please don’t hesitate to let me know.
    Hope this helps.
    Best regards,
    Justin Gu

Maybe you are looking for

  • Photoshop Overview Page Has Grammatical Error

    Just wanted to point out that on the overview page of the Photoshop has "Perfect it here" instead of "Perfect is here". Unless this is an intentional error.

  • Is it possible to get a virus or spyware on a iPad ?

    My iPad II seems to have a virus. Notes have disappeared twice. Changes pages for no reason. It it possible t get a virus o spyware? Thank you.

  • Getting a code for Adobe Photoshop student edition

    i naught adobe photoshop around two years ago and never got the code to use it where would I send my student details to in getting the activation code

  • Reopen period in MM

    Hallo everybody, i have this issue in MM opening/closing periods. I opened the 3th period (MMPV).But i just realised that i have to do some postings in the 12th period .How can i open again December and do my postings? Is there a way to do this? Rega

  • Raw material contract

    Hi Friends, I am kind of new to mm , I am trying to create contract in ME31K, the material i have put as raw material, since it is a raw material it should not ask me for the account assignment, why is it asking, when i have given a cost center, it i