Bug #2523
Updated by J. Wienke about 8 years ago
We tried to use in process communication and therefore disabled all other transports in the participantConfig.
This works as long as the participantConfig is not copied. After copying it seems like the informer tries to establish a spread connection.
The following code example with the resulting exception demonstrates this.
Code:
<pre>
ParticipantConfig @ParticipantConfig config = Factory.getInstance().getDefaultParticipantConfig(); Factory.getInstance().getDefaultParticipantConfig();@
config @config = config.copy(); config.copy();@
for @for (TransportConfig transport : config.getEnabledTransports()) {
transport.setEnabled(false); {@
} @ transport.setEnabled(false);@
config.getOrCreateTransport("inprocess").setEnabled(true); @}@
@config.getOrCreateTransport("inprocess").setEnabled(true);@
Informer<Object> @Informer<Object> informer = Factory.getInstance().createInformer("/test", config); config);@
informer.activate(); @informer.activate();@
informer.send("TestString");
</pre> @informer.send("TestString");@
Exception:
<pre>
Mar 16, 2016 4:33:10 PM rsb.transport.spread.SpreadWrapperImpl makeConnection
WARNING: reoccuring SpreadException during connect to daemon
spread.SpreadException: Socket(): java.net.ConnectException: Connection refused
at spread.SpreadConnection.connect(SpreadConnection.java:876)
at rsb.transport.spread.SpreadWrapperImpl.makeConnection(SpreadWrapperImpl.java:146)
at rsb.transport.spread.SpreadWrapperImpl.activate(SpreadWrapperImpl.java:261)
at rsb.transport.spread.SpreadReceiver$StateInactive.activate(SpreadReceiver.java:220)
at rsb.transport.spread.SpreadReceiver.activate(SpreadReceiver.java:342)
at rsb.transport.spread.SpreadInPushConnector.activate(SpreadInPushConnector.java:77)
at rsb.eventprocessing.RouteConfiguratorUtility.activate(RouteConfiguratorUtility.java:87)
at rsb.eventprocessing.DefaultPushInRouteConfigurator.activate(DefaultPushInRouteConfigurator.java:64)
at rsb.Listener$ListenerStateInactive.activate(Listener.java:118)
at rsb.Listener.activate(Listener.java:168)
at rsb.introspection.ProtocolHandler.activate(ProtocolHandler.java:387)
at rsb.introspection.IntrospectionParticipantObserver.created(IntrospectionParticipantObserver.java:89)
at rsb.Factory$ParticipantObserverManager.notifyParticipantCreated(Factory.java:104)
at rsb.Participant.activate(Participant.java:85)
at rsb.Informer.access$401(Informer.java:52)
at rsb.Informer$InformerStateInactive.activate(Informer.java:100)
at rsb.Informer.activate(Informer.java:217)
at org.dc.jul.extension.rsb.com.RSBCommunicationServiceTest.testInProcessCommunication(RSBCommunicationServiceTest.java:168)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:45)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
</pre>
This works as long as the participantConfig is not copied. After copying it seems like the informer tries to establish a spread connection.
The following code example with the resulting exception demonstrates this.
Code:
<pre>
ParticipantConfig @ParticipantConfig config = Factory.getInstance().getDefaultParticipantConfig(); Factory.getInstance().getDefaultParticipantConfig();@
config @config = config.copy(); config.copy();@
for @for (TransportConfig transport : config.getEnabledTransports()) {
transport.setEnabled(false); {@
} @ transport.setEnabled(false);@
config.getOrCreateTransport("inprocess").setEnabled(true); @}@
@config.getOrCreateTransport("inprocess").setEnabled(true);@
Informer<Object> @Informer<Object> informer = Factory.getInstance().createInformer("/test", config); config);@
informer.activate(); @informer.activate();@
informer.send("TestString");
</pre> @informer.send("TestString");@
Exception:
<pre>
Mar 16, 2016 4:33:10 PM rsb.transport.spread.SpreadWrapperImpl makeConnection
WARNING: reoccuring SpreadException during connect to daemon
spread.SpreadException: Socket(): java.net.ConnectException: Connection refused
at spread.SpreadConnection.connect(SpreadConnection.java:876)
at rsb.transport.spread.SpreadWrapperImpl.makeConnection(SpreadWrapperImpl.java:146)
at rsb.transport.spread.SpreadWrapperImpl.activate(SpreadWrapperImpl.java:261)
at rsb.transport.spread.SpreadReceiver$StateInactive.activate(SpreadReceiver.java:220)
at rsb.transport.spread.SpreadReceiver.activate(SpreadReceiver.java:342)
at rsb.transport.spread.SpreadInPushConnector.activate(SpreadInPushConnector.java:77)
at rsb.eventprocessing.RouteConfiguratorUtility.activate(RouteConfiguratorUtility.java:87)
at rsb.eventprocessing.DefaultPushInRouteConfigurator.activate(DefaultPushInRouteConfigurator.java:64)
at rsb.Listener$ListenerStateInactive.activate(Listener.java:118)
at rsb.Listener.activate(Listener.java:168)
at rsb.introspection.ProtocolHandler.activate(ProtocolHandler.java:387)
at rsb.introspection.IntrospectionParticipantObserver.created(IntrospectionParticipantObserver.java:89)
at rsb.Factory$ParticipantObserverManager.notifyParticipantCreated(Factory.java:104)
at rsb.Participant.activate(Participant.java:85)
at rsb.Informer.access$401(Informer.java:52)
at rsb.Informer$InformerStateInactive.activate(Informer.java:100)
at rsb.Informer.activate(Informer.java:217)
at org.dc.jul.extension.rsb.com.RSBCommunicationServiceTest.testInProcessCommunication(RSBCommunicationServiceTest.java:168)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:45)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
</pre>