< prev index next >

test/hotspot/jtreg/gc/logging/TestUnifiedLoggingSwitchStress.java

8217389: JTREG: Clean up, remove unused variable warnings

110                     if (arraySize != 0) {                                                                                  
111                         liveObjects.add(new byte[arraySize]);                                                              
112                         usedMemory += arraySize;                                                                           
113                     }                                                                                                      
114                 }                                                                                                          
115             },                                                                                                             
116 
117             // Simple deallocation                                                                                         
118             () -> {                                                                                                        
119                 if (liveObjects.size() != 0) {                                                                             
120                     int elementNum = RND.nextInt(liveObjects.size());                                                      
121                     int shouldFree = liveObjects.get(elementNum).length;                                                   
122                     liveObjects.remove(elementNum);                                                                        
123                     usedMemory -= shouldFree;                                                                              
124                 }                                                                                                          
125             },                                                                                                             
126 
127             // Dead object allocation                                                                                      
128             () -> {                                                                                                        
129                 int size = RND.nextInt(DEAD_OBJECT_MAX_SIZE);                                                              
                                                                                                                           
130                 byte[] deadObject = new byte[size];                                                                        
131             }                                                                                                              
132     };                                                                                                                     
133 
134     @Override                                                                                                              
135     public void run() {                                                                                                    
136         while (!shouldStop) {                                                                                              
137             actions[RND.nextInt(actions.length)].run();                                                                    
138             Thread.yield();                                                                                                
139         }                                                                                                                  
140 
141         System.out.println("Memory Stresser finished");                                                                    
142     }                                                                                                                      
143 }                                                                                                                          
144 
145 class LogLevelSwitcher implements Runnable {                                                                               
146 
147     public static volatile boolean shouldStop = false;                                                                     
148     private final int logCount; // how many various log files will be used                                                 

110                     if (arraySize != 0) {
111                         liveObjects.add(new byte[arraySize]);
112                         usedMemory += arraySize;
113                     }
114                 }
115             },
116 
117             // Simple deallocation
118             () -> {
119                 if (liveObjects.size() != 0) {
120                     int elementNum = RND.nextInt(liveObjects.size());
121                     int shouldFree = liveObjects.get(elementNum).length;
122                     liveObjects.remove(elementNum);
123                     usedMemory -= shouldFree;
124                 }
125             },
126 
127             // Dead object allocation
128             () -> {
129                 int size = RND.nextInt(DEAD_OBJECT_MAX_SIZE);
130                 @SuppressWarnings("unused")
131                 byte[] deadObject = new byte[size];
132             }
133     };
134 
135     @Override
136     public void run() {
137         while (!shouldStop) {
138             actions[RND.nextInt(actions.length)].run();
139             Thread.yield();
140         }
141 
142         System.out.println("Memory Stresser finished");
143     }
144 }
145 
146 class LogLevelSwitcher implements Runnable {
147 
148     public static volatile boolean shouldStop = false;
149     private final int logCount; // how many various log files will be used
< prev index next >