Skip to content

Commit

Permalink
Don't cache Java executors (#1465)
Browse files Browse the repository at this point in the history
Presently, the Java language host caches a single executor, which
abstracts e.g. the command-line executions needed to run Java code. This
is problematic should a single language runtime ever be fielded with
concurrent requests for program execution. This commit removes this
caching for now to fix this.
  • Loading branch information
lunaris authored Nov 18, 2024
1 parent 1663ca5 commit 1b7a4cc
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions pkg/cmd/pulumi-language-java/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,9 @@ func setupHealthChecks(engineAddress string) (chan bool, error) {
type javaLanguageHost struct {
pulumirpc.UnimplementedLanguageRuntimeServer

currentExecutor *executors.JavaExecutor
execOptions executors.JavaExecutorOptions
engineAddress string
tracing string
execOptions executors.JavaExecutorOptions
engineAddress string
tracing string
}

func newLanguageHost(execOptions executors.JavaExecutorOptions,
Expand All @@ -143,14 +142,11 @@ func newLanguageHost(execOptions executors.JavaExecutorOptions,
}

func (host *javaLanguageHost) Executor(attachDebugger bool) (*executors.JavaExecutor, error) {
if host.currentExecutor == nil || attachDebugger {
executor, err := executors.NewJavaExecutor(host.execOptions, attachDebugger)
if err != nil {
return nil, err
}
host.currentExecutor = executor
executor, err := executors.NewJavaExecutor(host.execOptions, attachDebugger)
if err != nil {
return nil, err
}
return host.currentExecutor, nil
return executor, nil
}

// GetRequiredPlugins computes the complete set of anticipated plugins required by a program.
Expand Down

0 comments on commit 1b7a4cc

Please sign in to comment.