⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asynccoreemulator.ucjava

📁 High performance DB query
💻 UCJAVA
字号:
/* * @(#)$Id: ASyncCoreEmulator.ucjava,v 1.1 2005/04/27 21:27:46 huebsch Exp $ * * Copyright (c) 2001-2004 Regents of the University of California. * All rights reserved. * * This file is distributed under the terms in the attached BERKELEY-LICENSE * file. If you do not find these files, copies can be found by writing to: * Computer Science Division, Database Group, Universite of California, * 617 Soda Hall #1776, Berkeley, CA 94720-1776. Attention: Berkeley License * * Copyright (c) 2003-2004 Intel Corporation. All rights reserved. * * This file is distributed under the terms in the attached INTEL-LICENSE file. * If you do not find these files, copies can be found by writing to: * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, * Berkeley, CA, 94704.  Attention:  Intel License Inquiry. *//* * Copyright (c) 2001-2003 Regents of the University of California. * All rights reserved. * * See the file LICENSE included in this distribution for details. */package overlay.location.bamboo;import bamboo.lss.ASyncCore;import java.nio.channels.SelectionKey;import java.nio.channels.SelectableChannel;import java.nio.channels.ClosedChannelException;import services.LocalNode;import services.timer.TimerClient;/** * Implements the bamboo.lss.ASyncCore.register_timer function by calling the * bamboo.sim.EventQueue.register_timer function, so that stages that use the * former can run under the simulator. * * @author Sean C. Rhea * @version $Id: ASyncCoreEmulator.ucjava,v 1.1 2005/04/27 21:27:46 huebsch Exp $ */public class ASyncCoreEmulator extends ASyncCore implements TimerClient {    /**     * Constructor ASyncCoreEmulator     */    public ASyncCoreEmulator() {}    /**     * Method nowMillis     * @return     */    public long nowMillis() {        return timerMillis();    }    /**     * Method timerMillis     * @return     */    public long timerMillis() {        return (long) LocalNode.myTimer.getCurrentTime() * 1000;    }    /**     * Method registerTimer     *     * @param time_ms     * @param cb     * @return     */    public Object registerTimer(long time_ms, final Runnable cb) {        CallbackInfo cbi = new CallbackInfo(cb, null);        return registerTimer(time_ms, cbi);    }    /**     * Method cancelTimer     *     * @param token     */    public void cancelTimer(Object token) {}    /**     * Method registerTimer     *     * @param time_ms     * @param cbi     * @return     */    public Object registerTimer(long time_ms, CallbackInfo cbi) {        LocalNode.myTimer.schedule((((double) time_ms) / 1000), cbi, this);        return null;    }    /**     * Method handleClock     *     * @param clockData     */    public void handleClock(Object clockData) {        CallbackInfo cbi = (CallbackInfo) clockData;        cbi.run();    }    /**     * Method register_selectable     *     * @param channel     * @param interest_ops     * @param cb     * @param user_data     * @return     * @throws ClosedChannelException     */    public SelectionKey register_selectable(            SelectableChannel channel, int interest_ops, SelectableCB cb, Object user_data)                throws ClosedChannelException {        throw new RuntimeException(            "Method register_selectable not supported in emulation");    }    /**     * Method unregister_selectable     *     * @param skey     */    public void unregister_selectable(SelectionKey skey) {        throw new RuntimeException(            "Method register_selectable not supported in emulation");    }    /**     * Method registerSelectable     *     * @param channel     * @param interestOps     * @param callback     * @throws ClosedChannelException     */    public void registerSelectable(            SelectableChannel channel, int interestOps, Runnable callback)                throws ClosedChannelException {        throw new RuntimeException(            "Method register_selectable not supported in emulation");    }    /**     * Method unregisterSelectable     *     * @param channel     * @param interestOps     * @throws ClosedChannelException     */    public void unregisterSelectable(SelectableChannel channel, int interestOps)            throws ClosedChannelException {        throw new RuntimeException(            "Method register_selectable not supported in emulation");    }    /**     * Method unregisterSelectable     *     * @param channel     */    public void unregisterSelectable(SelectableChannel channel) {        throw new RuntimeException(            "Method register_selectable not supported in emulation");    }    /**     * Method asyncMain     */    public void asyncMain() {        throw new RuntimeException(            "Method register_selectable not supported in emulation");    }    /**     * Class CallbackInfo     *     */    class CallbackInfo {        public Runnable cbr;        public Object userdata;        /**         * Constructor CallbackInfo         *         * @param cbr         * @param userdata         */        public CallbackInfo(Runnable cbr, Object userdata) {            this.cbr = cbr;            this.userdata = userdata;        }        /**         * Method run         */        public void run() {            cbr.run();        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -