@@ -31,18 +31,10 @@ def execute(agent, pipelines_registry)
31
31
return LogStash ::ConvergeResult ::FailedAction . new ( "Cannot reload pipeline, because the existing pipeline is not reloadable" )
32
32
end
33
33
34
+ java_exec = @pipeline_config . settings . get_value ( "pipeline.java_execution" )
35
+
34
36
begin
35
- pipeline_validator =
36
- if @pipeline_config . settings . get_value ( "pipeline.java_execution" )
37
- LogStash ::JavaBasePipeline . new ( @pipeline_config , nil , logger , nil )
38
- else
39
- agent . exclusive do
40
- # The Ruby pipeline initialization is not thread safe because of the module level
41
- # shared state in LogsStash::Config::AST. When using multiple pipelines this gets
42
- # executed simultaneously in different threads and we need to synchronize this initialization.
43
- LogStash ::BasePipeline . new ( @pipeline_config )
44
- end
45
- end
37
+ pipeline_validator = java_exec ? LogStash ::JavaBasePipeline . new ( @pipeline_config , nil , logger , nil ) : LogStash ::BasePipeline . new ( @pipeline_config )
46
38
rescue => e
47
39
return LogStash ::ConvergeResult ::FailedAction . from_exception ( e )
48
40
end
@@ -62,18 +54,7 @@ def execute(agent, pipelines_registry)
62
54
old_pipeline . thread . join
63
55
64
56
# Then create a new pipeline
65
- new_pipeline =
66
- if @pipeline_config . settings . get_value ( "pipeline.java_execution" )
67
- LogStash ::JavaPipeline . new ( @pipeline_config , @metric , agent )
68
- else
69
- agent . exclusive do
70
- # The Ruby pipeline initialization is not thread safe because of the module level
71
- # shared state in LogsStash::Config::AST. When using multiple pipelines this gets
72
- # executed simultaneously in different threads and we need to synchronize this initialization.
73
- LogStash ::Pipeline . new ( @pipeline_config , @metric , agent )
74
- end
75
- end
76
-
57
+ new_pipeline = java_exec ? LogStash ::JavaPipeline . new ( @pipeline_config , @metric , agent ) : LogStash ::Pipeline . new ( @pipeline_config , @metric , agent )
77
58
success = new_pipeline . start # block until the pipeline is correctly started or crashed
78
59
79
60
# return success and new_pipeline to registry reload_pipeline
0 commit comments