@@ -23,7 +23,6 @@ public class SyncServerBuilder {
2323
2424 @ Nullable String certificatePath ;
2525 SyncChangeListener changesListener ;
26- boolean manualStart ;
2726
2827 public SyncServerBuilder (BoxStore boxStore , String url , SyncCredentials authenticatorCredentials ) {
2928 checkNotNull (boxStore , "BoxStore is required." );
@@ -52,17 +51,6 @@ public SyncServerBuilder authenticatorCredentials(SyncCredentials authenticatorC
5251 return this ;
5352 }
5453
55- /**
56- * Prevents the server from starting automatically.
57- * It will need to be started manually later.
58- *
59- * @see SyncServer#start()
60- */
61- public SyncServerBuilder manualStart () {
62- manualStart = true ;
63- return this ;
64- }
65-
6654 /**
6755 * Sets a listener to observe fine granular changes happening during sync.
6856 * This listener can also be set (or removed) on the sync client directly.
@@ -90,6 +78,8 @@ public SyncServerBuilder peer(String url, SyncCredentials credentials) {
9078 }
9179
9280 /**
81+ * Builds and returns a Sync server ready to {@link SyncServer#start()}.
82+ *
9383 * Note: this clears all previously set authenticator credentials.
9484 */
9585 public SyncServer build () {
@@ -99,6 +89,15 @@ public SyncServer build() {
9989 return new SyncServerImpl (this );
10090 }
10191
92+ /**
93+ * Builds, {@link SyncServer#start() starts} and returns a Sync server.
94+ */
95+ public SyncServer buildAndStart () {
96+ SyncServer syncServer = build ();
97+ syncServer .start ();
98+ return syncServer ;
99+ }
100+
102101 private void checkNotNull (Object object , String message ) {
103102 if (object == null ) {
104103 throw new IllegalArgumentException (message );
0 commit comments