22
22
import java .util .Map ;
23
23
import java .util .Map .Entry ;
24
24
import java .util .UUID ;
25
+ import java .util .concurrent .ExecutorService ;
25
26
26
27
import javax .servlet .http .HttpServletResponse ;
27
28
@@ -54,6 +55,9 @@ public class MoveObjectsController {
54
55
55
56
private final Map <String , MoveRequest > moveRequests ;
56
57
58
+ @ Autowired
59
+ private ExecutorService moveExecutor ;
60
+
57
61
public MoveObjectsController () {
58
62
moveRequests = new HashMap <>();
59
63
}
@@ -72,10 +76,10 @@ Map<String, Object> moveObjects(@RequestBody MoveRequest moveRequest, HttpServle
72
76
73
77
moveRequest .setUser (GroupsThreadStore .getUsername ());
74
78
75
- Thread moveThread = new Thread ( new MoveRunnable (moveRequest , GroupsThreadStore .getGroups () ));
76
- log .info ("User {} is starting move operation of {} objects to destination {}" ,
79
+ MoveRunnable runnable = new MoveRunnable (moveRequest , GroupsThreadStore .getGroups ());
80
+ log .info ("User {} is queuing move operation of {} objects to destination {}" ,
77
81
new Object [] { GroupsThreadStore .getUsername (), moveRequest .moved .size (), moveRequest .getDestination ()});
78
- moveThread . start ( );
82
+ moveExecutor . submit ( runnable );
79
83
80
84
response .setStatus (200 );
81
85
@@ -212,6 +216,9 @@ public MoveRunnable(MoveRequest request, AccessGroupSet groups) {
212
216
@ Override
213
217
public void run () {
214
218
try {
219
+ log .info ("Move of {} objects to {} for user {} has begun" , new Object [] {
220
+ request .getMoved ().size (), request .getDestination (), request .getUser () });
221
+
215
222
moveRequests .put (request .getId (), request );
216
223
217
224
GroupsThreadStore .storeGroups (groups );
0 commit comments