[jira] [Commented] (IGNITE-6743) Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer

2017-12-26 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16303867#comment-16303867
 ] 

ASF GitHub Bot commented on IGNITE-6743:


Github user andrey-kuznetsov closed the pull request at:

https://github.com/apache/ignite/pull/3206


> Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer
> 
>
> Key: IGNITE-6743
> URL: https://issues.apache.org/jira/browse/IGNITE-6743
> Project: Ignite
>  Issue Type: Task
>  Components: general
>Reporter: Vladimir Ozerov
>Assignee: Andrey Kuznetsov
> Fix For: 2.4
>
>
> When session is closed we clean allocated {{DirectByteBuffer}}-s using 
> {{sun.misc.Cleaner}}. Need to rework this piece to reflection-based approach 
> which will work for supported Java versions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (IGNITE-6743) Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer

2017-12-26 Thread Andrey Gura (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16303800#comment-16303800
 ] 

Andrey Gura commented on IGNITE-6743:
-

LGTM. Merged to master branch. Thanks for contribution!

> Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer
> 
>
> Key: IGNITE-6743
> URL: https://issues.apache.org/jira/browse/IGNITE-6743
> Project: Ignite
>  Issue Type: Task
>  Components: general
>Reporter: Vladimir Ozerov
>Assignee: Andrey Kuznetsov
> Fix For: 2.4
>
>
> When session is closed we clean allocated {{DirectByteBuffer}}-s using 
> {{sun.misc.Cleaner}}. Need to rework this piece to reflection-based approach 
> which will work for supported Java versions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (IGNITE-6743) Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer

2017-12-26 Thread Andrey Kuznetsov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16303730#comment-16303730
 ] 

Andrey Kuznetsov commented on IGNITE-6743:
--

[~agura], cleaner has moved to {{GridUnsafe}}.

> Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer
> 
>
> Key: IGNITE-6743
> URL: https://issues.apache.org/jira/browse/IGNITE-6743
> Project: Ignite
>  Issue Type: Task
>  Components: general
>Reporter: Vladimir Ozerov
>Assignee: Andrey Kuznetsov
> Fix For: 2.4
>
>
> When session is closed we clean allocated {{DirectByteBuffer}}-s using 
> {{sun.misc.Cleaner}}. Need to rework this piece to reflection-based approach 
> which will work for supported Java versions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (IGNITE-6743) Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer

2017-12-26 Thread Andrey Gura (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16303675#comment-16303675
 ] 

Andrey Gura commented on IGNITE-6743:
-

[~andrey-kuznetsov], could you please move buffer cleaner to {{GridUnsafe}} 
instead of {{IgniteUtils}}.

> Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer
> 
>
> Key: IGNITE-6743
> URL: https://issues.apache.org/jira/browse/IGNITE-6743
> Project: Ignite
>  Issue Type: Task
>  Components: general
>Reporter: Vladimir Ozerov
>Assignee: Andrey Kuznetsov
> Fix For: 2.4
>
>
> When session is closed we clean allocated {{DirectByteBuffer}}-s using 
> {{sun.misc.Cleaner}}. Need to rework this piece to reflection-based approach 
> which will work for supported Java versions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (IGNITE-6743) Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer

2017-12-25 Thread Andrey Kuznetsov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16303276#comment-16303276
 ] 

Andrey Kuznetsov commented on IGNITE-6743:
--

[~agura], I've added separate cleaner interface, please take a look.

> Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer
> 
>
> Key: IGNITE-6743
> URL: https://issues.apache.org/jira/browse/IGNITE-6743
> Project: Ignite
>  Issue Type: Task
>  Components: general
>Reporter: Vladimir Ozerov
>Assignee: Andrey Kuznetsov
> Fix For: 2.4
>
>
> When session is closed we clean allocated {{DirectByteBuffer}}-s using 
> {{sun.misc.Cleaner}}. Need to rework this piece to reflection-based approach 
> which will work for supported Java versions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (IGNITE-6743) Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer

2017-12-25 Thread Andrey Gura (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16303255#comment-16303255
 ] 

Andrey Gura commented on IGNITE-6743:
-

Guys, I like current implementation. Moreover, I think that it would be better 
to introduce interface and couple of cleaner implementations (for Java < 9 and 
Java 9+) instead of closure. It will just more supportable.

> Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer
> 
>
> Key: IGNITE-6743
> URL: https://issues.apache.org/jira/browse/IGNITE-6743
> Project: Ignite
>  Issue Type: Task
>  Components: general
>Reporter: Vladimir Ozerov
>Assignee: Andrey Kuznetsov
> Fix For: 2.4
>
>
> When session is closed we clean allocated {{DirectByteBuffer}}-s using 
> {{sun.misc.Cleaner}}. Need to rework this piece to reflection-based approach 
> which will work for supported Java versions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (IGNITE-6743) Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer

2017-12-22 Thread Andrey Kuznetsov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16301288#comment-16301288
 ] 

