本文整理汇总了Java中javax.management.modelmbean.ModelMBeanOperationInfo.ACTION属性的典型用法代码示例。如果您正苦于以下问题:Java ModelMBeanOperationInfo.ACTION属性的具体用法?Java ModelMBeanOperationInfo.ACTION怎么用?Java ModelMBeanOperationInfo.ACTION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.management.modelmbean.ModelMBeanOperationInfo
的用法示例。
在下文中一共展示了ModelMBeanOperationInfo.ACTION属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tps
@RemoteMethod(description = "Get current server tps", impact = ModelMBeanOperationInfo.ACTION)
public double tps()
{
try
{
double result = 0;
double[] recentTps = (double[]) recentTpsField.get(getServerMethod.invoke(null));
for(double one : recentTps)
result += one;
return result / recentTps.length;
}
catch (IllegalAccessException | InvocationTargetException e)
{
e.printStackTrace();
}
return 0;
}
示例2: getMBeanInfo
@Override
public MBeanInfo getMBeanInfo() {
try {
ModelMBeanAttributeInfo[] attributes = new ModelMBeanAttributeInfo[0];
ModelMBeanConstructorInfo[] constructors = new ModelMBeanConstructorInfo[] {
new ModelMBeanConstructorInfo("-", this.getClass().getConstructor())
};
ModelMBeanOperationInfo[] operations = new ModelMBeanOperationInfo[] {
new ModelMBeanOperationInfo("info", "-", new MBeanParameterInfo[0], Void.class.getName(), ModelMBeanOperationInfo.INFO),
new ModelMBeanOperationInfo("action", "-", new MBeanParameterInfo[0], Void.class.getName(), ModelMBeanOperationInfo.ACTION),
new ModelMBeanOperationInfo("actionInfo", "-", new MBeanParameterInfo[0], Void.class.getName(), ModelMBeanOperationInfo.ACTION_INFO),
new ModelMBeanOperationInfo("unknown", "-", new MBeanParameterInfo[0], Void.class.getName(), ModelMBeanOperationInfo.UNKNOWN)
};
ModelMBeanNotificationInfo[] notifications = new ModelMBeanNotificationInfo[0];
return new ModelMBeanInfoSupport(this.getClass().getName(), "-", attributes, constructors, operations, notifications);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例3: addPlayer
@RemoteMethod(description = "Add a player to the whitelist", impact = ModelMBeanOperationInfo.ACTION)
public void addPlayer(UUID player)
{
Bukkit.getWhitelistedPlayers().add(Bukkit.getOfflinePlayer(player));
Bukkit.reloadWhitelist();
Bukkit.getLogger().info("Added player " + player + " to whitelist");
}
示例4: removePlayer
@RemoteMethod(description = "Remove a player to the whitelist", impact = ModelMBeanOperationInfo.ACTION)
public void removePlayer(UUID player)
{
Bukkit.getWhitelistedPlayers().add(Bukkit.getOfflinePlayer(player));
Bukkit.reloadWhitelist();
Bukkit.getLogger().info("Added player " + player + " to whitelist");
}
示例5: getWhiteList
@RemoteMethod(description = "Get the whitelist", impact = ModelMBeanOperationInfo.ACTION)
public ArrayList<UUID> getWhiteList()
{
return Bukkit.getWhitelistedPlayers().stream().map(OfflinePlayer::getUniqueId).collect(Collectors.toCollection(ArrayList::new));
}
示例6: setWhiteListActived
@RemoteMethod(description = "Set if the whitelist is actived", impact = ModelMBeanOperationInfo.ACTION)
public void setWhiteListActived(boolean actived)
{
Bukkit.setWhitelist(actived);
}
示例7: stop
@RemoteMethod(description = "Shutdown a server", impact = ModelMBeanOperationInfo.ACTION)
public void stop()
{
Bukkit.getServer().shutdown();
}