http://qs321.pair.com?node_id=11135355


in reply to Re^2: Inline::Java with MCE::Hobo
in thread Inline::Java with MCE::Hobo

Greetings eraskin,

Have you tried importing SexCoder inside the input_task Hobo routine. This is where to load the class uniquely per worker child.

sub input_task { require SexCoder; SexCoder->import(); # THIS CALLS JAVA TO CREATE THE CONNECTION TO DATA SERVICES my $sexcoder = SexCoder->new("$ds_server", 4000); ... }

Replies are listed 'Best First'.
Re^4: Inline::Java with MCE::Hobo
by Anonymous Monk on Jul 24, 2021 at 05:38 UTC

    Kind reminder: Remember to comment out SexCoder at the top of the script to ensure the class is loaded by each Hobo worker individually.

    my $num_workers = 5; # use SexCoder; use MCE::Hobo; use MCE::Shared; ...