1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.chemistry.opencmis.client.runtime.async;
20
21 import java.util.concurrent.LinkedBlockingQueue;
22 import java.util.concurrent.ThreadPoolExecutor;
23 import java.util.concurrent.TimeUnit;
24
25 import org.apache.chemistry.opencmis.client.api.AsyncSession;
26 import org.apache.chemistry.opencmis.client.api.Session;
27
28
29
30
31
32 public class ThreadPoolExecutorAsyncSession extends AbstractExecutorServiceAsyncSession<ThreadPoolExecutor> {
33
34 private ThreadPoolExecutor executor;
35
36 public ThreadPoolExecutorAsyncSession(Session session) {
37 this(session, 5);
38 }
39
40 public ThreadPoolExecutorAsyncSession(Session session, int maxThreads) {
41 super(session);
42 executor = new ThreadPoolExecutor(maxThreads, maxThreads, 0L, TimeUnit.MILLISECONDS,
43 new LinkedBlockingQueue<Runnable>());
44 }
45
46 @Override
47 public ThreadPoolExecutor getExecutorService() {
48 return executor;
49 }
50 }