Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-2449

5.1.x and 5.2.x API differences

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 5.2.0.Final
    • 5.2.0.Final
    • Configuration
    • None
    • Workaround Exists
    • Hide

      Convert to the 5.2.x code style (preventing compatibility with 5.1.x), or avoid using the fluent style. (See description for detail.)

      Show
      Convert to the 5.2.x code style (preventing compatibility with 5.1.x), or avoid using the fluent style. (See description for detail.)

      Programmatically configuring a cache store in 5.1.x makes use of the LoaderConfigurationBuilder:

      LoaderConfigurationBuilder lb = configurationBuilder.loaders().addCacheLoader().cacheLoader(new JdbcBinaryCacheStore());
      lb.addProperty("dropTableOnExit", "false")
        .addProperty("createTableOnStart", "true")
        .addProperty("connectionFactoryClass", "org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory")
        .addProperty("connectionUrl", "jdbc:h2:file:/abs/path/string_based_db;DB_CLOSE_DELAY=1")
        .addProperty("driverClass", "org.h2.Driver")
        .addProperty("userName", "sa")
        .addProperty("idColumnName", "ID_COLUMN")
        .addProperty("idColumnType", "VARCHAR(255)")
        .addProperty("timestampColumnName", "TIMESTAMP_COLUMN")
        .addProperty("timestampColumnType", "BIGINT")
        .addProperty("dataColumnName", "DATA_COLUMN")
        .addProperty("dataColumnType", "BINARY")
        .addProperty("bucketTableNamePrefix", "MODE")
        .addProperty("cacheName", "default");
      

      This code does not compile with 5.2.0.Beta2 because LoaderConfigurationBuilder now is parameterized by the type of LoaderConfiguration and builder, and the return type of addProperty(...) is LoaderConfigurationBuilder<T,S>. When the above 5.1.x-compatible code is used (as a raw type), the return type of addProperty(...) becomes Object and this breaks the fluent-API style code above.

      For code that needs to compile against 5.1.x and 5.2.x, the workaround is to change the above code to remove the fluent-API usage:

      LoaderConfigurationBuilder lb = configurationBuilder.loaders().addCacheLoader().cacheLoader(new JdbcBinaryCacheStore());
      lb.addProperty("dropTableOnExit", "false");
      lb.addProperty("createTableOnStart", "true");
      lb.addProperty("connectionFactoryClass", "org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory");
      lb.addProperty("connectionUrl", "jdbc:h2:file:/abs/path/string_based_db;DB_CLOSE_DELAY=1");
      lb.addProperty("driverClass", "org.h2.Driver");
      lb.addProperty("userName", "sa");
      lb.addProperty("idColumnName", "ID_COLUMN");
      lb.addProperty("idColumnType", "VARCHAR(255)");
      lb.addProperty("timestampColumnName", "TIMESTAMP_COLUMN");
      lb.addProperty("timestampColumnType", "BIGINT");
      lb.addProperty("dataColumnName", "DATA_COLUMN");
      lb.addProperty("dataColumnType", "BINARY");
      lb.addProperty("bucketTableNamePrefix", "MODE");
      lb.addProperty("cacheName", "default");
      

              ttarrant@redhat.com Tristan Tarrant
              rhauch Randall Hauch (Inactive)
              Archiver:
              rhn-support-adongare Amol Dongare

                Created:
                Updated:
                Resolved:
                Archived: