<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    ゞ沉默是金ゞ

    魚離不開水,但是沒有說不離開哪滴水.
    posts - 98,comments - 104,trackbacks - 0
    xecutorService interface provide us a base to release threads. It maintains everything related to threads.
    Analogy:
    This is very much similar to a small IT organization where a project manager handles all activities related to developers. Activities such as -how many person will be there in each team, if one team has less work then releasing some person from that team and shifting to another team, generate weekly report to submit to company etc. 
    If we see deeply -functions of ExecutorService are nothing but an exact replica of what a project manager does in a company.
    We create thread task , ExecutorService helps to release a thread and give the result back to us similarly company hires a person and project manager takes out the work from that person and company gets benefited.
    Threads Pool in ExecutorService Implementation:
    Most of the executor implementations in java.util.concurrent use thread pools, which consist of worker threads. This kind of thread exists separately from the Runnable and Callable tasks it executes and is often used to execute multiple tasks.
    Using worker threads minimizes the overhead due to thread creation. Thread objects use a significant amount of memory, and in a large-scale application, allocating and deallocating many thread objects creates a significant memory management overhead.
    Analogy:
    This is very much similar to big organizations in which a project manager have project leaders working under him to take care of developers. so project leaders are nothing but acting as thread POOL.
    Fixed Thread POOL:
    One common type of thread pool is the fixed thread pool. This type of pool always has a specified number of threads running; if a thread is somehow terminated while it is still in use, it is automatically replaced with a new thread. Tasks are submitted to the pool via an internal queue, which holds extra tasks whenever there are more active tasks than threads.
    Advantage:
    An important advantage of the fixed thread pool is that applications using it degrade gracefully. To understand this, consider a web server application where each HTTP request is handled by a separate thread. If the application simply creates a new thread for every new HTTP request, and the system receives more requests than it can handle immediately, the application will suddenly stop responding to all requests when the overhead of all those threads exceed the capacity of the system. With a limit on the number of the threads that can be created, the application will not be servicing HTTP requests as quickly as they come in, but it will be servicing them as quickly as the system can sustain. 
    Example-
    Suppose there are 8 threads in the Thread Pool. 
    First request comes in the queue : check if there is any Thread in the pool --> Yes , execute the task.
    9th request comes  in : No thread in pool currently --> Hold the task in the queue( Degrading the performance) --> wait until one among the currently running 8 task finishes --> as soon as one finished, run the ninth task ( graceful work)


    ExecutorServiceInterface -Important Methods


    Provide submit(…) in spite of execute(…)
    submit( Runnable    r) --> return Future< ? >
    submit( Callable<V> c) --> return Future<T>
    invokeAll( Collection< ? extends Callable<T>> task ) --> List<Future<T>>
    shutdownNow( ) --> List<Runnable>
    posted on 2012-08-06 10:30 ゞ沉默是金ゞ 閱讀(749) 評論(0)  編輯  收藏 所屬分類: Java SE
    主站蜘蛛池模板: 特级毛片A级毛片100免费播放 | 国产午夜鲁丝片AV无码免费| 亚洲福利一区二区| APP在线免费观看视频| 亚洲国产精品无码久久青草 | 一级A毛片免费观看久久精品| 国产免费人人看大香伊| 亚洲Av无码国产一区二区| 成年午夜视频免费观看视频 | 在线看片免费人成视频播| 亚洲国产精品无码一线岛国| 男人都懂www深夜免费网站| 自怕偷自怕亚洲精品| 中国在线观看免费高清完整版| 国产精品亚洲一区二区麻豆| 老司机永久免费网站在线观看| 亚洲av无码专区首页| 精品亚洲成α人无码成α在线观看| 国产精品小视频免费无限app | 在线不卡免费视频| 久久性生大片免费观看性| 在线观看亚洲一区二区| 24小时日本在线www免费的| 免费一区二区无码视频在线播放| 国产亚洲?V无码?V男人的天堂| 最近免费中文字幕大全高清大全1 最近免费中文字幕mv在线电影 | 自怕偷自怕亚洲精品| 又爽又高潮的BB视频免费看| 美女被cao网站免费看在线看| 亚洲欧洲日韩极速播放| 国产亚洲欧洲精品| 免费人成年激情视频在线观看| 久久久精品免费视频| 成人精品国产亚洲欧洲| 久久亚洲精品中文字幕| 亚洲精品专区在线观看| 精品免费久久久久久成人影院| 久久国产精品2020免费m3u8| 欧洲精品码一区二区三区免费看| 日本阿v免费费视频完整版| 一级毛片免费毛片毛片|