当前位置: 首页>>代码示例>>Java>>正文


Java IbisIdentifier类代码示例

本文整理汇总了Java中ibis.ipl.IbisIdentifier的典型用法代码示例。如果您正苦于以下问题:Java IbisIdentifier类的具体用法?Java IbisIdentifier怎么用?Java IbisIdentifier使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IbisIdentifier类属于ibis.ipl包,在下文中一共展示了IbisIdentifier类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fetchObject

import ibis.ipl.IbisIdentifier; //导入依赖的package包/类
/** Fetch a shared object from another node.
 * If the Invocation record is null, any version is OK, we just test that we have a 
 * version of the object. If it is not null, we try to satisfy the guard of the 
 * invocation record. It might not be satisfied when this method returns, the
 * guard might depend on more than one shared object. */
protected void fetchObject(String objectId, IbisIdentifier source,
        InvocationRecord r) throws SOReferenceSourceCrashedException {

    if(s.so.waitForObject(objectId, source, r, SO_WAIT_FOR_UPDATES_TIME)) {
        return;
    }

    soLogger.debug("CASHMERE '" + s.ident
        + "': did not receive object in time, demanding it now");

    // haven't got it, demand it now.
    sendSORequest(objectId, source, true);

    boolean gotIt = waitForSOReply();
    if (gotIt) {
        soLogger.debug("CASHMERE '" + s.ident
            + "': received demanded object");
        return;
    }
    soLogger.error("CASHMERE '"
            + s.ident
            + "': internal error: did not receive shared object after I demanded it. ");
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:29,代码来源:SOCommunication.java

示例2: handleSORequest

import ibis.ipl.IbisIdentifier; //导入依赖的package包/类
protected void handleSORequest(ReadMessage m, boolean demand) {
    String objid = null;
    IbisIdentifier origin = m.origin().ibisIdentifier();

    soLogger.info("CASHMERE '" + s.ident + "': got so request");

    try {
        objid = m.readString();
        // no need to finish the message. We don't do any communication
    } catch (IOException e) {
        soLogger.warn("CASHMERE '" + s.ident
            + "': got exception while reading" + " shared object request: "
            + e.getMessage());
    }

    synchronized (s) {
        s.so.addToSORequestList(origin, objid, demand);
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:20,代码来源:SOCommunication.java

示例3: connectSOSendPort

import ibis.ipl.IbisIdentifier; //导入依赖的package包/类
private void connectSOSendPort(IbisIdentifier ident) {
    String name = null;
    if (LABEL_ROUTING_MCAST) {
        name = "lrmc port";
    } else {
        name = "cashmere so receive port for " + s.ident;
    }

    ReceivePortIdentifier r =
            Communication.connect(soSendPort, ident, name,
                Cashmere.CONNECT_TIMEOUT);
    if (r != null) {
        synchronized (s) {
            ports.put(ident, r);
        }
    } else {
        soLogger.warn("CASHMERE '" + s.ident
            + "': unable to connect to SO receive port " + name + " on " + ident);
        // We won't broadcast the object to this receiver.
        // This is not really a problem, it will get the object if it
        // needs it. But the node has probably crashed anyway.
        return;
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:25,代码来源:SOCommunication.java

示例4: killSubtreesOf

import ibis.ipl.IbisIdentifier; //导入依赖的package包/类
/**
 * Used for fault tolerance. Kill every job that was spawned on targetOwner
 * or is a child of a job spawned on targetOwner. Store all finished children
 * of the aborted jobs in the global result table.
 */
public ArrayList<InvocationRecord> killSubtreesOf(IbisIdentifier targetOwner) {
    Cashmere.assertLocked(s);
    ArrayList<InvocationRecord> toStore = new ArrayList<InvocationRecord>();
    for (int i = 0; i < count; i++) {
        InvocationRecord curr = l[i];

        if (curr.aborted) continue; // already handled

        if ((curr.getParent() != null && curr.getParent().aborted)
            || curr.isDescendentOf(targetOwner)
            || curr.getOwner().equals(targetOwner)) {

            curr.aborted = true;
            s.stats.killedOrphans++;
            toStore.add(curr);
        }
    }
    return toStore;
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:25,代码来源:IRStack.java

示例5: killAndStoreSubtreeOf

import ibis.ipl.IbisIdentifier; //导入依赖的package包/类
public void killAndStoreSubtreeOf(IbisIdentifier targetOwner) {
    if (ASSERTS) {
        Cashmere.assertLocked(cashmere);
    }

    for (int i = 0; i < count; i++) {
        InvocationRecord curr = l[i];
        if ((curr.getParent() != null && curr.getParent().aborted)
            || curr.isDescendentOf(targetOwner)
            || curr.getOwner().equals(targetOwner)) {
            //this shouldnt happen, actually
            curr.aborted = true;
            if (abortLogger.isDebugEnabled()) {
                abortLogger.debug("found stolen child: " + curr.getStamp()
                    + ", it depends on " + targetOwner);
            }
            curr.decrSpawnCounter();
            cashmere.stats.abortedJobs++;
            cashmere.stats.abortMessages++;
            removeIndex(i);
            i--;
            cashmere.ft.sendAbortAndStoreMessage(curr);
        }
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:26,代码来源:IRVector.java

示例6: killSubtreeOf

import ibis.ipl.IbisIdentifier; //导入依赖的package包/类
public void killSubtreeOf(IbisIdentifier targetOwner) {
    if (ASSERTS) {
        Cashmere.assertLocked(cashmere);
    }

    for (int i = 0; i < count; i++) {
        InvocationRecord curr = l[i];
        if ((curr.getParent() != null && curr.getParent().aborted)
                || curr.isDescendentOf(targetOwner)
                || curr.getOwner().equals(targetOwner)) {
            //this shouldnt happen, actually
            curr.aborted = true;
            if (abortLogger.isDebugEnabled()) {
                abortLogger.debug("found stolen child: " + curr.getStamp()
                        + ", it depends on " + targetOwner);
            }
            curr.decrSpawnCounter();
            cashmere.stats.abortedJobs++;
            cashmere.stats.abortMessages++;
            removeIndex(i);
            i--;
            cashmere.ft.sendAbortMessage(curr);
        }
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:26,代码来源:IRVector.java

示例7: redoStolenBy

import ibis.ipl.IbisIdentifier; //导入依赖的package包/类
/**
 * Used for fault tolerance. Remove all the jobs stolen by targetOwner and
 * put them back in the taskQueue. 
 */
public void redoStolenBy(IbisIdentifier crashedIbis) {
    Cashmere.assertLocked(cashmere);

    for (int i = count - 1; i >= 0; i--) {
        if (crashedIbis.equals(l[i].getStealer())) {
            if (ftLogger.isDebugEnabled()) {
                ftLogger.debug("Found a job to restart: " + l[i].getStamp());
            } 
            l[i].setReDone(true);
            l[i].setStealer(null);
            cashmere.q.addToTail(l[i]);
            cashmere.stats.restartedJobs++;
            count--;
            l[i] = l[count];
        }
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:22,代码来源:IRVector.java

示例8: setMaster

import ibis.ipl.IbisIdentifier; //导入依赖的package包/类
public void setMaster(IbisIdentifier newMaster) {
    masterIdent = newMaster;

    if (masterIdent.equals(ident)) {
        /* I am the master. */
        commLogger.info(
                "CASHMERE '" + ident
                + "': init ibis: I am the master");
        master = true;
    } else {
        commLogger.info("CASHMERE '" + ident
                + "': init ibis I am slave");
    }

    if (STATS && master) {
        totalStats = new Statistics();
 totalMCStats = new MCStats();
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:20,代码来源:Cashmere.java

示例9: handleCrash

import ibis.ipl.IbisIdentifier; //导入依赖的package包/类
/**
 * Used in fault tolerance; check if the asynchronous steal victim crashed;
 * if so, cancel the steal request; if the job already arrived, remove it
 * (it should be aborted anyway, since it was stolen from a crashed machine)
 * if the owner of the asynchronously stolen job
 * crashed, abort the job.
 */
public void handleCrash(IbisIdentifier crashedIbis) {
    Cashmere.assertLocked(cashmere);
    if (crashedIbis.equals(asyncCurrentVictim)) {
        /*
         * current async victim crashed, reset the flag, remove the stolen
         * job
         */
        asyncStealInProgress = false;
        asyncStolenJob = null;
        asyncCurrentVictim = null;
        gotAsyncStealReply = false;
    }

    if (asyncStolenJob != null) {
        if (asyncStolenJob.getOwner().equals(crashedIbis)) {
            asyncStolenJob = null;
        }
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:27,代码来源:ClusterAwareRandomWorkStealing.java

示例10: handleLostConnection

import ibis.ipl.IbisIdentifier; //导入依赖的package包/类
private void handleLostConnection(IbisIdentifier dead) {
    Victim v = null;
    synchronized (s) {
        if (s.deadIbises.contains(dead))
            return;

        s.ft.crashedIbises.add(dead);
        s.deadIbises.add(dead);
        if (dead.equals(s.lb.getCurrentVictim())) {
            s.currentVictimCrashed = true;
            s.lb.setCurrentVictim(null);
        }
        s.ft.gotCrashes = true;
        v = s.victims.remove(dead);
        s.notifyAll();
    }

    if (v != null) {
        v.close();
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:22,代码来源:FTCommunication.java

示例11: handleCoordinatorInfo

import ibis.ipl.IbisIdentifier; //导入依赖的package包/类
public void handleCoordinatorInfo(ReadMessage m) {
    Timer createCoordinatorTimer = Timer.createTimer();
    createCoordinatorTimer.start();

    try {
        s.ft.coordinatorIdent = (IbisIdentifier) m.readObject();
        m.finish();
    } catch (Exception e){
        System.out.println("HandleCoordinatorInfo failed: " + e);
        System.exit(1);
    }

    if (s.ft.coordinatorIdent.equals(s.ident)){
        s.ft.becomeCoordinator = true;
    }

    createCoordinatorTimer.stop();
    synchronized (s){
        s.stats.createCoordinatorTimer.add(createCoordinatorTimer);
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:22,代码来源:FTCommunication.java

示例12: addJoiner

import ibis.ipl.IbisIdentifier; //导入依赖的package包/类
protected synchronized void addJoiner(IbisIdentifier joiner) {
    if (CACHE_JOINS) {
        if (joiner.equals(s.ident)) {
            ftLogger.debug("CASHMERE '" + s.ident
                + "': this is me, waiting for earlier joins");
            waitForEarlierJoins();
            ftLogger.debug("CASHMERE '" + s.ident
                + "': waiting for earlier joins done");
            s.ft.ftComm.handleMyOwnJoinJoin();
            return;
        }

        joiners.add(joiner);
    } else {
        if (joiner.equals(s.ident)) {
            ftLogger.debug("CASHMERE '" + s.ident
                + "': got my own join");
            s.ft.ftComm.handleMyOwnJoinJoin();
            return;
        }
        IbisIdentifier[] j = new IbisIdentifier[1];
        j[0] = joiner;
        s.ft.ftComm.handleJoins(j);
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:26,代码来源:JoinThread.java

示例13: handleMasterCrash

import ibis.ipl.IbisIdentifier; //导入依赖的package包/类
public void handleMasterCrash() {
    ftLogger.info("CASHMERE '" + s.ident + "': MASTER (" + s.getMasterIdent()
        + ") HAS CRASHED");

    // master has crashed, let's elect a new one
    IbisIdentifier newMaster = null;
    try {
        newMaster = s.comm.ibis.registry().elect("cashmere.master");
    } catch (Exception e) {
        ftLogger.error("CASHMERE '" + s.ident
            + "' :exception while electing a new master " + e, e);
        System.exit(1);
    }

    synchronized (s) {
        masterHasCrashed = false;
        s.setMaster(newMaster);
        if (s.getMasterIdent().equals(s.ident)) {
            ftLogger.info("CASHMERE '" + s.ident + "': I am the new master");
        } else {
            ftLogger.info("CASHMERE '" + s.ident + "': " + s.getMasterIdent()
                + "is the new master");
        }
        restarted = true;
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:27,代码来源:FaultTolerance.java

示例14: connect

import ibis.ipl.IbisIdentifier; //导入依赖的package包/类
private void connect() {
        try {
            System.err.println("connecting...");
            Registry registry = ibis.registry();
            System.err.println("got reg");

//            IbisIdentifier vizHost = registry.elect("nbodyViz");
            IbisIdentifier vizHost = registry.getElectionResult("nbodyViz");
            System.err.println("got election res: " + vizHost);
            sport = ibis.createSendPort(t, "nbody-viz-port");
            sport.connect(vizHost, "nbody-viz-port", 10*1000, false);
            System.err.println("port connected");
            haveClient = true;
        } catch (Exception e) {
            if(sport != null) {
                try {
                    sport.close();
                } catch (IOException x) {
                    // ignore
                }
            }
            System.err.println("failed connect: " + e);
            e.printStackTrace();
        }
    }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:26,代码来源:RemoteVisualization.java

示例15: forward

import ibis.ipl.IbisIdentifier; //导入依赖的package包/类
private boolean forward(Message m, byte opcode) {

        ConstellationIdentifier target = m.target;

        if (Debug.DEBUG_COMMUNICATION && logger.isInfoEnabled()) {
            logger.info("POOL FORWARD Message from " + m.source + " to "
                    + m.target + " " + m);
        }

        IbisIdentifier id = translate(target);

        if (id == null) {
            logger.warn("POOL failed to translate " + target
                    + " to an IbisIdentifier");
            return false;
        }

        return doForward(id, opcode, m);
    }
 
开发者ID:NLeSC,项目名称:Constellation,代码行数:20,代码来源:Pool.java


注:本文中的ibis.ipl.IbisIdentifier类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。