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


Java SendPort类代码示例

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


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

示例1: getSendPort

import ibis.ipl.SendPort; //导入依赖的package包/类
private SendPort getSendPort() {
    if (closed) {
        return null;
    }

    if (!connected) {
        if (commLogger.isDebugEnabled()) {
    	commLogger.debug("CASHMERE '" + sendPort.identifier().ibisIdentifier()
                    + "': connecting to " + ident);
        }
        r = Communication.connect(sendPort, ident, "cashmere port",
            Cashmere.CONNECT_TIMEOUT);
        if (r == null) {
            commLogger.warn("CASHMERE '" + sendPort.identifier().ibisIdentifier()
                + "': unable to connect to " + ident
                + ", might have crashed");
            return null;
        }
        connected = true;
        connectionCount++;
    }
    
    return sendPort;
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:25,代码来源:Victim.java

示例2: startSenderPort

import ibis.ipl.SendPort; //导入依赖的package包/类
/**
 * 
 * Creates a new SendPort and connects to the receiver.
 * 
 * @param senderPortType
 *            The type of the sender port.
 * @param senderPort
 *            The name of the sender port.
 * @param receiver
 *            The Ibis instance that receives messages.
 * @param receiverPort
 *            The name of the receiver.
 * @return The port that is created.
 */
private SendPort startSenderPort(PortType senderPortType,
		String senderPort, IbisIdentifier receiver, String receiverPort) {

	SendPort port = null;
	Ibis ibis = receiverPort.equals(queryReceiverPort) ? clientIbis
			: clusterIbis;
	try {
		port = ibis.createSendPort(senderPortType, senderPort);
		port.connect(receiver, receiverPort);
		if (port.connectedTo() != null) {
			senderPorts.put(senderPort, port);
			return port;
		} else {
			return null; // Connected to any resource
		}

	} catch (Exception e) {
		log.error("Failed in creating the sender port " + senderPort
				+ "to node " + receiver, e);
	}

	return port;
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:38,代码来源:NetworkLayer.java

示例3: disconnect

import ibis.ipl.SendPort; //导入依赖的package包/类
public static void disconnect(SendPort s, ReceivePortIdentifier ident) {
    try {
        s.disconnect(ident);
    } catch (IOException e) {
        // ignored
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:8,代码来源:Communication.java

示例4: Victim

import ibis.ipl.SendPort; //导入依赖的package包/类
public Victim(IbisIdentifier ident, SendPort s) {
    this.ident = ident;
    this.sendPort = s;
    if (s != null) {
        inDifferentCluster = !clusterOf(ident).equals(clusterOf(s.identifier().ibisIdentifier()));
    } else {
        inDifferentCluster = false;
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:10,代码来源:Victim.java

示例5: newMessage

import ibis.ipl.SendPort; //导入依赖的package包/类
public WriteMessage newMessage() throws IOException {
    SendPort send;
    synchronized (sendPort) {
        send = getSendPort();
        if (send != null) {
            referenceCount++;
        } else {
            throw new IOException("CASHMERE '" + sendPort.identifier().ibisIdentifier()
                    + "': Could not connect to " + ident);
        }
    }
    return send.newMessage();
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:14,代码来源:Victim.java

示例6: lostConnection

import ibis.ipl.SendPort; //导入依赖的package包/类
public void lostConnection(SendPort me, ReceivePortIdentifier johnDoe,
           Throwable reason) {
if (ftLogger.isInfoEnabled()) {
    ftLogger.info("CASHMERE '" + s.ident
	    + "': got SENDPORT lostConnection upcall: "
	    + johnDoe.ibisIdentifier(), reason);
}
       if (connectionUpcallsDisabled) {
           return;
       }
       handleLostConnection(johnDoe.ibisIdentifier());
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:13,代码来源:FTCommunication.java

示例7: getMessageToSend

import ibis.ipl.SendPort; //导入依赖的package包/类
/**
 * Creates a new message for the port that has the name of the receiverPort
 * concatenated with the name of the receiver. If such a port does not
 * exists it is created.
 * 
 * @param receiver
 *            The identifier of the Ibis that will receive the message.
 * @param receiverPort
 *            The name of the port.
 * @return A new WriteMessage object constructed for the parameters of the
 *         method.
 * @throws IOException
 */
public WriteMessage getMessageToSend(IbisIdentifier receiver,
		String receiverPort) throws IOException {

	SendPort port = null;

	String nameSenderPort = receiverPort + receiver.name();
	if (!senderPorts.containsKey(nameSenderPort)) {
		synchronized (NetworkLayer.class) {
			if (!senderPorts.containsKey(nameSenderPort)) {
				PortType type = null;
				if (receiverPort.equals(queryReceiverPort)) {
					type = queryAnswerPortType;
				} else if (receiverPort.equals(nameMgmtReceiverPort)) {
					type = mgmtRequestPortType;
				} else if (receiverPort.equals(nameBcstReceiverPort)) {
					type = broadcastPortType;
				} else {
					type = requestPortType;
				}
				startSenderPort(type, nameSenderPort, receiver,
						receiverPort);
			}
		}
	}
	port = senderPorts.get(nameSenderPort);
	WriteMessage w = port.newMessage();
	timers.put(nameSenderPort, System.currentTimeMillis());
	return w;
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:43,代码来源:NetworkLayer.java

示例8: finishMessage

import ibis.ipl.SendPort; //导入依赖的package包/类
/**
 * Finishes sending the message msg and adds at the counters informations
 * about the sending time and the bytes that were sent.
 * 
 * @param msg
 *            The message that was sent.
 * @param submissionId
 *            The subbmission id.
 * @throws IOException
 */
public void finishMessage(WriteMessage msg, int submissionId)
		throws IOException {
	SendPort p = msg.localPort();
	long bytes = msg.finish();
	long startTime = timers.get(p.name());
	stats.addCounter(0, submissionId,
			"NetworkLayer: time sending msgs (ms)",
			System.currentTimeMillis() - startTime);
	stats.addCounter(0, submissionId, "NetworkLayer: bytes sent", bytes);
	// stats.addCounter(0, submissionId, "Messages sent", 1);
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:22,代码来源:NetworkLayer.java


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