void openPorts(IbisIdentifier master) throws IOException { receiver = parent.ibis.createReceivePort(Rubiks.portType, "worker", this); receiver.enableConnections(); receiver.enableMessageUpcalls(); sender = parent.ibis.createSendPort(Rubiks.portType); sender.connect(master, "master"); }
public MultiNameResolver(MultiIbis multiIbis, String ibisName) throws IOException { this.ibis = multiIbis; this.ibisName = ibisName; ibis.resolverMap.put(ibisName, this); Ibis subIbis = ibis.subIbisMap.get(ibisName); requestListenPort = subIbis.createReceivePort(MultiIbis.resolvePortType, resolvePortName); requestListenPort.enableConnections(); replyListenPort = subIbis.createReceivePort(MultiIbis.resolvePortType, replyPortName); replyListenPort.enableConnections(); replyPort = subIbis.createSendPort(MultiIbis.resolvePortType); requestPort = subIbis.createSendPort(MultiIbis.resolvePortType); if (logger.isDebugEnabled()) { logger.debug("Started MultiNameResolver for: " + ibisName); } ThreadPool.createNew(new RequestHandler(), "Request Listener: " + ibisName); ThreadPool.createNew(new ReplyHandler(), "Reply Listener: " + ibisName); }
public void shutdown() throws IOException { // Close the ports try { sender.close(); receiver.close(); } catch (ConnectionClosedException e) { // do nothing } // Notify the main thread synchronized (this) { this.notify(); } }