Forum Stats

  • 3,853,853 Users
  • 2,264,287 Discussions
  • 7,905,483 Comments

Discussions

Custom initialization parameters for Write-Behind caching

Viktar C
Viktar C Member Posts: 31
edited Nov 17, 2017 5:17PM in Coherence Support

Hi Coherence Experts,

I'd like to pass some parameters to my custom implementation of the read write backing map.

So, I was trying to specify the following in my coherence-config.xml:

        <distributed-scheme>            <scheme-name>my-cache</scheme-name>            <service-name>DistributedCache</service-name>            <backing-map-scheme>                <read-write-backing-map-scheme>                    <class-name>com.test.MyReadWriteBackingMap</class-name>                    <init-params>                        <init-param>                            <param-name>max-ttl</param-name>                            <param-value>10</param-value>                        </init-param>                    </init-params>                    <internal-cache-scheme>                        <local-scheme>                            <expiry-delay>2m</expiry-delay>                        </local-scheme>                    </internal-cache-scheme>                </read-write-backing-map-scheme>            </backing-map-scheme>            <autostart>true</autostart>        </distributed-scheme>


Per documentation this parameter could be used in my custom MyReadWriteBackingMap:

Specifies initialization parameters, for use in custom read write backing map implementations.

However, I have no idea how to get this value in my class. Was trying something like the following, but it's not working for me:

    private Integer maxTtlInMin;    @Injectable("max-ttl")    public void setMaxTtl(Integer maxTtlInMin) {        this.maxTtlInMin = maxTtlInMin;    }

Could anybody please advise how I can use these values in my custom implementation of the read write backing map?

Oracle Coherence Version 12.2.1.2.0 Build 65221.

Tagged:

Best Answer

Answers

  • Shyam Radhakrishnan-Oracle
    Shyam Radhakrishnan-Oracle Member Posts: 80
    edited Oct 30, 2017 2:44AM

    Can you explain what you are trying to do? Does the class extend com.test.MyReadWriteBackingMap A Coherence class or is it your own implementation? If you are using the above, extending com.tangosol.net.cache.ReadWriteBackingMap, you need to define all the constructors defined there in. If you want your own cache implementation, you could use the following, and create a constructor which had the int paramater.

    <distributed-scheme>   <scheme-name>my-cache</scheme-name>   <service-name>DistributedCache</service-name>   <backing-map-scheme>   <class-scheme>   <class-name>cache.MyReadWriteBackingMap</class-name>   <init-params>   <init-param>   <param-type>int</param-type>   <param-value>10</param-value>   </init-param>   </init-params>   </class-scheme>   </backing-map-scheme>   <autostart>true</autostart></distributed-scheme>
  • Viktar C
    Viktar C Member Posts: 31
    edited Oct 30, 2017 11:55AM

    Thank you, Shyam, for replying!

    Right, I'm extending the com.tangosol.net.cache.ReadWriteBackingMap trying to have my custom parameters specified in the read-write-backing-map-scheme xml configuration and have them used in the custom implementation, which is com.test.MyReadWriteBackingMap.

    And still have no solution for that.

  • Viktar C
    Viktar C Member Posts: 31
    edited Nov 17, 2017 5:17PM Answer ✓

    I got the following response from the Oracle support team - the documentation is outdated and there is no way to parameterize a ReadWriteBackingMap's custom implementation.

This discussion has been closed.