Is there any way to limit the number of Threads running in Application(JVM)

Hello all,
is there any way to limit the number of Threads running in Application(JVM)?
how to ensure that only 100 Threads are running in an Application?
Thanks
Mohamed Javeed

You should definitely use a thread pool for this. You can specify maximum number of threads that can be run. Be note that the thread pool will only limit the number of threads that are submitted to it. So donot call "Thread"s start() method to start thread on your own. Submit it to the pool. To know more, study about executor service and thread pool creation. Actually it will not be more than 20 line code for a class and you might need maximum of 2 such classes, one for threadPool and other one for rejection handler (if you want).
Just choose the queue used carefully, you just have to pass it as a parameter to the pool.
You should use "Bounded" queue for limiting threads, but also be careful in using queues like SynchronizedQueue as the queue will execute immediately the threads submitted to it if maximum number of threads have not been running. Otherwise it will reject it and you should use rejection handler. So if your pool has a synchronized queue of size 100, if you submit 101th thread, it will be rejected and is not executed.
If you want some kind of waiting mechanism, use something like LinkedBlockingQueue. What this will do is even if you want 100 threads, you can specify the queue's size to be 1000, so that you can submit 1000 threads, only 100 will run at a time and the remaining will wait in the queue. They will be executed when each thread already executing will complete. Rejection occurs only when the queue oveflows.

