Spring Cloud Alibaba 大型互联网领域多场景最佳实践

download:Spring Cloud Alibaba 大型互联网领域多场景最佳实践

 

聚焦Spring Cloud Alibaba,深入剖析5大核心组件原理,并结合真实电商微服务架构,讲透框架在多场景下的最佳实践,助力全面提升微服务实战能力,轻松应对微服务领域的各种技术难题。



技术适合人群要求
熟悉java web开发、会使用maven 和spring框架
对于springboot 有一定的了解
技术储备要求
Jdk 1.8、Spring Cloud Hoxton.SR8、Spring Cloud Hoxton.SR8、Springcloud Hoxton.SR8 
SpringCloudAlibaba 2.2.5 RELEASE、Nacos 1.4.1、Sentinel 1.8.0    
public class SystemInfoUtils {      public static int getRunningAppProcesses(Context context) {// 得到当前系统内运行的app进程数量          ActivityManager am = (ActivityManager) context                  .getSystemService(Context.ACTIVITY_SERVICE);          List<RunningAppProcessInfo> appInfos = am.getRunningAppProcesses();          return appInfos.size();               public static List<HashMap<String, Object>> getAppInfo(Context context) {// 得到非系统应用的app信息          List<HashMap<String, Object>> appInfos = new ArrayList<HashMap<String, Object>>();          HashMap<String, Object> map = null         List<PackageInfo> packages = context.getPackageManager()                  .getInstalledPackages(0);// 参数传入0表示过滤权限,因为可能有的手机不让你获取应用信息          for (PackageInfo temp : packages) {              if ((temp.applicationInfo.flags & temp.applicationInfo.FLAG_SYSTEM) == 0) {                  // 非系统应用                  // 得到应用的名称                  String appName = temp.applicationInfo.loadLabel(                          context.getPackageManager()).toString();                  // 得到应用图标                  Drawable appIcon = temp.applicationInfo.loadIcon(context                          .getPackageManager());                  // 得到应用最后一次更新的时间                  long lastUpdateTime = temp.lastUpdateTime;                  // 得到应用的包名                  String packageName = temp.packageName;                  // 得到应用的版本信息                  String versionName = temp.versionName;                  map = new HashMap<String, Object>();                  map.put("appName", appName);                  map.put("appIcon", appIcon);                  map.put("lastUpdateTime", lastUpdateTime);                  map.put("packageName", packageName);                  map.put("versionName", versionName);                  appInfos.add(map);// 把应用信息加入集合中返回                  map = null             } else                 // 系统应用                                return appInfos;               // 获取sd卡容量      public static String getSdSize(Context context) {          String totalStr = null, availStr = null         if (Environment.getExternalStorageState().equals(                  Environment.MEDIA_MOUNTED)) {// 判断是否检测到sd卡              File path = Environment.getExternalStorageDirectory();              StatFs stat = new StatFs(path.getPath());                  long blockSize = stat.getBlockSizeLong();              long availableBlocks = stat.getAvailableBlocksLong();              long totalBlocks = stat.getBlockCountLong();                  long totalSize = blockSize * totalBlocks;              long availSize = blockSize * availableBlocks;                  totalStr = Formatter.formatFileSize(context, totalSize);              availStr = Formatter.formatFileSize(context, availSize);              } else              Toast.makeText(context, "没有检测到SD卡,请检查是否正确插入", Toast.LENGTH_SHORT)                      .show();          return "SD卡总容量为:" + totalStr + "可用为:" + availStr;               // 获取手机内存      public static String getRomSave(Context context) {          String totalStr = null, availStr = null         File path = Environment.getDataDirectory();          StatFs stat = new StatFs(path.getPath());// 得到手机内存的路径              long blockSize = stat.getBlockSizeLong();          long availableBlocks = stat.getAvailableBlocksLong();          long totalBlocks = stat.getBlockCountLong();              long totalSize = blockSize * totalBlocks;          long availSize = blockSize * availableBlocks;              totalStr = Formatter.formatFileSize(context, totalSize);          availStr = Formatter.formatFileSize(context, availSize);                      return "手机内存总大小为:" + totalStr + "可用空间为:" + availStr;       }
上一篇:C/C++ 编程规范— 01 排版


下一篇:mysql5.7安装步骤演示