當前位置: 首頁>>代碼示例>>Java>>正文


Java Timer類代碼示例

本文整理匯總了Java中org.jboss.netty.util.Timer的典型用法代碼示例。如果您正苦於以下問題:Java Timer類的具體用法?Java Timer怎麽用?Java Timer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Timer類屬於org.jboss.netty.util包,在下文中一共展示了Timer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: OFConnection

import org.jboss.netty.util.Timer; //導入依賴的package包/類
public OFConnection(@Nonnull DatapathId dpid,
                    @Nonnull OFFactory factory,
                    @Nonnull Channel channel,
                    @Nonnull OFAuxId auxId,
                    @Nonnull IDebugCounterService debugCounters,
                    @Nonnull Timer timer) {
    Preconditions.checkNotNull(dpid, "dpid");
    Preconditions.checkNotNull(factory, "factory");
    Preconditions.checkNotNull(channel, "channel");
    Preconditions.checkNotNull(timer, "timer");
    Preconditions.checkNotNull(debugCounters);

    this.listener = NullConnectionListener.INSTANCE;
    this.dpid = dpid;
    this.factory = factory;
    this.channel = channel;
    this.auxId = auxId;
    this.connectedSince = new Date();
    this.xidDeliverableMap = new ConcurrentHashMap<>();
    this.counters = new OFConnectionCounters(debugCounters, dpid, this.auxId);
    this.timer = timer;
}
 
開發者ID:nsg-ethz,項目名稱:iTAP-controller,代碼行數:23,代碼來源:OFConnection.java

示例2: OFChannelHandler

import org.jboss.netty.util.Timer; //導入依賴的package包/類
/**
 * Creates a handler for interacting with the switch channel
 *
 * @param controller
 *            the controller
 * @param newConnectionListener
 *            the class that listens for new OF connections (switchManager)
 * @param pipeline
 *            the channel pipeline
 * @param threadPool
 *            the thread pool
 * @param idleTimer
 *            the hash wheeled timer used to send idle messages (echo).
 *            passed to constructor to modify in case of aux connection.
 * @param debugCounters
 */
OFChannelHandler(@Nonnull IOFSwitchManager switchManager,
		@Nonnull INewOFConnectionListener newConnectionListener,
		@Nonnull ChannelPipeline pipeline,
		@Nonnull IDebugCounterService debugCounters,
		@Nonnull Timer timer) {

	Preconditions.checkNotNull(switchManager, "switchManager");
	Preconditions.checkNotNull(newConnectionListener, "connectionOpenedListener");
	Preconditions.checkNotNull(pipeline, "pipeline");
	Preconditions.checkNotNull(timer, "timer");
	Preconditions.checkNotNull(debugCounters, "debugCounters");

	this.pipeline = pipeline;
	this.debugCounters = debugCounters;
	this.newConnectionListener = newConnectionListener;
	this.counters = switchManager.getCounters();
	this.state = new InitState();
	this.timer = timer;

	log.debug("constructor on OFChannelHandler {}", String.format("%08x", System.identityHashCode(this)));
}
 
開發者ID:nsg-ethz,項目名稱:iTAP-controller,代碼行數:38,代碼來源:OFChannelHandler.java

示例3: setUp

import org.jboss.netty.util.Timer; //導入依賴的package包/類
@Before
public void setUp() throws Exception {
    switchManager = createMock(IOFSwitchManager.class);
    roleManager = createMock(RoleManager.class);
    sw = createMock(IOFSwitchBackend.class);
    timer = createMock(Timer.class);
    expect(timer.newTimeout(anyObject(TimerTask.class), anyLong(), anyObject(TimeUnit.class))).andReturn(EasyMock.createNiceMock(Timeout.class));
    replay(timer);
    seenXids = null;

    // TODO: should mock IDebugCounterService and make sure
    // the expected counters are updated.
    debugCounterService = new DebugCounterServiceImpl();
    SwitchManagerCounters counters =
            new SwitchManagerCounters(debugCounterService);
    expect(switchManager.getCounters()).andReturn(counters).anyTimes();
    replay(switchManager);
    connection = new MockOFConnection(featuresReply.getDatapathId(), OFAuxId.MAIN);
    switchHandler = new OFSwitchHandshakeHandler(connection, featuresReply, switchManager, roleManager, timer);
    
    // replay sw. Reset it if you need more specific behavior
    replay(sw);
}
 
