forked from dragonwell-project/dragonwell17
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Port changes from Dragonwell8 and AJDK 8 Wisp Thread-based asynchronous IO implementation Wisp WispTask memory leak in shutdown - dragonwell-project/dragonwell8#211 Wisp ResourceContainerMXBean - dragonwell-project/dragonwell8#206 Wisp Fix WispEventPump epollWait IllegalArgumentException - dragonwell-project/dragonwell8#208 Wisp Shutdown Enhancement Test Plan: wisp rcm tests Reviewed-by: yulei Issue: dragonwell-project#142
- Loading branch information
Showing
50 changed files
with
1,078 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/java.base/share/classes/com/alibaba/rcm/ResourceContainerMonitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.alibaba.rcm; | ||
|
||
import com.alibaba.rcm.Constraint; | ||
import com.alibaba.rcm.ResourceContainer; | ||
import com.alibaba.rcm.ResourceType; | ||
import com.alibaba.rcm.internal.AbstractResourceContainer; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
import java.util.concurrent.atomic.AtomicLong; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.StreamSupport; | ||
|
||
public class ResourceContainerMonitor { | ||
private static Map<Long, ResourceContainer> tenantContainerMap = new ConcurrentHashMap<>(); | ||
private static AtomicLong idGen = new AtomicLong(0); | ||
|
||
public ResourceContainerMonitor() { | ||
} | ||
|
||
public static long register(ResourceContainer resourceContainer) { | ||
long id = idGen.getAndIncrement(); | ||
tenantContainerMap.put(id, resourceContainer); | ||
return id; | ||
} | ||
|
||
public static void deregister(long id) { | ||
tenantContainerMap.remove(id); | ||
} | ||
|
||
public static ResourceContainer getContainerById(long id) { | ||
return tenantContainerMap.get(id); | ||
} | ||
|
||
public static List<Long> getAllContainerIds() { | ||
return new ArrayList<>(tenantContainerMap.keySet()); | ||
} | ||
|
||
public static List<Constraint> getConstraintsById(long id) { | ||
AbstractResourceContainer resourceContainer = (AbstractResourceContainer) tenantContainerMap.get(id); | ||
return StreamSupport | ||
.stream(resourceContainer.getConstraints().spliterator(), false) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
public long getContainerConsumedAmount(long id) { | ||
return 0; | ||
} | ||
|
||
} |
Oops, something went wrong.