1. 程式人生 > 其它 >DC-1靶機教程

DC-1靶機教程

// 通過Runtime方法來獲取當前伺服器cpu核心,根據cpu核心來建立核心執行緒數和最大執行緒數
int threadCount  = Runtime.getRuntime().availableProcessors();

ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(threadCount, threadCount, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<>(5));
threadPoolExecutor.submit(new Runnable() {
	@Override
	public void run() {
		List<Store> list = storeModel.getStoreByAddressEmpty();
		if (CollUtil.isNotEmpty(list)) {
			for (Store store : list) {
				String addressInfo = store.getAddressInfo();
				if (ObjectUtil.isNotEmpty(addressInfo)) {
					StoreDto updateStore = new StoreDto();
					DistributorUserAddress address = getAddressByAddressInfo(addressInfo);
					updateStore.setProvinceId(address.getProvinceId());
					updateStore.setCityId(address.getCityId());
					updateStore.setAreaId(address.getAreaId());
					updateStore.setAddressAll(address.getAddAll());
					updateStore.setId(store.getId());
					storeModel.updateStore(updateStore);
				}
			}
		}
	}
});