@@ -23,7 +23,6 @@ public class SyncServerBuilder {
23
23
24
24
@ Nullable String certificatePath ;
25
25
SyncChangeListener changesListener ;
26
- boolean manualStart ;
27
26
28
27
public SyncServerBuilder (BoxStore boxStore , String url , SyncCredentials authenticatorCredentials ) {
29
28
checkNotNull (boxStore , "BoxStore is required." );
@@ -52,17 +51,6 @@ public SyncServerBuilder authenticatorCredentials(SyncCredentials authenticatorC
52
51
return this ;
53
52
}
54
53
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
-
66
54
/**
67
55
* Sets a listener to observe fine granular changes happening during sync.
68
56
* This listener can also be set (or removed) on the sync client directly.
@@ -90,6 +78,8 @@ public SyncServerBuilder peer(String url, SyncCredentials credentials) {
90
78
}
91
79
92
80
/**
81
+ * Builds and returns a Sync server ready to {@link SyncServer#start()}.
82
+ *
93
83
* Note: this clears all previously set authenticator credentials.
94
84
*/
95
85
public SyncServer build () {
@@ -99,6 +89,15 @@ public SyncServer build() {
99
89
return new SyncServerImpl (this );
100
90
}
101
91
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
+
102
101
private void checkNotNull (Object object , String message ) {
103
102
if (object == null ) {
104
103
throw new IllegalArgumentException (message );
0 commit comments