Lingo
  1. Lingo
  2. LINGO-41

async configuration breaks when upgrading from lingo 1.1

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      I upgraded from Lingo 1.1 to Lingo 1.3 and ran into the same issue where async calls that were previously working are no longer asynchronous. I ran it though a debugger and found the cause.

      Previously Lingo async was configured as follows :

      <bean id="invocationFactory" class="org.logicblaze.lingo.LingoRemoteInvocationFactory">
      <constructor-arg>
      <bean class="org.logicblaze.lingo.SimpleMetadataStrategy">
      <!-- enable async one ways -->
      <constructor-arg value="true"/>
      </bean>
      </constructor-arg>
      </bean>

      <bean id="optimizerService" class="org.logicblaze.lingo.jms.JmsProxyFactoryBean">
      ...
      <!-- lets enable async one ways on the client -->
      <property name="remoteInvocationFactory" ref="invocationFactory"/>
      </bean>

      Between versions 65 and 65 of the class JmsClientinterceptor (http://fisheye.codehaus.org/browse/lingo/trunk/lingo/src/main/java/org/logicblaze/lingo/jms/JmsClientInterceptor.java ), the member

      MetadataStrategy metadataStrategy;

      was added directly to JmsClientinterceptor which in turn was overriding the LingoRemoteInvocationFactory's previous metadataStrategy member in its afterPropertiesSet() method.

      public void afterPropertiesSet() throws JMSException {
      RemoteInvocationFactory factory = getRemoteInvocationFactory();
      ....
      else

      { LingoRemoteInvocationFactory invocationFactory = (LingoRemoteInvocationFactory) factory; invocationFactory.setMetadataStrategy(getMetadataStrategy()); }

      }

      public MetadataStrategy getMetadataStrategy() {
      if (metadataStrategy == null)

      { metadataStrategy = createMetadataStrategy(); }

      return metadataStrategy;
      }

      So while the new way of specifying async calls by setting the metadataStrategy directly on JmsProxyFactoryBean (see below) works, it breaks backward compatibility with previous configurations where metadataStrategy was set on the invocationFactory . For now just set the metadataStrategy directly on JmsProxyFactoryBean.

      James, I think the fix that preserves existing behavior while maintaining backward compatibilty just involves adding a check to test if the invocationFactory's metadataStrategy is null before calling setMetadataStrategy in JmsClientInterceptor#afterPropertiesSet().

      LingoRemoteInvocationFactory invocationFactory = (LingoRemoteInvocationFactory) factory;
      >> if(invocationFactory.getMetadataStrategy() == null)
      invocationFactory.setMetadataStrategy(getMetadataStrategy());

      =======================================================

      working async config :

      <bean id="client" class="org.logicblaze.lingo.jms.JmsProxyFactoryBean"
      >
      <property name="serviceInterface" value="org.logicblaze.lingo.example.ExampleService"/>
      <property name="connectionFactory" ref="jmsFactory"/>
      <property name="destination" ref="exampleDestination"/>

      <!-- lets enable async one ways on the client -->
      <property name="metadataStrategy" ref="metadataStrategy"/>
      </bean>

      <!-- define the metadata strategy -->
      <bean id="metadataStrategy" class="org.logicblaze.lingo.SimpleMetadataStrategy">
      <!-- enable async one ways -->
      <constructor-arg value="true"/>
      </bean>

        Activity

        No changes have yet been made on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Sanjiv Jivan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: