Setting Thread's priority

What is the best way to use thread's setPriority method? from it's run method using this or when i create its instance or in its constructor (or other)?
Thanks,
snayit

Unless, of course, you are implementing my proposed extension to the Runnable interface ... TheSameThingWeDoEveryNightPinkyTakeOverTheWorldRunnable.
� {�                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Unable to change the thread's priority at linux jdk6

    i try to set the thread's priority to value like Thread.MIN_PRIORITY
    i observe the thread's priority by "threadump"
    the setting is ok at windows (XP + jdk5 build 1.5.0_12-b04)
    but not at linux jdk6 (build 1.6.0_04-b12)
    at linux, i see all threads at my server are with priority "10"
    (e.g. gc, finalizer, http listener etc)
    i am using tomcat (running as root), i have tried to set the "default thread priority", but still can't change the thread's priority
    and i have tried to add jvm options to "turn on" thread priority:
    -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=1
    but still no use
    so i guess this should be a problem of "linux" or jvm
    is there any hint if it is about jvm problem?
    thanks

    Hi David,
    >
    > > #com.sapportals.wcm.repository.manager.reporting.RPRepositoryManager#sap.com/irj#com.sapportals.wcm.repository.manager.reporting.RPRepositoryManager#Guest#0##n/a##9056c970715111de8591000c2942fce3#SAPEngine_Application_Thread[impl:3]_14##0#0#Error##Plain###setting initial ACL on /reporting_backend/reports/Content Administration/User related Cleanup/actioninbox.cleanup - com.sap.security.api.NoSuchRoleException: Role with uniqueName content_admin_role not found!
    >  at com.sap.security.core.imp.RoleFactory.getRoleByUniqueName(RoleFactory.java:1783)
    >  at com.sapportals.wcm.repository.RMAdapter.getResource(RMAdapter.java:228)
    >  at com.sapportals.wcm.repository.runtime.CmAdapter.findResource(CmAdapter.java:1349)
    >  at com.sapportals.portal.prt.dispatcher.Dispatcher.initDispatcher(Dispatcher.java:361)
    >
    Have you check this content_admin_role not found ?
    Thanks
    Sunny

  • Is there a way to set wireless network priority on iphone? If not, there should be!

    Is there a way to set wireless network priority on iphone? If not, there should be! I have a wireless router with dual band signals, as well as an extender at the other end of my home... it would be nice if I could set a priority list so my phone knows to always connect to the 5GHz signal if available, rather than trying to connect to the 2.4GHz signal which is on the other side of the house...

    By default, the iPhone will prioritize Wi-Fi over cellular for data and when doing Wi-Fi, will latch on to the strongest signal it can associate (latch on) to. But all that is automatic, there's no evident control for manual adjustments. Other than deleting the Wi-Fi networks you don't like.

  • Setting the Sort Priority is not working

    All,
    I have multiple roles where I have set the Complex workset under the roles as the Entry Point instead of the roles themselves.  I also have set the Sort Priority to arrange the worksets as I want them.  The issue is that the Sort Priority is not taking affect.  Has anyone seen this issue before or have and idea on how to solve it?
    -Clint

    HI
    Sorting of navigation nodes can be done in the Same Level.
    Sort Priority is reserved from 1 - 10 for Administrative purpose.
    So please make sure that you are sorting in a specific level by giving sort Priority from 10 onwards to 100.
    For more info refer to the following link.
    http://help.sap.com/saphelp_nw70/helpdata/en/92/3e703e632c7937e10000000a114084/frameset.htm
    Cheers.
    Chinmaya Sahoo
    (Please reward Points for Helpful Answers)

  • Set Transfer order Priority in T-Code LT0R.

    I need to set Tfr order priority, to customer specific value. I am using 4,7 version..
    Please help me out to find the appropriate user exit, for the same.
    Thanks .
    Vickey.

  • 1)     When call center Team creates Service Request/Service Order/  Complaints it should be set as High Priority by default.

    Hello team ,this is my requirement ..   Through customizing..
    When call center Team creates Service Request/Service Order/  Complaints it should be set as High Priority by default...we need to set only interaction agent bussiness role priority only HIGH..only for this bussiness role.through customizing how to do it..what are the steps..through customizing only please.. help

    By customizing, you can set a default priority to a given transaction type.
    But this does not depend on the business role.
    But as you are talking about IC agents, maybe you can check IDI for this purpose, because there are actions like "Set Problem Priority", "Set Service Request Priority" or "Set Service Order Priority".
    Best regards,
    Sylvain AGUETTAZ

  • Is there any way I may set low resources priority for a specific job or even all SQL jobs?

    Is there any way I may set low resources priority for a specific job or even all SQL jobs? 
    Our database is quite big and everything works OK and very fast, except SQL jobs which are used mainly for maintenance purposes.
    I have one specific job which runs for 2 minutes and takes a lot of resources which may affect execution of other stored procedure which should be executed fast.The worst part is that this job has to be executed during the most active working hours. It does
    not matter for me how long will it take to execute this job. I just do not want it to use so much resources.
    Also I noticed when SQL backup job (takes about 4 minute) is scheduled it also takes a lot of resources and sometimes because of that I am receiving "login timeout" error on my web site.

     depending on you sql server version and edition, you can use resource governor and limit the cpu and memory.
    in most typical cases , you can use the session user name and times and classify the how much cpu and memory they can use. refer : https://msdn.microsoft.com/en-us/library/cc645892.aspx
    but in your case, the problem seems to be with the maintenance jobs which could run as sql server service account.
    also, if the backup are third party tool backup, you can specify the priority level and other options etc to make it less priority.
    it is possible to do that even with native backups such as specifying the limiting buffercount, max transfer size, if the server is memory pressured. sometimes, stripping the backups to multiple sets across different devices, could help as well. even though
    stripping the backups can introduce another complexity.
    may be you need to rethink you back up\recovery strategy.
    Hope it Helps!!

  • Setting the sitemap priority parameter in Muse

    Hi,
    Would it be possible to add a way of setting the sitemap page priority in Muse, so that the automatic sitemap.xml has the required priorities.  At the moment you have to upload a site and then manually edit the sitemap.xml after every upload, it's a little tedious and of course you need to remember to do it.
    Many thanks
    Gordon

    Aaron,
    I'm doing something similar to the thread.  I have an application menu and the user will chose a prompt number 8.
    #8 is Dealer Line and it goes to a queue where agents has additional csq's coming into them.  But I want the Dealer line calls to go to the front of the line. 
    I was putting the if statement the Dealer Line queue.  However, I keep getting an error.  Any help would be greatly appreciated.  Thank you

  • Thread Max priority causing Exception

    Hello All, (again)
    I have written a multithreaded component that is used to access a database and return resultsets.
    The way it currently works is main (request thread) contacts a group of 5 threads, notifies them all and they begin executing their own run(). (currently I have simply hardcoded each of there run()) after starting these threads or waking these threads main goes off to an infinate loop where it simply checks a long short circuit if statement. (I know I would be better off to wait/notify main I just haven't got there yet.) While main is looping the pther 5 threads open their connections to the DB and begin extracting info. This runs completely fine as long as the 5 threads priority are left at normal. However when I set the 5 threads priority to Max I periodicly throw an Exception. The stackTrace from the exception is as follows.
    java.sql.SQLException: General error
    at sun.jdbc.odbc.JdbcOdbc.throwGenericSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLFreeEnv(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcDriver.closeConnection(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcConnection.close(Unknown Source)
    at seedsBE.DBAccesor.closeConnection(DBAccesor.java:62)
    at seedsMW.FilterThread.run(FilterThread.java:31)
    (Sorry dont know how to use the format tags.)
    I have tested this several times and it appears that this only happens when I increase the 5 threads priority to max. What or How or is this priority change causeing this error? Is it garbage collection/out of memory issue?
    FYI Currently the code is executing on a single processor machine.
    Thanks in advance
    B.
    P.S.How do you get more Duke dollars? Sees as how I always ask more questions than I answer.

    "Sounds like you're maybe sharing one JDBC resource among multiple threads, and having a race condition. You'll need to let each thread have their own resources (connection, statement, etc) or properly synchronize access to them to not step on each others' toes (closing in one thread while another is using it, etc). "
    I have tried to seperate all the components needed for db comunication to where each individual thread has its own DB connection and likes. I do not believe that any of my code above the jdbc share anything. I also assume that since each thread has its own data base connection I could exceed the database number of connections. But I am not aware that trying to open more connection than possible might cause a problem. I am operating under the assumtion that the oracle connection pool would work magically and handle this for me.
    Currently i am only using these 5 threads to contact the data base and I can still throw this exception when threads are at max priority. I did a small stress test and ran 35 threads at once against the connection and this worked fine as long as the threads where norm priority. So I am not thinking that it is a number of connection issue.
    Someone above told me to look at the api and try to squeeze out as much info from the exception I can. I am going to look into that now. But all other help and comments are appreciated. I also need to think about syncing these methods but I am not sure, yet, how that can help me since each method is simply using its own run()
    Thanks all

  • How do I set while loop priority in an RT Field Point application?

    I have a vi that I want to run in an FP2010 that contains 2 while loops, one must be Time Critical priority and the other Normal or lower priority.  I will be using RT FIFO to transfer data between the two loops. The Normal loop will be used for communication with a Host PC.
    How can I set the priorities of these 2 loops?
    Can I run 2 separate vi's in the FP with each set to a different priority And transfer data between the two with RT FIFO? How?
    I am using V6.1 and the customer does not want to spend on upgrading.
    Thanks,
    Chris

    Chris,
    You are on the right track using two separate VIs with different priorities and using RT FIFOs to communicate between the two.  Please see the following tutorial and the related links, one link of which is an example with a zip file containing the RT FIFO VIs for LabVIEW 6.1.
    Doug M
    Applications Engineer
    National Instruments
    For those unfamiliar with NBC's The Office, my icon is NOT a picture of me

  • Badi to set the defualt priority for repair tickets

    Hi,
    My requirement is, when the IC agent saves the repair ticket the priority filed should get set automatically to some value based on the business logic. For this i am trying to use Prepare method of the ORDER_SAVE badi. But unfortunately it's not getting triggered when i save the repair tickect in WEB UI.
    Friends, is there any othor Badi for this? or the way i am trying to proceed is wrong. Your help is greatly apriciated.
    Thanks,
    Ravi

    Hi,
    Every category has a reason code attached to it in the category modeller. The reason code is configured in the SPRO with the code code gruppe and katalogue.
    You need to get the reason code for gold silver etc.
    In your badi in the method you will first perform a CRM_ORDER_READ to read the subject set (ET_SERVICE_OS)and from there you will get the reason codes for the categories you need to look for the Ref_kind = 'A'.  In the osset you will have the table. Study the entries of this table one of the entries would be referring to the code codegruppe katalogue of gold silver etc.
    Once you have done that you can update the priority by using the FM CRM_ACTIVITY_H_MAINTAIN_OW. here you will have to fill the structure IS_ACTIVITY_H_COM and CT_INPUT_FIELD_NAMES and set IV_EXTERNAL_CALL = 'X'.
    If you are using more than one categories than you will have to back trace to category2 from the last category you entered. For example if you have entered Category 3 before saving you will have to get the category2 from category3 and then look for the reason code details of category 2.
    Hope this helps.
    Regards,
    S Sarma.

  • Workflow: Setting the high priority flag

    Hi,
    Does any one know how to set the priority for the email notification?
    (Eg: In microsoft outlook red exclamatory mark for high priority)
    I tried the option priority in notification and message but its not giving the desired output(i.e Flag).

    I know you can set the priority on the task.
    If you click on the User step and go under Routes and Priority, you can change the priority and you will see a different icon in Workspace.
    I'm not sure this will change the priority on the email though.
    Jasmin

  • How can I give the "user interface thread" higher priority?

    We do alot of activex calls to front panels. We need to increase/decrease the priority of the user interface thread to resolve our thread problem. Anyone know how to do this?
    Chuck

    Hello,
    As P.M. was saying, you can adjust the thread priorities
    through the VI Properties dialogue. 
    Another place to modify the multithreading system in LabVIEW is a VI
    located at: [LabVIEW Directory]\vi.lib\Utility\sysinfo.llb\threadconfig.vi.  However I do not think this will remedy any
    problems you are having.
    From a Multithreading in LabVIEW tutorial (http://zone.ni.com/devzone/conceptd.nsf/webmain/d2e196c7416f373a862568690074c759)
    Priorities in the User Interface and
    Single-Threaded Applications
    Within the User Interface execution
    system, priority levels are handled in the same way for single-threaded and
    multithreaded applications.
    In single-threaded applications and
    in the User Interface execution system of multithreaded applications, the
    execution system queue has multiple entry points. The execution system places
    higher priority VIs on the queue in front of lower priority VIs.
    If a high-priority task is running and the queue contains only lower priority
    tasks, the high-priority VI continues to run. For example, if the execution
    queue contains two VIs of each priority level, the time-critical VIs share execution time exclusively until both finish.
    Then, the high priority VIs share execution
    time exclusively until both finish, and so on. However, if the higher priority
    VIs call a function that waits, the execution system removes higher priority
    VIs from the queue until the wait or I/O completes, assigning other tasks
    (possibly with lower priority) to run. When the wait or I/O completes, the
    execution system reinserts the pending task on the queue in front of lower
    priority tasks. Refer to the Synchronous/Blocking Nodes section for a list of
    asynchronous functions that wait.
    Also, if a high priority VI calls a lower priority subVI,
    that subVI is raised to the same priority level as the caller for the duration
    of that call. Consequently, you do not need to modify the priority levels of
    the subVIs that a VI calls to raise the priority level of the subVI.
    Thus changing the priority of your VI will change the
    priority of UI calls for that particular VI. 
    Again, I caution you because I suspect that if you are having problems
    with your application not running correctly, I do not believe that manipulating
    the thread priorities will resolve these issues.
    Hope this helps,
    Travis M
    LabVIEW R&D
    National Instruments

  • Setting Thread pool size

              Hi,
              I want to know if I set a system property "-Dweblogic.ThreadPoolSize", how will the
              WLS get to know that the pool size has been changed, at run time?
              E.g. I pass -Dweblogic.ThreadPoolSize=30 from the command-line. Then if I change
              the pool size to 40 at runtime, is there any event that I can fire for the change
              in property through APIs?
              Thnx in advance.
              Best Regards
              Ali
              

    Disregarding what it is for, in my experience, tuning this setting rarely has much effect. For 6.1, the main thread pool related tunables to look at are the EJB thread pools and EJB max-beans... settings, the "default" thread pool, and the internal thread-pool for stand-alone clients -- all of which are mentioned in the performance guide.

  • Swing Mandelbrot Set - Threaded Painting

    I'm trying to create a swing app that generates the mandelbrot set using an adjustable amount of threads. To update the image, I tried to create a javax swing timer, which apparently isn't working. If someone wants to look my code over and point out any mistakes (or possible optimizations) I'd appreciate it. (And for optimizing, I am aware I should short circuit my escape iteration testing for some cases per the wiki page on the subject).
    Note: If you substitute my escape me method from the thread into the main class where the threads are generated, it produces the correct representation of the set.
    Main class:
    import java.awt.Color;
    import java.awt.Container;
    import java.awt.Graphics;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.awt.image.BufferedImage;
    import java.awt.image.ColorModel;
    import java.awt.image.WritableRaster;
    import java.io.File;
    import java.io.IOException;
    import javax.imageio.ImageIO;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.Timer;
    public class Mandel {
         public static BufferedImage bnew;
         public static int tnum;
         public static void main(String[] args) {
              int width = 500;
              int height = 500;
              tnum = 5;
              JFrame mf = new MandelbrotFrame();
              mf.setSize(width, height);
              mf.setTitle("Mandel");
              mf.setLocationRelativeTo(null);
              mf.setVisible(true);
              mf.setDefaultCloseOperation(3);
    class MandelbrotFrame extends JFrame {
         public MandelbrotFrame() {
              Container contentPane = getContentPane();
              MandelbrotPanel mp = new MandelbrotPanel();
              contentPane.add(mp, "Center");
    class MandelbrotPanel extends JPanel implements ActionListener {
         public void paintComponent(Graphics g) {
              super.paintComponent(g);
              Mandel.bnew = new BufferedImage(getWidth(), getHeight(),
                        BufferedImage.TYPE_INT_ARGB);
              generate(Mandel.bnew);
              g.drawImage(Mandel.bnew, 0, 0, null);
              javax.swing.Timer t = new javax.swing.Timer(1000, new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                       repaint();
                       System.out.println("Works");
         public void generate(BufferedImage image) {
              int width = image.getWidth();
              int height = image.getHeight();
              int tnumber = (int) (height / Mandel.tnum);
              int n = 0;
              for (n = 0; n < Mandel.tnum - 1; n++) {
                   new MandelPix(tnumber * (n), tnumber * (n + 1), width).start();
              new MandelPix(tnumber * n, height, width).start();
         private static final double XMIN = -1.5;
         private static final double XMAX = .5;
         private static final double YMIN = -1;
         private static final double YMAX = 1;
         @Override
         public void actionPerformed(ActionEvent arg0) {
              System.out.println("painted");
              repaint();
    }Thread:
    import java.awt.Color;
    public class MandelPix extends Thread {
         public int start;
         public int limit;
         public int width;
         private int max_iteration = 1000;
         private static final double XMIN = -1.5;
         private static final double XMAX = .5;
         private static final double YMIN = -1;
         private static final double YMAX = 1;
         public MandelPix(int start, int limit, int width) {
              this.start = start;
              this.limit = limit;
              this.width = width;
         public boolean escapeMe(double x0, double y0) {
              double x = 0.0;
              double y = 0.0;
              int iteration = 0;
              while (x <= 2 && y <= 2 && iteration < max_iteration) {
                   double xtemp = x * x - y * y + x0;
                   y = 2 * x * y + y0;
                   x = xtemp;
              if (iteration == max_iteration) {
                   return true;
              return false;
         public void run() {
              for (int n = start; n < limit; n++) {
                   for (int i = 0; i < width; i++) {
                        double x = (XMIN + i * (XMAX - XMIN) / width);
                        double y = (YMIN + n * (YMAX - YMIN) / 500);
                        if (escapeMe(x, y)) {
                             Mandel.bnew.setRGB(i, n, Color.black.getRGB());
                        } else {
                             Mandel.bnew.setRGB(i, n, Color.white.getRGB());
    }

    Changes Made.
    import java.awt.Color;
    import java.awt.Container;
    import java.awt.Graphics;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.awt.image.BufferedImage;
    import java.awt.image.ColorModel;
    import java.awt.image.WritableRaster;
    import java.io.File;
    import java.io.IOException;
    import javax.imageio.ImageIO;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.Timer;
    public class Mandel {
         public static BufferedImage bnew;
         public static int tnum;
         public static int width;
         public static int height;
         public static void main(String[] args) {
               width = 500;
               height = 500;
              tnum = 5;
              JFrame mf = new MandelbrotFrame();
              mf.setSize(width, height);
              mf.setTitle("Mandel");
              mf.setLocationRelativeTo(null);
              mf.setVisible(true);
              mf.setDefaultCloseOperation(3);
    class MandelbrotFrame extends JFrame {
         public MandelbrotFrame() {
              Container contentPane = getContentPane();
              MandelbrotPanel mp = new MandelbrotPanel();
              contentPane.add(mp, "Center");
              Mandel.bnew = new BufferedImage(Mandel.width, Mandel.height,
                        BufferedImage.TYPE_INT_ARGB);
              mp.generate(Mandel.bnew);
    class MandelbrotPanel extends JPanel implements ActionListener {
         public void paintComponent(Graphics g) {
              super.paintComponent(g);
              g.drawImage(Mandel.bnew, 0, 0, null);
         public void generate(BufferedImage image) {
              int width = image.getWidth();
              int height = image.getHeight();
              int tnumber = (int) (height / Mandel.tnum);
              int n = 0;
              for (n = 0; n < Mandel.tnum - 1; n++) {
                   new MandelPix(tnumber * (n), tnumber * (n + 1), width).start();
              new MandelPix(tnumber * n, height, width).start();
              javax.swing.Timer t = new javax.swing.Timer(1000, new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        repaint();
                       System.out.println("Works");
         @Override
         public void actionPerformed(ActionEvent arg0) {
              System.out.println("painted");
              repaint();
    }

Maybe you are looking for

  • Get the values from a table comparing fields of different data types

    Hi Experts, I want to fetch AFVC-AUFPL and AFVC- APLZL by passing WBS element from a ztable. select aufpl aplzl   from  afvc   into TABLE gt_afvc   FOR ALL ENTRIES IN gt_boq   where projn = gt_boq-posid. AFVC-PROJN - NUMC 8  (WBC ELEMENT) ZTABLE-POSI

  • Database

    can anyone plz explain what are logical objects and physical object in oracle database? dose it mean the same logical structure and physical structures???? plz clear my doubt

  • SAP NetWeaver 7.02 ABAP Trial Version Installation issues

    I have been trying to install 7.02 trial version for a while but I keep running into issues. At present I am stuck, the install has been at the same load for the past 6 hours with no indication of an error or progress. Below is the last part of the p

  • Aperture lost all license and registration info

    did a update install....and Aperture will not run....lost all it's registration info

  • Ip obtained from WAP, but cannot communicate

    I have a Dell Truemobile 1150 wireless pc card.  I have all of the device drivers installed (orinoco drivers and pcmcia drivers). I cannot communicate with my WAP and any device on my network.  I am using dhcp and have successfully obtained an IP add