開發者ID:nsg-ethz,項目名稱:iTAP-controller,代碼行數:24,代碼來源:OFSwitchHandlerTestBase.java

示例4: setUp

import org.jboss.netty.util.Timer; //導入依賴的package包/類
@Before
public void setUp() throws Exception {
	switchManager = createMock(IOFSwitchManager.class);
	roleManager = createMock(RoleManager.class);
	sw = createMock(IOFSwitchBackend.class);
	timer = createMock(Timer.class);
	expect(timer.newTimeout(anyObject(TimerTask.class), anyLong(), anyObject(TimeUnit.class))).andReturn(EasyMock.createNiceMock(Timeout.class));
	replay(timer);
	seenXids = null;

	// TODO: should mock IDebugCounterService and make sure
	// the expected counters are updated.
	debugCounterService = new DebugCounterServiceImpl();
	SwitchManagerCounters counters =
			new SwitchManagerCounters(debugCounterService);
	expect(switchManager.getCounters()).andReturn(counters).anyTimes();
	replay(switchManager);
	connection = new MockOFConnection(featuresReply.getDatapathId(), OFAuxId.MAIN);
	switchHandler = new OFSwitchHandshakeHandler(connection, featuresReply, switchManager, roleManager, timer);

	// replay sw. Reset it if you need more specific behavior
	replay(sw);
}
 
開發者ID:rizard,項目名稱:fast-failover-demo,代碼行數:24,代碼來源:OFSwitchHandlerTestBase.java

示例5: OFConnection

import org.jboss.netty.util.Timer; //導入依賴的package包/類
public OFConnection(@Nonnull DatapathId dpid,
                    @Nonnull OFFactory factory,
                    @Nonnull Channel channel,
                    @Nonnull OFAuxId auxId,
                    @Nonnull IDebugCounterService debugCounters,
                    @Nonnull Timer timer) {
    Preconditions.checkNotNull(dpid, "dpid");
    Preconditions.checkNotNull(factory, "factory");
    Preconditions.checkNotNull(channel, "channel");
    Preconditions.checkNotNull(timer, "timer");
    Preconditions.checkNotNull(debugCounters);

    this.listener = NullConnectionListener.INSTANCE;
    this.dpid = dpid;
    this.factory = factory;
    this.channel = channel;
    this.auxId = auxId;
    this.connectedSince = new Date();
    this.xidDeliverableMap = new ConcurrentHashMap<>();
    this.counters = new OFConnectionCounters(debugCounters, dpid, this.auxId);
    this.timer = timer;
    this.latency = U64.ZERO;
}
 
開發者ID:rhoybeen,項目名稱:floodlightLB,代碼行數:24,代碼來源:OFConnection.java

示例6: init

import org.jboss.netty.util.Timer; //導入依賴的package包/類
private void init(IOFSwitchManager switchManager, Timer timer,
		INewOFConnectionListener connectionListener,
		IDebugCounterService debugCounters,
		@Nonnull List<U32> ofBitmaps,
		@Nonnull OFFactory defaultFactory) {
	this.switchManager = switchManager;
	this.connectionListener = connectionListener;
	this.timer = timer;
	this.debugCounters = debugCounters;
	this.defaultFactory = defaultFactory;
	this.ofBitmaps = ofBitmaps;
	this.idleHandler = new IdleStateHandler(
			timer,
			PipelineIdleReadTimeout.MAIN,
			PipelineIdleWriteTimeout.MAIN,
			0);
	this.readTimeoutHandler = new ReadTimeoutHandler(timer, 30);
}
 
開發者ID:rhoybeen,項目名稱:floodlightLB,代碼行數:19,代碼來源:OpenflowPipelineFactory.java

示例7: OFChannelHandler

import org.jboss.netty.util.Timer; //導入依賴的package包/類
/**
 * Creates a handler for interacting with the switch channel
 *
 * @param controller
 *            the controller
 * @param newConnectionListener
 *            the class that listens for new OF connections (switchManager)
 * @param pipeline
 *            the channel pipeline
 * @param threadPool
 *            the thread pool
 * @param idleTimer
 *            the hash wheeled timer used to send idle messages (echo).
 *            passed to constructor to modify in case of aux connection.
 * @param debugCounters
 */
