You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by ji...@apache.org on 2022/05/16 03:38:51 UTC
[rocketmq] branch develop updated: [ISSUE #4320] Anonymous new PrivilegedAction can be replaced with lambda
This is an automated email from the ASF dual-hosted git repository.
jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push:
new 7982c9c09 [ISSUE #4320] Anonymous new PrivilegedAction can be replaced with lambda
7982c9c09 is described below
commit 7982c9c09a9da754f42d0cf46dd5ddaa9d2c7be1
Author: hzh0425 <64...@qq.com>
AuthorDate: Mon May 16 11:38:38 2022 +0800
[ISSUE #4320] Anonymous new PrivilegedAction can be replaced with lambda
---
.../main/java/org/apache/rocketmq/store/MappedFile.java | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/store/src/main/java/org/apache/rocketmq/store/MappedFile.java b/store/src/main/java/org/apache/rocketmq/store/MappedFile.java
index eb59fbb7c..b1fcbf20b 100644
--- a/store/src/main/java/org/apache/rocketmq/store/MappedFile.java
+++ b/store/src/main/java/org/apache/rocketmq/store/MappedFile.java
@@ -107,15 +107,13 @@ public class MappedFile extends ReferenceResource {
}
private static Object invoke(final Object target, final String methodName, final Class<?>... args) {
- return AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- try {
- Method method = method(target, methodName, args);
- method.setAccessible(true);
- return method.invoke(target);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
+ return AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
+ try {
+ Method method = method(target, methodName, args);
+ method.setAccessible(true);
+ return method.invoke(target);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
}
});
}