File tree Expand file tree Collapse file tree
src/main/java/com/couchbase/lite Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -689,5 +689,13 @@ protected boolean isAutoMigrateBlobStoreFilename() {
689689 private static boolean isWindows () {
690690 return (OS .indexOf ("win" ) >= 0 );
691691 }
692+
693+ /**
694+ * @exclude
695+ */
696+ @ InterfaceAudience .Private
697+ public int getExecutorThreadPoolSize () {
698+ return this .options .getExecutorThreadPoolSize ();
699+ }
692700}
693701
Original file line number Diff line number Diff line change 66public class ManagerOptions {
77
88 /**
9- * No modifications to databases are allowed.
9+ * No modifications to databases are allowed.
1010 */
1111 private boolean readOnly = false ;
1212
1313 /**
14- * automatically migrate blobstore filename
14+ * automatically migrate blobstore filename
1515 */
1616 private boolean autoMigrateBlobStoreFilename = false ;
1717
18+ /**
19+ * the number of threads to keep in the pool for RemoteRequestExecutor
20+ * ReplicationInternal.java: public static final int EXECUTOR_THREAD_POOL_SIZE = 5;
21+ * https://github.com/couchbase/couchbase-lite-java-core/issues/343
22+ */
23+ private int executorThreadPoolSize = 0 ;
24+
1825 public ManagerOptions () {
1926 }
2027
@@ -33,4 +40,12 @@ public boolean isAutoMigrateBlobStoreFilename() {
3340 public void setAutoMigrateBlobStoreFilename (boolean autoMigrateBlobStoreFilename ) {
3441 this .autoMigrateBlobStoreFilename = autoMigrateBlobStoreFilename ;
3542 }
36- }
43+
44+ public int getExecutorThreadPoolSize () {
45+ return executorThreadPoolSize ;
46+ }
47+
48+ public void setExecutorThreadPoolSize (int executorThreadPoolSize ) {
49+ this .executorThreadPoolSize = executorThreadPoolSize ;
50+ }
51+ }
Original file line number Diff line number Diff line change @@ -320,7 +320,10 @@ protected void initNetworkReachabilityManager() {
320320
321321 protected void goOnlineInitialStartup () {
322322
323- remoteRequestExecutor = Executors .newScheduledThreadPool (EXECUTOR_THREAD_POOL_SIZE , new ThreadFactory () {
323+ int executorThreadPoolSize = db .getManager ().getExecutorThreadPoolSize () <= 0 ?
324+ EXECUTOR_THREAD_POOL_SIZE : db .getManager ().getExecutorThreadPoolSize ();
325+ Log .v (Log .TAG_SYNC , "executorThreadPoolSize=" + executorThreadPoolSize );
326+ remoteRequestExecutor = Executors .newScheduledThreadPool (executorThreadPoolSize , new ThreadFactory () {
324327 private int counter = 0 ;
325328 @ Override
326329 public Thread newThread (Runnable r ) {
You can’t perform that action at this time.
0 commit comments