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


Java IbisIdentifier.equals方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: stealReplyHandler

import ibis.ipl.IbisIdentifier; //导入方法依赖的package包/类
public void stealReplyHandler(InvocationRecord ir, IbisIdentifier sender,
        int opcode) {
    switch (opcode) {
    case STEAL_REPLY_SUCCESS:
    case STEAL_REPLY_FAILED:
    case STEAL_REPLY_SUCCESS_TABLE:
    case STEAL_REPLY_FAILED_TABLE:
        cashmere.lb.gotJobResult(ir, sender);
        break;
    case ASYNC_STEAL_REPLY_SUCCESS:
    case ASYNC_STEAL_REPLY_FAILED:
    case ASYNC_STEAL_REPLY_SUCCESS_TABLE:
    case ASYNC_STEAL_REPLY_FAILED_TABLE:
        if (stealLogger.isInfoEnabled() && ir != null) {
            stealLogger.info("Stole intercluster job " + ir.getStamp());
        }
        synchronized (cashmere) {
            if (sender.equals(asyncCurrentVictim)) {
                gotAsyncStealReply = true;
                asyncStolenJob = ir;
                //            		cashmere.notifyAll(); // not needed I think, we naver wait for the async job.
            } else {
                ftLogger
                        .warn("CASHMERE '"
                                + s.ident
                                + "': received an async job from a node that caused a timeout before.");
                if (ir != null) {
                    s.q.addToTail(ir);
                }
            }
        }
        break;
    default:
        s.assertFailed("illegal opcode in CRS stealReplyHandler",
                new Exception());
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:38,代码来源:ClusterAwareRandomWorkStealing.java

示例6: gotJobResult

import ibis.ipl.IbisIdentifier; //导入方法依赖的package包/类
public synchronized void gotJobResult(InvocationRecord ir, IbisIdentifier sender) {
        // This might be a job that came in after a STEAL_WAIT_TIMEOUT.
        // If this is the case, this job has to be added to the queue,
        // it is not the result of the current steal request.
        if (!sender.equals(currentVictim)) {
            if (s.deadIbises.contains(sender)) {
                // A dead Ibis is alive after all. Ignore it.
                ftLogger.warn("CASHMERE '" + s.ident + "': received a reply from "
                    + sender + " which is supposed to be dead");
                return;
            }
            ftLogger.warn("CASHMERE '" + s.ident + "': received a reply from "
                + sender + " who caused a timeout before. I am stealing from " + currentVictim);
            if (ir != null) {
                s.q.addToTail(ir);
            }
            return;
        }

        if (stolenJob != null) {
            ftLogger.warn("CASHMERE '" + s.ident + "': EEK: setting stolenJob when it is non-null!");
        }

        gotStealReply = true;
        stolenJob = ir;
        currentVictim = null;
        notifyAll();
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:29,代码来源:LoadBalancing.java

示例7: handleCrash

import ibis.ipl.IbisIdentifier; //导入方法依赖的package包/类
private void handleCrash(IbisIdentifier dead) {
    synchronized (s) {
        s.ft.crashedIbises.add(dead);
        if (dead.equals(s.lb.getCurrentVictim())) {
            s.currentVictimCrashed = true;
            s.lb.setCurrentVictim(null);
        }
        s.ft.gotCrashes = true;
        s.notifyAll();
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:12,代码来源:FTCommunication.java

示例8: died

import ibis.ipl.IbisIdentifier; //导入方法依赖的package包/类
public void died(IbisIdentifier corpse) {
    ftLogger.debug("CASHMERE '" + s.ident + "': " + corpse + " died");
    if(corpse.equals(s.ident)) {
        ftLogger.error("CASHMERE '" + s.ident + "': the registry thinks I have crashed! Exiting.");
        System.exit(1);
    }
    left(corpse);
    handleCrash(corpse);
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:10,代码来源:FTCommunication.java

示例9: left

import ibis.ipl.IbisIdentifier; //导入方法依赖的package包/类
public void left(IbisIdentifier leaver) {
    if (leaver.equals(s.ident))
        return;

    joinThread.removeJoiner(leaver);

    ftLogger.debug("CASHMERE '" + s.ident + "': " + leaver + " left");

    Victim v;

    synchronized (s) {
        // master and cluster coordinators will be reelected
        // only if their crash was confirmed by the nameserver
        if (leaver.equals(s.getMasterIdent())) {
            s.ft.masterHasCrashed = true;
            s.ft.gotCrashes = true;
        }
        if (leaver.equals(s.ft.clusterCoordinatorIdent)) {
            s.ft.clusterCoordinatorHasCrashed = true;
            s.ft.gotCrashes = true;
        }

        s.so.removeSOConnection(leaver);
        s.deadIbises.add(leaver);
        v = s.victims.remove(leaver);
        s.notifyAll();
    }

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

示例10: registerRank

import ibis.ipl.IbisIdentifier; //导入方法依赖的package包/类
private void registerRank(int rank, IbisIdentifier id) {
    IbisIdentifier old = locationCache.put(rank, id);

    // sanity check
    if (old != null && !old.equals(id)) {
        logger.error("Location cache overwriting rank " + rank
                + " with different id! " + old + " != " + id);
    }
}
 
开发者ID:NLeSC,项目名称:Constellation,代码行数:10,代码来源:Pool.java

示例11: randomForwardToPool

import ibis.ipl.IbisIdentifier; //导入方法依赖的package包/类
public boolean randomForwardToPool(StealPool pool, StealRequest sr) {

        // NOTE: We know the pool is not NULL or NONE, and not a set
        PoolInfo info = null;

        synchronized (pools) {
            info = pools.get(pool.getTag());
        }

        if (info == null) {
            logger.warn("Failed to randomly select node in pool "
                    + pool.getTag() + ", pool does not exist?");
            return false;
        }

        IbisIdentifier id = info.selectRandom(random);

        if (id == null) {
            logger.warn(
                    "Failed to randomly select node in pool " + pool.getTag());
            return false;
        }

        // If the chosen id is the local one, don't just return false, because
        // this hampers the remote steal throttle mechanism. Just try again to
        // select a node, as long as there is a choice.
        while (id == null || id.equals(local)) {
            if (info.nMembers() <= 1) {
                return false;
            }
            id = info.selectRandom(random);
        }

        if (logger.isDebugEnabled()) {
            logger.debug("Sending steal request to " + id.name());
        }
        return doForward(id, OPCODE_STEAL_REQUEST, sr);
    }
 
开发者ID:NLeSC,项目名称:Constellation,代码行数:39,代码来源:Pool.java

示例12: followPool

import ibis.ipl.IbisIdentifier; //导入方法依赖的package包/类
public void followPool(String tag) {

        try {
            // Simple case: we own the pool or already follow it.
            synchronized (pools) {
                if (pools.containsKey(tag)) {
                    return;
                }
            }

            // Complex case: we are not part of the pool, but interested anyway
            Registry reg = ibis.registry();

            String electTag = "STEALPOOL$" + tag;

            IbisIdentifier id = null;

            // TODO: will repeat for ever if pool master does not exist...
            while (id == null) {
                if (logger.isDebugEnabled()) {
                    logger.info("Searching master for POOL " + electTag);
                }
                id = reg.getElectionResult(electTag, 1000);
            }

            boolean master = id.equals(ibis.identifier());

            logger.info("Found master for POOL " + electTag + " " + id + " "
                    + master);

            if (master) {
                // Assuming the pools are static and registered in
                // the right order this should not happen
                logger.error(
                        "INTERNAL ERROR: election of follow pool returned self!");
                return;
            }

            synchronized (pools) {
                pools.put(tag, new PoolInfo(tag, id, false));
            }

            updater.addTag(tag);
        } catch (IOException e) {
            logger.warn("Failed to register pool " + tag, e);
        }
    }
 
开发者ID:NLeSC,项目名称:Constellation,代码行数:48,代码来源:Pool.java


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