Getting problem with the new java.util.concurrent package

i m using the new concurrency package of jdk 1.5 in my code. see the line:
Executor threadPool = Executors.newCachedThreadPool();
about this, api doc says Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available
but i dont find this method to create new threads whenever required. please tell me about this.
in my code, in some rare cases many threads r created, and very difficult to detect the number of active threads.
as the previous one failed i tried with another one newFixedThreadPool(int). but here i got another problem. it works successfully but i dont understand what should be the size of the pool. i tried with 1000, it works well, but in a very rare case, it failed also. then i tried with 10000. but i m still confused, i dont know whether it would work always or not. with traditional threads my code never fails.
please tell me, what should be the size of the pool and also let me know what is the problem with the first one (newCachedThreadPool)

The thread pool should not be more than 100 threads. Ideally you should only have a small number of threads per CPU. If your threads are not long running it is possible that you could add 10,000 runnables but on start a small number of threads. Note, adding a thread take a non trivial amount of time so while the thread is added, all the others could finish. This could mean the number of threads could be 140 or smaller.
Have you looked at the code to see what it does?

Similar Messages

  • Is anyone else having problems with the new software update for macbook? I get random clicking and flicker an movement of the pointer!

    Is anyone else having problems with the new software update for macbook? I get random clicking and flicker an movement of the pointer!

    OS X 10.7 Lion, 10.8 Mountain Lion & 10.9 Mavericks
    Reset Password starting from Recovery HD
    Start the computer,then press and hold down command and R keys to start into recovery partition.
    When you see the Apple logo, release the keys.
    Wait until  OS X Utilities window shows up.
    Move the mouse to the menubar at the top and click "Utilities", then select "Terminal"
    from the drop down.
    Terminal window will appear.
    Type in   resetpassword   and press enter on the keyboard.
    Leave the Terminal window open.
    Reset Password Utility window will open with Macintosh HD selected.
    Select the user account from the popup menu box.
    Enter a new password.
    Reenter the new password for the user.
    Enter a hint.
    Click the "Save" button.
    Click  in the menubar and select Restart.
    Log in.
    If Keychain dialog box appears, select “Create New Keychain”.

  • I am not getting any sound input on my microphone. There is no microphone input on my new macbook pro, so I am using my old one. Is this a problem with the new operating system? Did they simply remove any microphone software?

    I am not getting any sound input on my microphone. There is no microphone input on my new macbook pro, so I am using my old one. Is this a problem with the new operating system? Did they simply remove any microphone software?

    Check System Preferences > Sound > Output
    Make sure the correct device is selected.

  • Problems with the new Pages.

    Hi everyone.
    I wonder if i am the only one experiencing a little problem with the new Pages?
    My problem is that every other time i want to correct the font lets say trying to underline or make the font fatter using the hotkeys "Command+B" or "Command+U" or "Command+I", or even changing it manually in "formats" my font gets stuck, and i have to copy-paste text from another pages-file into my old one to get et back to normal.
    Anyone else tried this?
    Martin.

    VladRO wrote:
    These are the problems that I am encountering for the moment! If there will come up some new once, I will write them here!
    Instead of starting a new list, go to
    https://discussions.apple.com/thread/5468056?tstart=0

  • I am having trouble with my bluetooth skipping while its playing music from my Itunes music...I thought that this was an antiquated problem with the new technology?

    I am having trouble with the music from my bluetooth "skipping" on my IPhone 5.  I thought that this was an antiquated problem with the new technology.  It's very frustrating to purchase all of this music and expect great sound and playability and get "skipping".  Any ideas on how to resolve this issue?

    Does the issue occur when listening to the media using the speaker or wired headphones?  If it does, the issue is with the media itself.
    If it does not, it's likely a bad connection or interference.

  • I just upgraded my iMac to Lion, and a few seconds ago, I upgraded the iWork package and now I'm having some problems with the new version of Pages (4.1) When I try to change something in a document, a message says "the program is not responding"

    I just upgraded my iMac to Lion, and a few seconds ago, I upgraded the iWork package and now I'm having some problems with the new version of Pages (4.1) When I try to change something in a document, a message says "the program is not responding", so I have to force it to close. By the way, the SAVE botton stays the same even I change erverything in my document. Please, a have a work to finish, **** me. What I can do abou it?

    I just upgraded my iMac to Lion, and a few seconds ago, I upgraded the iWork package and now I'm having some problems with the new version of Pages (4.1) When I try to change something in a document, a message says "the program is not responding", so I have to force it to close. By the way, the SAVE botton stays the same even I change erverything in my document. Please, a have a work to finish, **** me. What I can do abou it?

  • Problem with the new server UCS C220 for set IP to CIMC

    Hi
    We’ve a problem with the new server UCS C220.
    We bought two servers UCS C220 M3 for CallManager 8.6 with High Availability.
    When we turn on the server during the boot and when it tells us, oppress F8 to enter at the CIMC and set the IP. But it never enters at the CIMC.
    Then, we configure our DHCP server and our switch, we connect the three gigabyte ports to our switch to give him an IP to the CIMC, so and then can enter via browser, but neither works.
    Note. The dedicated management NIC does not link, the other two ports do make link.
    What do you suggest to put an IP to CIMC and start installing our applications?
    regards

    You may have noticed that there is no DVD rom on the c220. What you need to do is:
    Login into the CIMC from your browser
    Luanch the KVM
    Insert the VMware DVD in your machines drive
    On the KVM pop up there should be a tab to mount the drive, after mounting it click on Macros and choose ctrl_alt+delete to restart.
    After the VMware OS installs press F2 to enter IP.
    Browse to the VMware ip to download the Vsphere client
    Open the Vsphere client, enter the ip of the vmware and the username will be root and no password if you did not set one.
    You can now upload OVA templates or manually create virtua machine from this enviroment.
    Hope this help

  • I am having email problems with the new Lion.  stmp, imap, etc. I have looked up google info and It is confusing when it comes to TS, SSL also, please explain how to set it up so my email goes out and comes in securely.  Help

    I am having email problems with the new Mountain Lion.  stmp, imap, etc. I have looked up google info and It is confusing when it comes to TS, SSL also, please explain how to set it up so my email goes out and comes in securely.  Help
    Incoming Mail (IMAP) Server - requires SSL:
    imap.gmail.com
    Use SSL: Yes
    Port: 993
    Outgoing Mail (SMTP) Server - requires TLS:
    smtp.gmail.com (use authentication)
    Use Authentication: Yes
    Use STARTTLS: Yes (some clients call this SSL)
    Port: 465 or 587
    Account Name:
    your full email address (including @gmail.com) Google Apps users, please enter username@your_domain.com
    Email Address:
    your full Gmail email address ([email protected]) Google Apps users, please enter username@your_domain.com
    Password:
    your Gmail password
    The Quick Answer
    Follow the instructions below to set up IMAP1 access in most email clients.
    Google Apps users, please follow the default instructions unless otherwise noted, replacing 'your_domain.com' with your actual domain2 name.
    this is all greek to me. WHAT IS STARTTLS? On the first page of Apple set up there is a TLS certificate and it is marked NONE- should I change it to the long APPLE CERT option?  The next page under ADVANCED: THERE IS A BOX SSL MARKED.  Then IMAP Path Prefix - I put stmp.gmail.com.. is that right?  Port 993 can  use this one? as 456 doesn't work and 587 said it wasn't safe.  Under AUTHENTICATION I used PASSWORD.  Should I have used external client cert TLS?
    Please help me set this up securely. Thanks

    Apple - Support - Mail Setup Assistant

  • Since the most recent Firefox update 3.6.8 by banking institution no longer shows as having a secure encrypted connection, however, my bank assures me all is well with their certificates and that is a problem with the new Firefox browser update, can you g

    Since the most recent Firefox update 3.6.8 my banking institution no longer shows as having a secure encrypted connection, however, my bank assures me all is well with their certificates and that is a problem with the new Firefox browser update, can you give me some idea why it is doing this?
    == This happened ==
    Every time Firefox opened
    == Right after the new Firefox update

    Hello Anne.
    Can you please try it in a new (temporary) Firefox profile and see if the issue is still present? See [http://support.mozilla.com/en-US/kb/Managing+profiles this article] to know how to create a new Firefox profile. Please report back the results.

  • Is Anyone Having Problems with the newer version of Firefox?

    I still have my older Mac OsXv10.4 Tiger software. I wasn't exactly happy with Safari browser as it would block many sites and were considered incompatible so I downloaded the free Firefox browser (the 2.0 version) of which I STILL have. I'm aware that there is a much newer version and would like to download that, but I've heard a lot of people saying they have been having severe problems with it, but then they have PCs and not Macs.
    So my question is for you Mac users that use Firefox, have you had major problems with the newer version? I'm real hesitant to download if I'm going to have the same problem PC users are having...like constantly crashing. Also would my old Tiger software be compatible? I don't want to upgrade to Leopard.

    Yes. I had problems with Firefox 3.5. The primary problem was very slow or never-ending loading of certain websites (particularly secure sites and sites with many features). I also have had similar, but not as bad, problems with Safari 4. I never had these problems with Safari 2 or Firefox 2. It just seems that with each update, the problems increased for me. I have read the Safari and Firefox forums and tried many fixes with little improvement. I have come to the conclusion that there is some kind of compatibility problem between the latest versions of Safari and Firefox and Shockwave Flash and/or Javascript and OS 10.4, particularly on PPC Macs. I expect there are many who will disagree and I cannot argue or prove the point. This is just my opinion. And I recognize that my problems could be caused by my setup and not by the browsers. By the way, I do not use any add-ons with any of my browsers. Anyway, I got tired of dealing with it and installed the latest version of Camino about 2 weeks ago. I also did a clean install of Firefox 3.0.13. Camino is working out great for me. It is simple and it works. No problems at all. So currently I am using Camino as my primary browser and Firefox 3.0.13 as my backup. I hope this helps.

  • HT4623 Has any one had a problem with the new download?

    Has anyone had a problem with the new download?

    Here's what others have done successfully to work around that problem: In your Web browser, go to Photoshop.com and log in.  You should be asked to accept the Terms Of Use.  Once you have, then you won't have any issue with accessing Photoshop.com from PSE.

  • HT4623 Is anyone else having problems with the new up date?  it's messed up all my passcode and everything

    Is anyone having problems with the new update?? it has messed up my mail I can't send and all my passwords are messed up

    Is anyone having problems with the new update?? it has messed up my mail I can't send and all my passwords are messed up

  • How can I do a complete Time Capsule backup on an external USB hard disc with the new AirPort utility V6?

    How can I do a complete Time Capsule backup on an external USB hard disc with the new AirPort utility V6?
    It was possible in the AirPort utility V5, but in the new V6 I can't find this option.

    Download and use 5.6.. the other non-toy version of Apple's Airport Utilities.
    http://support.apple.com/kb/DL1482

  • Using ExecutorService class from java.util.concurrent package

    Dear java programmers,
    I have a question regarding the ExecutorService class from java.util.concurrent package.
    I want to parse hundreds of files and for this purpose I'm implementing a thread pool. The way I use the ExecutorService class is summarized below:
    ExecutorService executor = Executors.newFixedThreadPool(10);
            for (int i = 0; i < 1000; i++){
                System.out.println("Parsing file No "+i);
                executor.submit(new Dock(i));
            executor.shutdown();
            try {
                executor.awaitTermination(30, TimeUnit.SECONDS);
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            executor.shutdownNow();However, the code snippet above creates all the 1000 threads (Dock objects) at once and loads them to the executor, and thus I'm worrying about memory leak. I haven't tested it on 1000 files yet but just on 50 small ones, and even if the program prints out "Parsing file No "+i 50 times at once, it executes normally the threads in the background.
    I guess the write way would be to keep the number of active/idle threads in the executor constant (lets say 20 if the thread pool's size is 10) and submit a new one whenever a thread has been finished or terminated. But for this to happen the program should be notified someway whenever a thread is done. Can anybody help me do that?
    thanks in advance,
    Tom

    Ok I found a feasible solution myself although I'm not sure if this is the optimum.
    Here's what I did:
            ExecutorService executor = Executors.newFixedThreadPool(10);
            Future<String> future0, future1, future2, future3, future4, future5, future6, future7, future8, future9;
            Future[] futureArray = {future0 = null, future1 = null, future2 = null, future3 = null, future4 = null, future5 = null,
            future6 = null, future7 = null, future8 = null, future9 = null};
            for (int i = 0; i < 10; i++){
                futureArray[i] = executor.submit(new Dock(i));
            }I created the ExecutorService object which encapsulates the thread pool and then created 10 Future objects (java.util.concurrent.Future) and added them into an Array.
    For java.util.concurrent.Future and Callable Interface usage refer to:
    [http://www.swingwiki.org/best:use_worker_thread_for_long_operations]
    [http://www.particle.kth.se/~lindsey/JavaCourse/Book/Part1/Java/Chapter10/concurrencyTools.html]
    I used a Future[] Array to make the code neater. So after that I submitted -and in this way filled up- the first 10 threads to the thread pool.
            int i = 9;
            while (i < 1000){
                for (int j = 0; j < 10; j++){
                    if (futureArray[j].isDone() && i < 999){
                        try{
                            i++;
                            futureArray[j] = executor.submit(new Dock(i));
                        } catch (ExecutionException ex) {
                            ex.printStackTrace();
                        } catch (InterruptedException ex) {
                            ex.printStackTrace();
                try {
                    Thread.sleep(100); // wait a while
                } catch(InterruptedException iex) { /* ignore */ }
            executor.shutdown();
            try {
                executor.awaitTermination(60, TimeUnit.SECONDS);
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            executor.shutdownNow();
        }Each of the future[0-9] objects represents a thread in the thread pool. So essentially I'm check which of these 10 threads has been finished (using the java.util.concurrent.Future.isDone() method) and if yes I replenish that empty future[0-9] object with a new one.

  • How to get and install the new MSI Bluetooth Software Package 1.4.3.3.

    How to get and install the new MSI Bluetooth Software Package 1.4.3.3.
    This little FAQ will only cover the new version of MSI Bluetooth Software Package.
    First thing too do is unistall any older version of the MSI Bluetooth Software.
    Do this through the Add/Remove program applet in your control panel.
    There seams too be only through Live update you could get the new version of MSI Bluetooth Software Package.
    If you can't see any enter for MSI Bluetooth Software in the Live driver section of Live update then you have too enter the following too your registry.
    Create following code in Notepad and save it as MSILD.reg, then run the file.
    ;-->Code start
    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SOFTWARE\MSI\Drivers\MSI Bluetooth Software]
    "DrvSetup"="1"
    "Version"="1.4.2.10"
    ;-->Code end
    Rerun the Live update and hopefully you will now see a entry for MSI Bluetooth Software in Live driver section.
    Install the new version of MSI Bluetooth Software and reboot your computer. Even if the setup program doesnt told you too doit.
    After rebooting the computer you will see the Bluetooth icon in the taskbar. If it's Red then try too start the Bluetooth services by right click on the try icon and the only alternetiv there is.
    If the Bluetooth services is asking for a valid licens.dat then you should do the following.
    Surf to Jon's Bluetooth guide http://www.jonsguides.com./bluetooth/prepare.html and download the patcher from the link there.
    Unzip the the patcher and then run the BTWPatcher.exe program.
    Now the Bluetooth services will start and you will bee able too configure your own settings for the Bluetooth services.
    If nothing of this work you could try the complete Bluetooth solution at Jon's gudie and install the IBM version of the same program. I havent test this solution and will not do soo.

    I have the MS-6968 device and i want to use driver 1.4.x or 3.0.x. I found the driver 1.4.2.10 but i cannot find any WIDCOMMSecurity code.
    So, can anyone give me a link for BTWPatcher.exe???
    It cannot be found here (Jon's Bluetooth ) anymore.
    Thanks

Maybe you are looking for

  • Command-5 shortcut for 5-star rating photos in iPhoto not working

    When I go to 5-star rate a photo in iPhoto using the default Command-5 shortcut, the shortcut no longer works. The Command-1, Command-2, Command-3, Command-4 shortcuts work for (1-star through to 4-star ratings), but for some reason Command-5 no long

  • Adding a field in the VF31 Output list

    Dear Experts We have a requirement such that in the VF31 Output screen which will list the billing document no and the output types, we should add a new column in the output list. This new column will have the sales group key.  Considering that sales

  • Errors while importing support

    hello all, I am getting following errors while importing support packages Queue SPAMu2026 - Error in phase: CHECK_REQUIREMENTS - Reason for error: TP_CANNOT_CONNECT_SYSTEM - Return code: 0232 - Error message: connect failed I have checked the TPPRAM

  • Export camera

    hi i am doing a little 1 second transition using a camera which swings around to swipe on a video layer. everything looks good in the projects but when I come to expor all i get is the background - no video have tried chanig my in/out etc and export

  • BEST METHOD OF DIGITIZING FROM DV DECK TO NEW MAC MINI

    Hi and thanks for the help. I've got a brand new mac mini on the way and I've been using a JVC SRDVM600 player/recorder as my mini DV source machine to digitize to my old mini through its 4 pin IEEE 1394 firewire port.  Now the new mini has firewire