Example & Tutorial understanding programming in easy ways.

What are the different policy in Executor Framework?

There are different policy within ThreadPoolExecutor in java are as follows.

a. ThreadPoolExecutor.AbortPolicy : AbortPolicy is a handler for rejected task. It handles those task which has been rejected.

b. ThreadPoolExecutor.CallerRunsPolicy : This also handles the rejected task and runs the rejected task directly.

c. ThreadPoolExecutor.DiscardOldestPolicy : This handles those rejected task that is oldest and unhandled. It discards those that oldest task.

d. ThreadPoolExecutor.DiscardPolicy : This is the handler for those rejected task that are rejected silently.

Read More →