- questions from files / notes that I shared before - "Thinking in Java" book examples 1. Example of publish-subscriber (multiple threads) using a queue. 2. Job Manager. Implement console application that allows to - run a job - stop a job - get job status by job ID (Scheduled, Running, Finished, Failed) - stop all jobs - exit application Usage example: java -jar .jar --max-threads=4 >> start << id=23 >> status 23 << status=Running >> stop 23 << stopped << >> stop-all << stopped - add different jobs to emulate real application: - a job that fails with exceptions - long-running job (1-2 min): - infinite job ( while { //... } ) When you exit application (or executor pool) you have to list statuses of current jobs 3. Thread-safe, lazy singleton (no enums etc.). 4. Thread-safe Service Factory. Factory below is responsible for initializing services, by their name. Initialization of single service takes considerable amount of time (1 minute). Number of services is limited with approximately 10 services, but factory will be called often (100 requests per second). Factory is working in multithreaded environment. public class ServiceFactoryImpl { // ... // should be thread-safe // miminal blocking (for example, getService("a") shouldn't block getService("b)) // lazy public T getService(String name) { // ... // use createService method } private T createService(String name) { return new Service(name); } } class Service { // ... }