ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Magda (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (IGNITE-2909) Checking cache object type in runtime
Date Tue, 05 Apr 2016 04:37:25 GMT

     [ https://issues.apache.org/jira/browse/IGNITE-2909?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Denis Magda updated IGNITE-2909:
--------------------------------
    Description: 
In some cases there is necessity to control a type of object that is being
inserted into a cache.
Presently this kind of check is accomplished at compile time only relying
on Java Generics. However it doesn't prevent us from connecting to a
cluster using a non-generic instance of a cache and put any kind of data in
it. This may be not a harmful intention but rather a silly developer mistake.

The following solutions is proposed:
- if {{MutableConfiguration.setTypes(Class<K>keyType, Class<V> valueType)}} are
defined and not equal to Object.class then on every cache modification operation (put, invoke,
etc.) type of a key and value has to be checked before being inserted;
- to support BinaryObjects we should introduce an additional method {{CacheConfiguration.setTypeNams(String
keyType, String valueType)}} which will force checking of a key and value types the same way
as above.

Refer to the discussion on the dev list:
http://apache-ignite-developers.2346864.n4.nabble.com/Controlling-type-of-object-inserted-in-IgniteCache-td8128.html

  was:
In some cases there is necessity to control a type of object that is being
inserted into a cache.
Presently this kind of check is accomplished at compile time only relying
on Java Generics. However it doesn't prevent us from connecting to a
cluster using a non-generic instance of a cache and put any kind of data in
it. This may be not a harmful intention but rather a silly developer mistake.

The following solutions is proposed:
- if {{MutableConfiguration.setTypes(Class<K>
keyType, Class<V> valueType)}} are defined and not equal to Object.class then on every
cache modification operation (put, invoke, etc.) type of a key and value has to be checked
before being inserted;
- to support BinaryObjects we should introduce an additional method {{CacheConfiguration.setTypeNams(String
keyType, String valueType)}} which will force checking of a key and value types the same way
as above.

Refer to the discussion on the dev list:
http://apache-ignite-developers.2346864.n4.nabble.com/Controlling-type-of-object-inserted-in-IgniteCache-td8128.html


> Checking cache object type in runtime
> -------------------------------------
>
>                 Key: IGNITE-2909
>                 URL: https://issues.apache.org/jira/browse/IGNITE-2909
>             Project: Ignite
>          Issue Type: Improvement
>          Components: cache
>    Affects Versions: 1.5.0.final
>            Reporter: Denis Magda
>            Assignee: Vladislav Pyatkov
>            Priority: Critical
>              Labels: community, important
>             Fix For: 1.6
>
>
> In some cases there is necessity to control a type of object that is being
> inserted into a cache.
> Presently this kind of check is accomplished at compile time only relying
> on Java Generics. However it doesn't prevent us from connecting to a
> cluster using a non-generic instance of a cache and put any kind of data in
> it. This may be not a harmful intention but rather a silly developer mistake.
> The following solutions is proposed:
> - if {{MutableConfiguration.setTypes(Class<K>keyType, Class<V> valueType)}}
are defined and not equal to Object.class then on every cache modification operation (put,
invoke, etc.) type of a key and value has to be checked before being inserted;
> - to support BinaryObjects we should introduce an additional method {{CacheConfiguration.setTypeNams(String
keyType, String valueType)}} which will force checking of a key and value types the same way
as above.
> Refer to the discussion on the dev list:
> http://apache-ignite-developers.2346864.n4.nabble.com/Controlling-type-of-object-inserted-in-IgniteCache-td8128.html



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message