OFChannelHandler(@Nonnull IOFSwitchManager switchManager,
		@Nonnull INewOFConnectionListener newConnectionListener,
		@Nonnull ChannelPipeline pipeline,
		@Nonnull IDebugCounterService debugCounters,
		@Nonnull Timer timer,
		@Nonnull List<U32> ofBitmaps,
		@Nonnull OFFactory defaultFactory) {

	Preconditions.checkNotNull(switchManager, "switchManager");
	Preconditions.checkNotNull(newConnectionListener, "connectionOpenedListener");
	Preconditions.checkNotNull(pipeline, "pipeline");
	Preconditions.checkNotNull(timer, "timer");
	Preconditions.checkNotNull(debugCounters, "debugCounters");

	this.pipeline = pipeline;
	this.debugCounters = debugCounters;
	this.newConnectionListener = newConnectionListener;
	this.counters = switchManager.getCounters();
	this.state = new InitState();
	this.timer = timer;
	this.ofBitmaps = ofBitmaps;
	this.factory = defaultFactory;

	log.debug("constructor on OFChannelHandler {}", String.format("%08x", System.identityHashCode(this)));
}
 
開發者ID:rhoybeen,項目名稱:floodlightLB,代碼行數:42,代碼來源:OFChannelHandler.java

示例8: OFChannelHandler

import org.jboss.netty.util.Timer; //導入依賴的package包/類
/**
 * Creates a handler for interacting with the switch channel
 *	創建一個處理程序和交換機管道交互
 * @param controller
 *            the controller
 * @param newConnectionListener
 *            the class that listens for new OF connections (switchManager)
 * @param pipeline
 *            the channel pipeline
 * @param threadPool
 *            the thread pool
 * @param idleTimer
 *            the hash wheeled timer used to send idle messages (echo).
 *            passed to constructor to modify in case of aux connection.
 * @param debugCounters
 */
OFChannelHandler(@Nonnull IOFSwitchManager switchManager,
		@Nonnull INewOFConnectionListener newConnectionListener,
		@Nonnull ChannelPipeline pipeline,
		@Nonnull IDebugCounterService debugCounters,
		@Nonnull Timer timer) {

	Preconditions.checkNotNull(switchManager, "switchManager");
	Preconditions.checkNotNull(newConnectionListener, "connectionOpenedListener");
	Preconditions.checkNotNull(pipeline, "pipeline");
	Preconditions.checkNotNull(timer, "timer");
	Preconditions.checkNotNull(debugCounters, "debugCounters");

	this.pipeline = pipeline;
	this.debugCounters = debugCounters;
	this.newConnectionListener = newConnectionListener;
	this.counters = switchManager.getCounters();
	this.state = new InitState();
	this.timer = timer;

	log.debug("constructor on OFChannelHandler {}", String.format("%08x", System.identityHashCode(this)));
}
 
開發者ID:DaiDongLiang,項目名稱:DSC,代碼行數:38,代碼來源:OFChannelHandler.java

示例9: setUp

import org.jboss.netty.util.Timer; //導入依賴的package包/類
@Before
public void setUp() throws Exception {
    switchManager = createMock(IOFSwitchManager.class);
    roleManager = createMock(RoleManager.class);
    sw = createMock(IOFSwitchBackend.class);
    timer = createMock(Timer.class);
    expect(timer.newTimeout(anyObject(TimerTask.class), anyLong(), anyObject(TimeUnit.class))).andReturn(EasyMock.createNiceMock(Timeout.class));
    replay(timer);
    seenXids = null;

    // TODO: should mock IDebugCounterService and make sure
    // the expected counters are updated.
    debugCounterService = new DebugCounterServiceImpl();
    SwitchManagerCounters counters =
            new SwitchManagerCounters(debugCounterService);
    expect(switchManager.getCounters()).andReturn(counters).anyTimes();
    replay(switchManager);
    connection = new MockOFConnection(featuresReply.getDatapathId(), OFAuxId.MAIN);
    switchHandler = new OFSwitchHandshakeHandler(connection, featuresReply, switchManager, roleManager, timer,null);
    
    // replay sw. Reset it if you need more specific behavior
    replay(sw);
}
 
開發者ID:DaiDongLiang,項目名稱:DSC,代碼行數:24,代碼來源:OFSwitchHandlerTestBase.java

示例10: SocketChannel

import org.jboss.netty.util.Timer; //導入依賴的package包/類
public SocketChannel(final Channel channel, long timeoutMillis, Timer timer) {
    if (channel == null) {
        throw new NullPointerException("channel");
    }
    if (timer == null) {
        throw new NullPointerException("channel");
    }
    this.channel = channel;
    this.timeoutMillis = timeoutMillis;
    this.timer = timer;
    this.requestManager = new RequestManager(this.timer);
    this.responseWriteFail = new ChannelFutureListener() {
        @Override
        public void operationComplete(ChannelFuture future) throws Exception {
            if (!future.isSuccess()) {
                logger.warn("responseWriteFail. {}", channel);
            }
        }
    };
}
 
