Created
May 2, 2018 06:46
-
-
Save tbml/5c11317fb06a7cfc0617b203fcf75cf5 to your computer and use it in GitHub Desktop.
Possible corrupted composite method invocation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CompositeMethodInvocationTest extends AbstractPolygeneTest { | |
@Service | |
MyService srv; | |
/** | |
* To correct, change instance pool type in CompositeMethodModel | |
* AtomicInstancePool -> SynchronizedCompositeMethodInstancePool | |
*/ | |
@Test | |
public void corruptedMethodInvocation() throws InterruptedException { | |
srv.dummy(); // to avoid concurrent activation (it can have own issues) | |
ExecutorService exe = Executors.newFixedThreadPool(10); | |
for (int i = 0; i < 10; i++) { | |
exe.execute(() -> { | |
while (true) { | |
srv.dummy(); | |
} | |
}); | |
} | |
exe.awaitTermination(10, TimeUnit.MINUTES); | |
} | |
@Override | |
public void assemble(ModuleAssembly module) throws AssemblyException { | |
module.services(MyService.class); | |
} | |
@Mixins(Impl.class) | |
public interface MyService extends ServiceComposite { | |
void dummy(); | |
} | |
public abstract static class Impl implements MyService { | |
@Override | |
public void dummy() { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment