Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nashorn engine is remove from Java 15. #14

Open
Sachin7Yadav opened this issue Feb 10, 2021 · 2 comments
Open

Nashorn engine is remove from Java 15. #14

Sachin7Yadav opened this issue Feb 10, 2021 · 2 comments

Comments

@Sachin7Yadav
Copy link

Nashorn engine is remove from Java 15. It is hard code in WorkflowModule class which will cause issues if someone will use this library with Java 15 or above.
bind(ScriptEngine.class).toInstance(new ScriptEngineManager().getEngineByName("nashorn"));

@carlosmejia85
Copy link

I had a similar case, I wanted to use this lib on Android and nashorn engine was not found.

I created a new class and call the rhino engine instead.

Take a look at this example, so you could create your own:

`
public class AndroidWorkflowModule extends WorkflowModule
{

@Override
protected void configure()
{
    bind(   WorkflowHost                .class).to( DefaultWorkflowHost             .class);
    bind(   WorkflowExecutor            .class).to( DefaultWorkflowExecutor         .class);
    bind(   WorkflowRegistry            .class).to( DefaultWorkflowRegistry         .class);
    bind(   ExecutionPointerFactory     .class).to( DefaultExecutionPointerFactory  .class);
    bind(   ExecutionResultProcessor    .class).to( DefaultExecutionResultProcessor .class);
    bind(   DefinitionLoader            .class).to( DefaultDefinitionLoader         .class);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) 
    {
        bind(Clock.class).toInstance(Clock.systemUTC());
    }

    ScriptEngine theManager = new ScriptEngineManager().getEngineByName ("rhino");

    bind(   ScriptEngine                .class  ).toInstance            (   theManager  );

    Multibinder<BackgroundService>  backgroundServiceBinder = Multibinder.newSetBinder(binder(), BackgroundService.class);
    Multibinder<StepErrorHandler>   errorHandlerBinder      = Multibinder.newSetBinder(binder(), StepErrorHandler.class );

    backgroundServiceBinder .addBinding().to    (    WorkflowWorker     .class  );
    backgroundServiceBinder .addBinding().to    (    EventWorker        .class  );
    backgroundServiceBinder .addBinding().to    (    PollThread         .class  );
    
    errorHandlerBinder      .addBinding().to    (   RetryHandler        .class  );
    errorHandlerBinder      .addBinding().to    (   CompensateHandler   .class  );
    errorHandlerBinder      .addBinding().to    (   SuspendHandler      .class  );
    errorHandlerBinder      .addBinding().to    (   TerminateHandler    .class  );

    bind(PersistenceService .class).toProvider  ( persistenceProvider   );
    bind(LockService        .class).toProvider  ( lockProvider          ).asEagerSingleton( );
    bind(QueueService       .class).toProvider  ( queueProvider         ).asEagerSingleton( );

}

}
`

@mbruckner
Copy link

mbruckner commented May 29, 2024

You can include it via maven:

        <dependency>
            <groupId>org.openjdk.nashorn</groupId>
            <artifactId>nashorn-core</artifactId>
            <version>15.4</version>
        </dependency>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants