I'm writing a webserver with spring(mvc,data,security) which is serving tasks to physical devices(device count is around 100).
Device doesn't have query implementation inside. For example to execute some task u need write something like this:

```
Device driver = new DeviceDriver();
driver.setSettings(settingsJson);
driver.open(); // noone else can't connect to this device, open() can take up to 1 second
driver.setTask(taskJson);
driver.processTask(); // each task takes a few seconds to execute
String results = driver.getResults();
driver.close();

```

I'm not really an expert in designing architecture, so for now implemented webserver like this:

**TaskController**(@RestController) - processing incoming Post requests with tasks and persisting them to database. 

**DeviceService**(@Service) - has init method, which gets list of devices from DB and creates/starts one worker per device. It passes taskRepository to each worker, so worker inside can save results of tasks.

**Worker** - extends **Thread**, it gets next task from database with certain period(via loop with sleep). When task executed worker saves result to db and updates status of task.

Does this approach makes any sense? Maybe there is better way to do this using spring components instead of Thread.