changeset 16048:99b7853cfbd8 jdk-9+145

8168500: (se) EPollArrayWrapper optimization for update events should be robust to dynamic changes in file descriptor resource limits Summary: Make eventsHigh final and always initialize it to an empty Map. Reviewed-by: alanb
author bpb
date Tue, 15 Nov 2016 08:40:36 -0800
parents a88e0ff30e44
children 892fde66a95e 1210d929d34e
files src/java.base/linux/classes/sun/nio/ch/EPollArrayWrapper.java
diffstat 1 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/linux/classes/sun/nio/ch/EPollArrayWrapper.java	Tue Nov 15 10:53:32 2016 -0400
+++ b/src/java.base/linux/classes/sun/nio/ch/EPollArrayWrapper.java	Tue Nov 15 08:40:36 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,7 +118,7 @@
     // file descriptors higher than MAX_UPDATE_ARRAY_SIZE (unlimited case at
     // least) then the update is stored in a map.
     private final byte[] eventsLow = new byte[MAX_UPDATE_ARRAY_SIZE];
-    private Map<Integer,Byte> eventsHigh;
+    private final Map<Integer,Byte> eventsHigh = new HashMap<>();
 
     // Used by release and updateRegistrations to track whether a file
     // descriptor is registered with epoll.
@@ -133,10 +133,6 @@
         int allocationSize = NUM_EPOLLEVENTS * SIZE_EPOLLEVENT;
         pollArray = new AllocatedNativeObject(allocationSize, true);
         pollArrayAddress = pollArray.address();
-
-        // eventHigh needed when using file descriptors > 64k
-        if (OPEN_MAX > MAX_UPDATE_ARRAY_SIZE)
-            eventsHigh = new HashMap<>();
     }
 
     void initInterrupt(int fd0, int fd1) {