基于队列的线程池
java.text.SimpleDateFormat; java.util.Date; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class TestThreadPool{ //publicstaticBlockingQueue<Runnable>queue=newArrayBlockingQueue<Runnable>(10); public static ArrayBlockingQueue<Runnable>queue= new ArrayBlockingQueue<Runnable>( 10 ); public void main(String[]args){ for ( int i= 0 ;i< 3 ;i++){ queue.add( new TestThread( "初始化" )); final ThreadPoolExecutorexecutor= new ThreadPoolExecutor( 2 , 3 , 15 ,TimeUnit.SECONDS,queue); System.out.println( "getActiveCount=" +executor.getActiveCount() + ";getKeepAliveTime=" +executor.getKeepAliveTime(TimeUnit.SECONDS) + ";getCompletedTaskCount=" +executor.getCompletedTaskCount() + ";getCorePoolSize=" +executor.getCorePoolSize() + ";getLargestPoolSize=" +executor.getLargestPoolSize() + ";getMaximumPoolSize=" +executor.getMaximumPoolSize() + ";getPoolSize=" +executor.getPoolSize() + ";getTaskCount=" +executor.getTaskCount() + ";getQueue().size()=" +executor.getQueue().size() executor.execute(queue.poll()); System.out.println( "getActiveCount=" +executor.getActiveCount() + ";getKeepAliveTime=" +executor.getKeepAliveTime(TimeUnit.SECONDS) + ";getCompletedTaskCount=" +executor.getCompletedTaskCount() + ";getCorePoolSize=" +executor.getCorePoolSize() + ";getLargestPoolSize=" +executor.getLargestPoolSize() + ";getMaximumPoolSize=" +executor.getMaximumPoolSize() + ";getPoolSize=" +executor.getPoolSize() + ";getTaskCount=" +executor.getTaskCount() + ";getQueue().size()=" +executor.getQueue().size() new Thread( new Runnable(){ public void run(){ System.out.println( "getActiveCount=" +executor.getActiveCount() + ";getKeepAliveTime=" +executor.getKeepAliveTime(TimeUnit.SECONDS) + ";getCompletedTaskCount=" +executor.getCompletedTaskCount() + ";getCorePoolSize=" +executor.getCorePoolSize() + ";getLargestPoolSize=" +executor.getLargestPoolSize() + ";getMaximumPoolSize=" +executor.getMaximumPoolSize() + ";getPoolSize=" +executor.getPoolSize() + ";getTaskCount=" +executor.getTaskCount() + ";getQueue().size()=" +executor.getQueue().size() Thread.currentThread().sleep(1000L); } catch (InterruptedExceptione){ new Thread( new Runnable(){ public void run(){ queue.add( new TestThread( "生产者" )); Thread.currentThread().sleep(500L); } catch (InterruptedExceptione){ class TestThread implements Runnable{ public static SimpleDateFormatsdf= new SimpleDateFormat( <戴尔Force10 Z9000交换机常用命令 阅读原文»
用户名:sin20402 文章数:3 评论数:4 一、注意点一 Z9000和4810类似,都需要在做任何操作前敲上reload-type normal-reload,防止操作不生效。 二、Z9000将40G接口分割成4x10G接口 命令:Stack-unit 0 port X portmode quad 【x表示哪个接口】 (一)Qsfp是40g口,sfp+就是10g,sfp就是千兆也就是1g口。 (二)接口分割后需要重启才会生效,需要恢复40G接口直接删掉这条命令重启即可 三、VLT(类似于cisco的vss) (一)做VLT的前提条件 1、所有单元都需要相同的FTOS 版本 (二)VLT只支持交换机使用RSTP (三)参数功能(某些可自动协商): (四)指peer互联channel,协商VLT
(五)提供备份链路,做健康检查
vlt配置实例 两台Z9000构成一个VLT域,Forty 0/120做为VLT备份链路,Forty 0/124绑成channel互指VLT Peer-Link形成VLTi关系。
检查vlt和排错 检查VLT参数和Peer, Link状态
订阅:
博文评论 (Atom)
|
没有评论:
发表评论