開發者ID:masonmei,項目名稱:apm-agent,代碼行數:21,代碼來源:SocketChannel.java

示例11: HandshakeTimeoutHandler

import org.jboss.netty.util.Timer; //導入依賴的package包/類
public HandshakeTimeoutHandler(OFChannelHandler channelHandler,
                               Timer timer,
                               long timeoutSeconds) {
    super();
    this.channelHandler = channelHandler;
    this.timer = timer;
    this.timeoutNanos = TimeUnit.SECONDS.toNanos(timeoutSeconds);

}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:10,代碼來源:HandshakeTimeoutHandler.java

示例12: HandshakeTimeoutHandler

import org.jboss.netty.util.Timer; //導入依賴的package包/類
public HandshakeTimeoutHandler(RPCChannelHandler handler,
                               Timer timer,
                               long timeoutSeconds) {
    super();
    this.handler = handler;
    this.timer = timer;
    this.timeoutNanos = TimeUnit.SECONDS.toNanos(timeoutSeconds);

}
 
開發者ID:nsg-ethz,項目名稱:iTAP-controller,代碼行數:10,代碼來源:HandshakeTimeoutHandler.java

示例13: BootstrapTimeoutHandler

import org.jboss.netty.util.Timer; //導入依賴的package包/類
public BootstrapTimeoutHandler(Timer timer,
                               long timeoutSeconds) {
    super();
    this.timer = timer;
    this.timeoutNanos = TimeUnit.SECONDS.toNanos(timeoutSeconds);

}
 
開發者ID:nsg-ethz,項目名稱:iTAP-controller,代碼行數:8,代碼來源:BootstrapTimeoutHandler.java

示例14: RSHandshakeTimeoutHandler

import org.jboss.netty.util.Timer; //導入依賴的package包/類
public RSHandshakeTimeoutHandler(RemoteSyncChannelHandler channelHandler,
                                 Timer timer,
                                 long timeoutSeconds) {
    super();
    this.channelHandler = channelHandler;
    this.timer = timer;
    this.timeoutNanos = TimeUnit.SECONDS.toNanos(timeoutSeconds);
}
 
開發者ID:nsg-ethz,項目名稱:iTAP-controller,代碼行數:9,代碼來源:RSHandshakeTimeoutHandler.java

示例15: OFSwitchHandshakeHandler

import org.jboss.netty.util.Timer; //導入依賴的package包/類
/**
 * Create a new unconnected OFChannelHandler.
 * @param controller
 * @param broker
 * @throws SwitchHandshakeHandlerException
 */
OFSwitchHandshakeHandler(@Nonnull IOFConnectionBackend connection,
		@Nonnull OFFeaturesReply featuresReply,
		@Nonnull IOFSwitchManager switchManager,
		@Nonnull RoleManager roleManager,
		@Nonnull Timer timer) {
	Preconditions.checkNotNull(connection, "connection");
	Preconditions.checkNotNull(featuresReply, "featuresReply");
	Preconditions.checkNotNull(switchManager, "switchManager");
	Preconditions.checkNotNull(roleManager, "roleManager");
	Preconditions.checkNotNull(timer, "timer");
	Preconditions.checkArgument(connection.getAuxId().equals(OFAuxId.MAIN),
			"connection must be MAIN connection but is %s", connection);

	this.switchManager = switchManager;
	this.roleManager = roleManager;
	this.mainConnection = connection;
	this.auxConnections = new ConcurrentHashMap<OFAuxId, IOFConnectionBackend>();
	this.featuresReply = featuresReply;
	this.timer = timer;
	this.switchManagerCounters = switchManager.getCounters();
	this.factory = OFFactories.getFactory(featuresReply.getVersion());
	this.roleChanger = new RoleChanger(DEFAULT_ROLE_TIMEOUT_NS);
	setState(new InitState());
	this.pendingPortStatusMsg = new ArrayList<OFPortStatus>();

	connection.setListener(this);
}
 
開發者ID:nsg-ethz,項目名稱:iTAP-controller,代碼行數:34,代碼來源:OFSwitchHandshakeHandler.java


注:本文中的org.jboss.netty.util.Timer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。