Similar Messages

  • Is there any way to limit the number of RFC calls from xMII to SAP R/3

    Hi All!
    I wanted to know whether the number of simultaneous RFC connections made from xMII to SAP R/3 system can be controlled in any way. Suppose we have a scenario wherein some million Sales Orders or Production Orders are to be updated in SAP R/3 from xMII in a short span of time. For all these updations to take place, multiple RFC calls will be established from xMII to SAP at the same time. This will increase the load on the SAP R/3 system and affect performance of the SAP R/3 system. Is there any check on xMII side to limit the number of RFC calls that can be made to SAP R/3 system?
    Regards
    Anupam

    Anupam,
    If you are using 11.5 just keep in mind that the JCO connection points to a single application server (based upon the SAP Server alias connection settings), but the traffic itself to make a BAPI request is effectively the same as any client user traffic.  There will obviously be limitations on performance and throughput, with network and server constraints added to the number and size of the R/3 requests, but there is no magic formula to plug-in because of all of these variables.
    If you are using 12.0 (or plan to migrate when it goes GA) then taking advantage of the JRA (java resource adapter) and the associated application server pooling that it offers on the NetWeaver side of things will greatly help you in the throughput capacity.
    If you have put some of your xMII application into either test or productive use and are running into issues then I would highly recommend entering the specifics into the customer / partner support portal so that they can help you through any associated problems.
    Regards,
    Jeremy Good

  • Is there any way to limit the number of times that a PDF can be opened?

    I run a small publishing company and we want to provide exam copies of our books to professors.  At present our exam copies have the words EXAM COPY as a water mark on every page and we've also made the files so that they can't be printed or easily copied.  However, we'd like to also restrict these PDFs so that they can only be opened 5 times.  I've read about FileOpen but that approach seems a bit more complex than needed.  Is there any other way to restrict the number of times that a PDF file can be opened once it is downloaded?  Thanks in advance for any suggestions.

    DRM soltions like FileOpen are your best bet for PDFs. Others include Adobe's LiveCycle Rights Managment, LockLizard, Armjisoft PDF Security OwnerGuard, etc.
    They all work and are priced differently, but there's really nothing for what you want to do that is both simpler and secure.

  • *Is there any way to limit the Chart Bar size dynamically?*

    Hi
    I have selected the Marker size as Medium for my Bar chart.
    Bar chart bar showing too big when there is only one bar.
    Is there any way to limit the bar size dynamically?
    Thank you

    hi Ruwan,
    Don is correct in that there is no option in the chart design component to do this.
    what you can do though (i know it is a pain) is to
    1) create a new chart in a new section with a narrower bar using the chart options dialogue
    2) create a conditional suppression formula for the new section and the old chart section based on the value returned in the Show Value for the chart
    i have created a request for a charting overhaul [here |https://ideas.sap.com/community/products_and_solutions/crystalreports;jsessionid=B3E2E9F6A6CC9C9F5321659382A91855.node0]in the ideas place which includes a solution for this particular issue. please feel free to give it the thumbs up if you think that this is a worthwhile idea.
    jamie

  • My iphone is stolen .. is there any way to know the numbe of the person going to use in the future .. I have the serial no. and every thing .. and it is registered under my name and my information with iTunes ??

    my iphone is stolen .. is there any way to know the numbe of the person going to use in the future .. I have the serial no. and every thing .. and it is registered under my name and my information with iTunes ??

    If you had find my iphone activated on the iphone itself before it was stolen, then you may be able to track it.
    Otherwise, there is nothing you can do.
    Sorry.
    Report it to the police and your wireless carrier and change your password.

  • Is there a way to Limit the number of guest accounts a Sponsor can create from the sponsor portal?

    Hello,
    I am trying to find a way to limit the number of guest accounts a Sponsor can create from the portal. I am running ISE 1.2 and I am finding it difficult to limit the number of guests a sponsor can create.

    Interesting feature that unfortunately is currently not possible. I also don't think this is a feature that will be offered in the highly anticipated v1.3. I would recommend that you reach to your Cisco team and request this feature. 
    Thank you for rating helpful posts!

  • Is there any way to limit the memory firefox can use?

    once firefox reaches about 150Mb of memory it starts locking up and even if I manage to close it through taskmanager it still does not release the memory it was using.Is there any way to set a limit on how much memory firefox can use and a way of making sure it releases it again when shut.I run a dual core 1.8Gb cpu 2 Gb of ram and Win xp Pro service pack 3

    See:
    * http://kb.mozillazine.org/browser.sessionstore.max_windows_undo
    * http://kb.mozillazine.org/browser.sessionstore.max_tabs_undo

  • Is there any way to increase the number of codecs supported in FCE?

    Hi all - does anyone know if there is a way to allow FCE to natively edit more codecs than are listed in the default sequence settings? I use FCPro and have been encouraging folks at my University to use FCE for intermediate editing. I just found out that many formats supported in FCP are not supported in FCE.
    Are there any plug-ins or anything we can buy to increase the types of files that FCE will support (in a sequence without rendering)?
    Follow up: if not, can anyone tell me the specifics of the 720p30 AIC format that FCE uses?
    Apple Intermediate Codec
    1280x720
    30fps progressive?
    bitrate?
    audio sampling rate?
    It seems odd to me that FCE has such a limited number of formats it supports natively. And why isn't ProRes 422 a part of FCE? I thought that was their big thing now - HD wihtout taking up all the real estate that AIC does.
    Thanks. I'm frustrated with both iMovie and FCE and wishing that Sony Vegas worked on Macs!

    Hi(Bonjour)!
    Well FCE is a stripped down version of FCP, for a fraction of the price. It was aimed to produce TV content in TV native resolution.
    In the past years, HDV and AVCDHD were added through AIC codec.
    For most of FCE users (from the beginner to intermediate video editors)those formats are adequate.
    To have access to native HDV or to Apple ProRes 422, you have to buy Final Cut Studio 2. All those codecs will be available in FCE export with quickitme conversion settings.
    Michel boissonneault

  • In Numbers, is there a way to limit the number of characters in a cell?

    Hi,
    New to communities, so I apologize for the length of this question.
    I have exported a spreadsheet from one source and am opening it using Numbers.  In one column - lets say column C - the list contains 35 characters.
    I am trying to import this spreadsheet into another program which will only allow 30 characters to be in column C. 
    I have been unable to find a way to limit column C to 30 characters so I am able to import it into the new program. The field will contain numbers and letters.
    Any help will be greatly appreciated!

    ricochetron,
    you can place Jerry's suggested formula in any column convenient for you.  If column D is unused then do the following:
    enter the fomula in cell D1.  Shorthand for this is:
    D1=left(C1, 30)
    then hit the enter key.
    now select D1 and copy using the menu item "Edit > Copy".  Now select the whole column by clicking the letter "D" in the column reference tab:
    now paste using the menu item "Edit > Paste" to fill the formula to every selected cell in the column:
    You can now copy the limited text from column D and paste as needed.  If you paste to another cell or table you should use the menu item "Edit > Paste Values"

  • Is there a way to limit the number of allowed sessions (or limit based on load) to iWS, and redirect to an error page when this number is reached?

    We have a setup with two iWS servers infront of an iAS cluster and want to give a 'nice' error message upfront, instead of running the backend servers to the limit affecting the overall user experience.

    Typically a server has a settable parameter to limit concurrent connections. Check the server's documentation.

  • Is there a way to find the number of downloads of music from itunes store?

    Hi,
    Is there any way to find the number of downloads of each music file available on itunes store. If not exact no of downloads but atleast a relative term to find the rank of the music track From any API
    Thanks
    Sandeep

    A: Is there a way to read the number of active sequence executions from the Engine?

    Scott,
    > One way of handling the issue of init once a set of instruments is to
    > create a new sequence file that has a sequence to init and a sequence
    > to close the instruments. Assuming that you always terminate a
    > sequence and do not abort them, you could add a ProcessSetup and
    > ProcessCleanup callback sequences to the client sequence file that
    > using these instruments. These callbacks are automatically called by
    > the process model in both the Single Pass and Test UUTs execution
    > entry points. The callback sequences could call the init and close
    > sequences for the hardware. In the hardware sequence file you could
    > reference count the number of execution that init and close by setting
    > the file globals in the sequence file to be shared across executions
    > and then add a numeric value that keeps track of references for the
    > instruments. The init sequence adds to the count, and the close
    > sequence subtracts from the count. The init sequence inits the HW if
    > the count is 0->1 and the close sequence closes the HW if the count is
    > 1->0.
    >
    > This is one of many ways in TestStand that this could be done, not to
    > mention that this could also be done in a similar way in a LabVIEW VI
    > or DLL directly.
    That sounds like it will work. I'll try adding a client count
    increment/decrement in the DLL initialize and terminate functions. This
    should essentially perform the same tasks as the callback scheme you mention
    above, no?
    The reason I didn't think the 'client counting' scheme would work initially
    was I mistakenly thought that the termination function would not get called
    under Terminate conditions. Since Terminate conditions happen a LOT during
    our initial debug of new UUT types, I didn't think that would be acceptable.
    I forgot that lacing the terminate funciton in a cleanup step group, I can
    force it to be called in Terminate conditions.
    > If you abort an execution then the reference counting idea above would
    > fail to decrement properly. That might b... [Show more]

    Read other 5 answers

  • Is there any way to link page number with the reference page number within text in InDesign CC and CS6?

    Is there any way to link page number with the reference page number within text in InDesign CC and CS6?

    You should ask in InDesign
    The Cloud forum is not about using individual programs
    The Cloud forum is about the Cloud as a delivery & install process
    If you will start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • Someone had my apple id password and bought a game from the App Store. I've changed my password but is there any way to find he number it was downloaded to?

    Someone had my apple id password and bought a game from the App Store. I've changed my password but is there any way to find he number it was downloaded to?

    Contact iTunes support

  • Is there any way to find the serial number of an ipod touch that is no hooked up to the computer?  It was stolen and we need the number to give to the police.

    Is there any way to find the serial number of an ipod touch that is no hooked up to the computer?  It was stolen and we need the number to give to the police.

    If the product was registered, the serial number should be here, under My Products:
    https://supportprofile.apple.com/MySupportProfile.do

  • My computer crashed, I don't have the serial number for lightroom 4.  Is there any way to retrieve the serial number.  I can't remember where I purchased this.

    My computer crashed, I don't have the serial number for lightroom 4.  Is there any way to retrieve the serial number.  I can't remember where I purchased this.

    Lfiles37 if the serial number has been registered then it will be available under your account.  You can find more details at Find your serial number quickly - http://helpx.adobe.com/x-productkb/global/find-serial-number.html.

Maybe you are looking for

  • [SOLVED] 64 bit version of Brasero 0.6.1-4 refused to start

    I got this error when trying to run brasero version 0.6.1-4: brasero: error while loading shared libraries: libburn.so.4: cannot open shared object file: No such file or directory ...even though that I have libburn version 0.4.0-1 installed. I run 'l

  • Cannot download or view the attachments from PCUI BSP appliations in portal

    Hello, We are not able to view or download the attachments uploaded into any of the PCUI BSP applications called in portal. Initially we were not able to upload to but activating the services for the PCUI applications made it work, I am not sure if t

  • Contact pictures not showing after update...

    Just downloaded/installed the update for my 9900 via OTA (7.0.0.585) and when I went through my contact list, I noticed that at least half of them don't have pictures. (which are linked through FB) This was also the case for my BBM contacts. Would th

  • TV won't turn on

    I brought a new tv from Wallmart (where I get all my shopping needs) and connected the cable box from verizon...  but the tv for some reason won't turn on!

  • Can someone help me print wirelessly​?

    Toshiba laptop running vista 64-bit connected through DLink wireless router. HP Officejet Pro L7780 All-in-One connected through DLink wireless router. I can print fine using a wired connection but I want to set it up so I can print wirelessly.  When