Andrey Kuznetsov commented on IGNITE-6743:
--

[~vozerov], do you offer to check Java version every time we need to clean a 
buffer?

> Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer
> 
>
> Key: IGNITE-6743
> URL: https://issues.apache.org/jira/browse/IGNITE-6743
> Project: Ignite
>  Issue Type: Task
>  Components: general
>Reporter: Vladimir Ozerov
>Assignee: Andrey Kuznetsov
> Fix For: 2.4
>
>
> When session is closed we clean allocated {{DirectByteBuffer}}-s using 
> {{sun.misc.Cleaner}}. Need to rework this piece to reflection-based approach 
> which will work for supported Java versions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (IGNITE-6743) Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer

2017-12-22 Thread Vladimir Ozerov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16301279#comment-16301279
 ] 

Vladimir Ozerov commented on IGNITE-6743:
-

[~andrey-kuznetsov], [~ezhuravl], I support Evgenii here that closures (and 
possible lambdas in Java 8 +) is overengineering. All we need is to get three 
fields/methods, and call them ocnditionally based on Java version. No need for 
any abstractions here, this is just small and simple utility method.

> Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer
> 
>
> Key: IGNITE-6743
> URL: https://issues.apache.org/jira/browse/IGNITE-6743
> Project: Ignite
>  Issue Type: Task
>  Components: general
>Reporter: Vladimir Ozerov
>Assignee: Andrey Kuznetsov
> Fix For: 2.4
>
>
> When session is closed we clean allocated {{DirectByteBuffer}}-s using 
> {{sun.misc.Cleaner}}. Need to rework this piece to reflection-based approach 
> which will work for supported Java versions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (IGNITE-6743) Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer

2017-12-21 Thread Andrey Kuznetsov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300410#comment-16300410
 ] 

Andrey Kuznetsov commented on IGNITE-6743:
--

[~ezhuravl], 'if' has been changed. As for turning Method vars into class 
fields, it's not useful change to me: currently, local vars are captured by 
cleaner closure, so they behave effectively in the same way as class members, 
but don't pollute class scope. Moreover, one of them is not needed for Java 9. 

> Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer
> 
>
> Key: IGNITE-6743
> URL: https://issues.apache.org/jira/browse/IGNITE-6743
> Project: Ignite
>  Issue Type: Task
>  Components: general
>Reporter: Vladimir Ozerov
>Assignee: Andrey Kuznetsov
> Fix For: 2.4
>
>
> When session is closed we clean allocated {{DirectByteBuffer}}-s using 
> {{sun.misc.Cleaner}}. Need to rework this piece to reflection-based approach 
> which will work for supported Java versions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (IGNITE-6743) Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer

2017-12-21 Thread Evgenii Zhuravlev (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300359#comment-16300359
 ] 

Evgenii Zhuravlev commented on IGNITE-6743:
---

[~andrey-kuznetsov], can we get rid of "!" in "if" block? I mean we can just 
swap these 2 blocks.

Also, I think we can save Methods to the class fields, what do you think?


> Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer
> 
>
> Key: IGNITE-6743
> URL: https://issues.apache.org/jira/browse/IGNITE-6743
> Project: Ignite
>  Issue Type: Task
>  Components: general
>Reporter: Vladimir Ozerov
>Assignee: Andrey Kuznetsov
> Fix For: 2.4
>
>
> When session is closed we clean allocated {{DirectByteBuffer}}-s using 
> {{sun.misc.Cleaner}}. Need to rework this piece to reflection-based approach 
> which will work for supported Java versions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (IGNITE-6743) Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer

2017-12-21 Thread Andrey Kuznetsov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300212#comment-16300212
 ] 

Andrey Kuznetsov commented on IGNITE-6743:
--

[~ezhuravl], thanks for your notes. I'll move the stuff to {{IgniteUtils}}. Can 
we complete curent discussion on Upsource?

> Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer
> 
>
> Key: IGNITE-6743
> URL: https://issues.apache.org/jira/browse/IGNITE-6743
> Project: Ignite
>  Issue Type: Task
>  Components: general
>Reporter: Vladimir Ozerov
>Assignee: Andrey Kuznetsov
> Fix For: 2.4
>
>
> When session is closed we clean allocated {{DirectByteBuffer}}-s using 
> {{sun.misc.Cleaner}}. Need to rework this piece to reflection-based approach 
> which will work for supported Java versions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (IGNITE-6743) Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer

2017-12-21 Thread Evgenii Zhuravlev (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300117#comment-16300117
 ] 

Evgenii Zhuravlev commented on IGNITE-6743:
---

[~andrey-kuznetsov], I've added my thoughts on upsource, also, I have one more 
suggestion: let's move almost all new code from GridUnsafe to IgniteUtils. We 
need Unsafe here only for invoking a method on it, so, let's just add something 
like the invokeMethod method for GridUnsafe and just use it from IgniteUtils.

> Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer
> 
>
> Key: IGNITE-6743
> URL: https://issues.apache.org/jira/browse/IGNITE-6743
> Project: Ignite
>  Issue Type: Task
>  Components: general
>Reporter: Vladimir Ozerov
>Assignee: Andrey Kuznetsov
> Fix For: 2.4
>
>
> When session is closed we clean allocated {{DirectByteBuffer}}-s using 
> {{sun.misc.Cleaner}}. Need to rework this piece to reflection-based approach 
> which will work for supported Java versions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (IGNITE-6743) Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer

2017-12-13 Thread Evgenii Zhuravlev (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16289445#comment-16289445
 ] 

Evgenii Zhuravlev commented on IGNITE-6743:
---

I think we need to analyze other fixes related to the java 9 and if they 
already introduced util class for java9, we can use it


> Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer
> 
>
> Key: IGNITE-6743
> URL: https://issues.apache.org/jira/browse/IGNITE-6743
> Project: Ignite
>  Issue Type: Task
>  Components: general
>Reporter: Vladimir Ozerov
>Assignee: Andrey Kuznetsov
> Fix For: 2.4
>
>
> When session is closed we clean allocated {{DirectByteBuffer}}-s using 
> {{sun.misc.Cleaner}}. Need to rework this piece to reflection-based approach 
> which will work for supported Java versions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (IGNITE-6743) Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer

2017-12-13 Thread Andrey Kuznetsov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16289425#comment-16289425
 ] 

Andrey Kuznetsov commented on IGNITE-6743:
--

[~ezhuravl], thanks for your note, I've really missed something. I think, we 
have two options here:
1. Create utility class right now.
2. For this very ticket, initialize reference to cleaning method in 
version-specific way at static initialization phase.
First one looks better but I still don't know how should that class look like.

> Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer
> 
>
> Key: IGNITE-6743
> URL: https://issues.apache.org/jira/browse/IGNITE-6743
> Project: Ignite
>  Issue Type: Task
>  Components: general
>Reporter: Vladimir Ozerov
>Assignee: Andrey Kuznetsov
> Fix For: 2.4
>
>
> When session is closed we clean allocated {{DirectByteBuffer}}-s using 
> {{sun.misc.Cleaner}}. Need to rework this piece to reflection-based approach 
> which will work for supported Java versions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (IGNITE-6743) Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer

2017-12-13 Thread Evgenii Zhuravlev (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16289379#comment-16289379
 ] 

Evgenii Zhuravlev commented on IGNITE-6743:
---

[~andrey-kuznetsov]

Java 9 doesn't have class "sun.misc.Cleaner", so this fix won't work. In java 9 
this class placed in package "jdk.internal.ref", so, if we will decide to use 
reflection here for both java 8&9 we will need to use different class names. 

At the same time, in java 9 were added Unsafe.invokeCleaner, which do what we 
need without any reflection. If we will decide to create some different Util 
class for java 9, I would suggest using this methond, since it will show better 
performance.

So, I would suggest waiting for other fixes related to java 9 support, if we 
will introduce new different Util classes for java 8 & java 9(in different 
modules) then it's better to use the method I've suggested.

What do you think here, guys?

> Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer
> 
>
> Key: IGNITE-6743
> URL: https://issues.apache.org/jira/browse/IGNITE-6743
> Project: Ignite
>  Issue Type: Task
>  Components: general
>Reporter: Vladimir Ozerov
>Assignee: Andrey Kuznetsov
> Fix For: 2.4
>
>
> When session is closed we clean allocated {{DirectByteBuffer}}-s using 
> {{sun.misc.Cleaner}}. Need to rework this piece to reflection-based approach 
> which will work for supported Java versions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (IGNITE-6743) Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer

2017-12-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16287577#comment-16287577
 ] 

ASF GitHub Bot commented on IGNITE-6743:


GitHub user andrey-kuznetsov opened a pull request:

https://github.com/apache/ignite/pull/3206

IGNITE-6743: Cleaning direct buffer through reflection.



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/andrey-kuznetsov/ignite ignite-6743

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/ignite/pull/3206.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #3206


commit b37392cbbdd3fd04d7e4640563a12af9e5a6f09d
Author: Andrey Kuznetsov 
Date:   2017-12-12T13:11:17Z

IGNITE-6743: Cleaning direct buffer through reflection.




> Java 9: rework DirectBuffer.cleaner().clean() usage in GridNioServer
> 
>
> Key: IGNITE-6743
> URL: https://issues.apache.org/jira/browse/IGNITE-6743
> Project: Ignite
>  Issue Type: Task
>  Components: general
>Reporter: Vladimir Ozerov
>Assignee: Andrey Kuznetsov
> Fix For: 2.4
>
>
> When session is closed we clean allocated {{DirectByteBuffer}}-s using 
> {{sun.misc.Cleaner}}. Need to rework this piece to reflection-based approach 
> which will work for supported Java versions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)