+ log.info("{} - Starting - produced {} messages before", id, produced);
+ running = true;
+ executor.submit(this);
+ }
+
+ public synchronized void stop() throws ExecutionException, InterruptedException
+ {
+ if (!running)
+ throw new IllegalStateException("Producer instance " + id + " is not running!");
+
+ log.info("{} - Stopping...", id);
+ running = false;
+ }
+
+ @PreDestroy
+ public void destroy() throws ExecutionException, InterruptedException