protected void killConnections(ibis.ipl.IbisIdentifier corpse) { SendPort[] sps; ReceivePort[] rps; synchronized (this) { sps = sendPorts.values().toArray(new SendPort[sendPorts.size()]); rps = receivePorts.values().toArray(new ReceivePort[receivePorts.size()]); } for (SendPort s : sps) { try { s.killConnectionsWith(corpse); } catch (Throwable e) { if (logger.isDebugEnabled()) { logger.debug("Got exception from killConnectionsWith", e); } } } for (ReceivePort p : rps) { try { p.killConnectionsWith(corpse); } catch (Throwable e) { if (logger.isDebugEnabled()) { logger.debug("Got exception from killConnectionsWith", e); } } } }
synchronized void deRegister(SendPort p) { if (sendPorts.remove(p.name) != null) { // add statistics for this sendport to "total" statistics outgoingMessageCount += p.getMessageCount(); bytesSent += p.getBytesSent(); bytesWritten += p.getBytesWritten(); } }
public synchronized long getBytesWritten() { long bytesWritten = this.bytesWritten; // also add numbers for current send ports for (SendPort sendPort : sendPorts.values()) { bytesWritten += sendPort.getBytesWritten(); } return bytesWritten; }
public synchronized long getOutgoingMessageCount() { long outgoingMessageCount = this.outgoingMessageCount; // also add numbers for current send ports for (SendPort sendPort : sendPorts.values()) { outgoingMessageCount += sendPort.getMessageCount(); } return outgoingMessageCount; }
/** @ibis.experimental */ public synchronized ibis.ipl.IbisIdentifier[] connectedTo() { HashSet<ibis.ipl.IbisIdentifier> result = new HashSet<ibis.ipl.IbisIdentifier>(); Collection<SendPort> ports = sendPorts.values(); for (SendPort sendPort : ports) { ibis.ipl.ReceivePortIdentifier[] receivePorts = sendPort.connectedTo(); for (ibis.ipl.ReceivePortIdentifier receivePort : receivePorts) { result.add(receivePort.ibisIdentifier()); } } return result.toArray(new ibis.ipl.IbisIdentifier[0]); }
public Object getReplacement() { Object ret = null; if (direction != null) { if (direction.equals("out")) { SendPort sp = new SendPort(); sp.name = name; ret = sp; } else if (direction.equals("in")) { ReceivePort rp = new ReceivePort(); rp.name = name; ret = rp; } } return ret; }
/** @ibis.experimental */ public synchronized Map<ibis.ipl.IbisIdentifier, Set<String>> getSenderConnectionTypes() { Map<ibis.ipl.IbisIdentifier, Set<String>> result = new HashMap<ibis.ipl.IbisIdentifier, Set<String>>(); for (SendPort port : sendPorts.values()) { Map<IbisIdentifier, Set<String>> p = port.getConnectionTypes(); for (Entry<IbisIdentifier, Set<String>> entry : p.entrySet()) { Set<String> r = result.get(entry.getKey()); if (r == null) { r = new HashSet<String>(); } r.addAll(entry.getValue()); result.put(entry.getKey(), r); } } return result; }