February 2018 - Mar Java Mit Java

Monthly Archive: February 2018

How to use Jedis in multi threaded environment 0

How to use Jedis in multi threaded environment

Jedis instances are single threaded Don’t use the same Jedis connection instance from multiple threads at the same time. Using the same Jedis instance from multiple threads at the same time will result in...

How to catch exception thrown by a thread 0

How to catch exception thrown by a thread

In this example we will see how to use Thread.UncaughtExceptionHandler. UncaughtExceptionHandler is used as a way to provide an elegant way to handle Runtime Exceptions which are not handled otherwise in the programs. As...

Reading the response of running a process 0

Reading the response of running a process

We all know we can use Java’s Process API to run any executable. But sometimes these executios might return some response or perhaps throw some exceptions. How to read them? So here is simple...

How to post an image in Java 0

How to post an image in Java

There are many API endpoints which expect images or files to be submitted as part of the body. In Java we can do that easily using HTTP client library. Here is the sample code...