Skip to content

Instantly share code, notes, and snippets.

View nawazish-github's full-sized avatar

Nawazish Mohammad Khan nawazish-github

  • Couchbase
  • Bangalore, India
View GitHub Profile
@kabutz
kabutz / One.java
Created November 4, 2016 20:55
Strange class that compiled with JDK 9, but not 1.6, 1.7 nor 1.8.
/**
* As seen on https://javaspecialists.slack.com/messages/general
*
* This class fails to compile with JDK 1.6, 1.7 and 1.8:
*
* class Two extends Observable { // Nothing special about the choice of Observable here
* ^
* symbol: class Observable
* 1 error
*
@mnadeem
mnadeem / ScalingThreadPoolExecutor.java
Last active October 27, 2021 21:36
Scalable Thread Pool Executor (TPE) Which first creates threads up to max pool size and then queue up the tasks (Queue Does not depends upon Executor)
import java.util.Collection;
import java.util.Iterator;
import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TransferQueue;
public final class ScalingThreadPoolExecutor extends ThreadPoolExecutor {