File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/main/java/org/apposed/appose Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -131,8 +131,10 @@ public Service debug(Consumer<String> debugListener) {
131131 *
132132 * @param script The script code to execute during worker initialization.
133133 * @return This service object, for chaining method calls.
134+ * @throws IllegalStateException If the service has already started.
134135 */
135- public Service init (String script ) {
136+ public synchronized Service init (String script ) {
137+ if (process != null ) throw new IllegalStateException ("Service already started" );
136138 this .initScript = script ;
137139 return this ;
138140 }
@@ -143,7 +145,7 @@ public Service init(String script) {
143145 * @return This service object, for chaining method calls (typically with {@link #task}).
144146 * @throws IOException If the process fails to execute; see {@link ProcessBuilder#start()}.
145147 */
146- public Service start () throws IOException {
148+ public synchronized Service start () throws IOException {
147149 if (process != null ) {
148150 // Already started.
149151 return this ;
You can’t perform that action at this time.
0 commit comments