This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.nkcoder.module.javatest.concurrent; | |
import java.util.concurrent.*; | |
import java.util.concurrent.atomic.AtomicLong; | |
import java.util.logging.Logger; | |
/** | |
* created by daniel at 2/5/17 22:54 | |
*/ | |
public class TimingThreadPool extends ThreadPoolExecutor { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.nkcoder.module.javatest.concurrent; | |
import java.util.concurrent.*; | |
import java.util.concurrent.atomic.AtomicLong; | |
import java.util.logging.Logger; | |
/** | |
* created by daniel at 2/5/17 22:54 | |
*/ | |
public class TimingThreadPool extends ThreadPoolExecutor { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.nkcoder.module.javatest.concurrent; | |
import java.util.concurrent.CompletableFuture; | |
/** | |
* {@link: http://www.deadcoderising.com/java8-writing-asynchronous-code-with-completablefuture/} | |
* Created by nkcoder on 12/21/16. | |
*/ | |
public class CompletableFutureTest { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.nkcoder.module.javatest.concurrent; | |
import java.util.concurrent.*; | |
/** | |
* Created by nkcoder on 12/21/16. | |
*/ | |
public class CompletionServiceTest { | |
public static void main(String[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.nkcoder.module.javatest.concurrent; | |
import java.util.concurrent.Semaphore; | |
import java.util.concurrent.TimeUnit; | |
/** | |
* created by daniel at 12/16/16 08:33 | |
*/ | |
public class SemaphoreTest { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.nkcoder.module.javatest.concurrent; | |
import java.time.Duration; | |
import java.time.Instant; | |
import java.util.Random; | |
import java.util.concurrent.CountDownLatch; | |
/** | |
* created by daniel at 12/15/16 21:45 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ch.qos.logback.classic.Level; | |
import ch.qos.logback.classic.LoggerContext; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import java.util.List; | |
/** | |
* change log level at runtime | |
* Created by nkcoder on 10/8/16. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.nio.file.*; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.concurrent.*; | |
import java.util.stream.Stream; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DeadLockDemo { | |
public static void main(String[] args) { | |
Object o1 = new Object(); | |
Object o2 = new Object(); | |
Runnable r1 = () -> { | |
synchronized(o1) { | |
try { | |
Thread.sleep(3000); | |
} catch (Exception e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme", | |
"font_face": "source code pro", | |
"font_size": 14, | |
"ignore_vcs_packages": true, | |
"ignored_packages": | |
[ | |
"Vintage" | |
], |
NewerOlder