Source:
public RedisRequestResponseHandler(Pool<Jedis> p, LwM2mServer server, ClientRegistry clientRegistry, RedisTokenHandler tokenHandler, ObservationRegistry observationRegistry) { this.server = server; this.clientRegistry = clientRegistry; this.observationRegistry = observationRegistry; this.tokenHandler = tokenHandler; this.excutorService = Executors.newCachedThreadPool( new NamedThreadFactory(String.format("Redis %s channel writer", RESPONSE_CHANNEL))); this.observationRegistry.addListener(new ObservationRegistryListener() { @Override public void newValue(Observation observation, ObserveResponse response) { handleNotification(observation, response.getContent()); } @Override public void newObservation(Observation observation) { } @Override public void cancelled(Observation observation) { observatioIdToTicket.remove(new KeyId(observation.getId())); } }); this.server.addResponseListener(new ResponseListener() { @Override public void onResponse(Client client, String requestTicket, LwM2mResponse response) { handleResponse(client.getEndpoint(), requestTicket, response); } @Override public void onError(Client client, String requestTicket, Exception exception) { handlerError(client.getEndpoint(), requestTicket, exception); } }); this.pool = p; new Thread(new Runnable() { @Override public void run() { do { try (Jedis j = pool.getResource()) { j.subscribe(new JedisPubSub() { public void onMessage(String channel, final String message) { handleSendRequestMessage(message); }; }, REQUEST_CHANNEL); } catch (Throwable e) { LOG.warn("Redis SUBSCRIBE interrupted.", e); } try { Thread.sleep(500); } catch (InterruptedException e) { } LOG.warn("Relaunch Redis SUBSCRIBE."); } while (true); } }, String.format("Redis %s channel reader", REQUEST_CHANNEL)).start(); }

Target:
public RedisRequestResponseHandler(Pool<Jedis> p, LwM2mServer server, ClientRegistry clientRegistry, RedisTokenHandler tokenHandler, ObservationRegistry observationRegistry) { this.server = server; this.clientRegistry = clientRegistry; this.observationRegistry = observationRegistry; this.tokenHandler = tokenHandler; this.executorService = Executors.newCachedThreadPool( new NamedThreadFactory(String.format("Redis %s channel writer", RESPONSE_CHANNEL))); this.observationRegistry.addListener(new ObservationRegistryListener() { @Override public void newValue(Observation observation, ObserveResponse response) { handleNotification(observation, response.getContent()); } @Override public void newObservation(Observation observation) { } @Override public void cancelled(Observation observation) { observatioIdToTicket.remove(new KeyId(observation.getId())); } }); this.server.addResponseListener(new ResponseListener() { @Override public void onResponse(Client client, String requestTicket, LwM2mResponse response) { handleResponse(client.getEndpoint(), requestTicket, response); } @Override public void onError(Client client, String requestTicket, Exception exception) { handlerError(client.getEndpoint(), requestTicket, exception); } }); this.pool = p; new Thread(new Runnable() { @Override public void run() { do { try (Jedis j = pool.getResource()) { j.subscribe(new JedisPubSub() { public void onMessage(String channel, final String message) { handleSendRequestMessage(message); }; }, REQUEST_CHANNEL); } catch (RuntimeException e) { LOG.warn("Redis SUBSCRIBE interrupted.", e); } try { Thread.sleep(500); } catch (InterruptedException e) { } LOG.warn("Relaunch Redis SUBSCRIBE."); } while (true); } }, String.format("Redis %s channel reader", REQUEST_CHANNEL)).start(); }