2014年8月20日星期三

基于队列的线程池

本邮件内容由第三方提供,如果您不想继续收到该邮件,可 点此退订
基于队列的线程池  阅读原文»

基于队列的线程池

基于队列的线程池

java.text.SimpleDateFormat;
java.util.Date;
importjava.util.concurrent.ArrayBlockingQueue;
importjava.util.concurrent.ThreadPoolExecutor;
importjava.util.concurrent.TimeUnit;
publicclassTestThreadPool{
//publicstaticBlockingQueue<Runnable>queue=newArrayBlockingQueue<Runnable>(10);
publicstaticArrayBlockingQueue<Runnable>queue=newArrayBlockingQueue<Runnable>(10);
publicvoidmain(String[]args){
for(inti=0;i<3;i++){
queue.add(newTestThread("初始化"));
finalThreadPoolExecutorexecutor=newThreadPoolExecutor(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()
newThread(newRunnable(){
publicvoidrun(){
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){
newThread(newRunnable(){
publicvoidrun(){
queue.add(newTestThread("生产者"));
Thread.currentThread().sleep(500L);
}catch(InterruptedExceptione){
classTestThreadimplementsRunnable{
publicstaticSimpleDateFormatsdf=newSimpleDateFormat(<
戴尔Force10 Z9000交换机常用命令  阅读原文»

用户名:sin20402 文章数:3 评论数:4
访问量:92:98:64:1 注册日期:2012-04-04

一、注意点一

Z9000和4810类似,都需要在做任何操作前敲上reload-type normal-reload,防止操作不生效。

二、Z9000将40G接口分割成4x10G接口

wKiom1PqPtGhOnReAAKIEEPxNb0201.jpg

命令:Stack-unit 0 port X portmode quad 【x表示哪个接口】

(一)Qsfp是40g口,sfp+就是10g,sfp就是千兆也就是1g口。

(二)接口分割后需要重启才会生效,需要恢复40G接口直接删掉这条命令重启即可

wKiom1PqP7uTCWcaAAIloKqDDz0577.jpg

三、VLT(类似于cisco的vss)

(一)做VLT的前提条件

1、所有单元都需要相同的FTOS 版本
2、Z9000最低OS版本为:8.3.10.2 (RTS release)

(二)VLT只支持交换机使用RSTP

(三)参数功能(某些可自动协商):

wKioL1PqQfzyQyarAAHGmJRfZ3g984.jpg

(四)指peer互联channel,协商VLT

(conf-vlt-domain)#peer-link port-channel <LAG-ID>

(五)提供备份链路,做健康检查

(conf-vlt-domain)#back-up destination <ip-address>

vlt配置实例

wKioL1PzdYvxmhdFAAKExRgxjLQ043.jpg

两台Z9000构成一个VLT域,Forty 0/120做为VLT备份链路,Forty 0/124绑成channel互指VLT Peer-Link形成VLTi关系。

Z9K-A

vlt domain 1

peer-link port-channel 128

back-up destination 192.168.39.252

primary-priority 1

unit-id 0

system-mac-address 00:11:22:33:44:55

interface fortyGigE 0/124

description To VLT peer - VLTi

noip address

port-channel-protocol LACP

port-channel 128 mode active

no shutdown

interface fortyGigE 0/120

description To VLT peer - backup link

ipaddress 192.168.39.251/24

no shutdown

interface Port-channel 128

description VLT

noip address

no shutdown

interface Vlan 1

untagged Port-channel 128

no shutdown

Z9K-B

vlt domain 1

peer-link port-channel 128

back-up destination 192.168.39.251

primary-priority 8192

unit-id 1

system-mac-address 00:11:22:33:44:55

interface fortyGigE 0/124

description To VLT peer - VLTi

noip address

port-channel-protocol LACP

port-channel 128 mode active

no shutdown

interface fortyGigE 0/120

description To VLT peer - backup link

ipaddress 192.168.39.252/24

no shutdown

interface Port-channel 128

description VLT

noip address

no shutdown

interface Vlan 1

untagged Port-channel 128

no shutdown

检查vlt和排错

检查VLT参数和Peer, Link状态

wKiom1PzdnTzm9m4AAImkK7aaoo700.jpg

没有评论:

发表评论