/** @generated */ public void connectPort(final org.omg.CORBA.Object connection, final String connectionId) throws CF.PortPackage.InvalidPort, CF.PortPackage.OccupiedPort { if (logger != null) { logger.trace("bulkio.OutPort connectPort ENTER (port=" + name + ")"); } synchronized (this.updatingPortsLock) { final dataOctetOperations port; try { port = BULKIO.jni.dataOctetHelper.narrow(connection); } catch (final Exception ex) { if (logger != null) { logger.error("bulkio.OutPort CONNECT PORT: " + name + " PORT NARROW FAILED"); } throw new CF.PortPackage.InvalidPort( (short) 1, "Invalid port for connection '" + connectionId + "'"); } this.outConnections.put(connectionId, port); this.active = true; this.stats.put(connectionId, new linkStatistics(this.name, new UInt8Size())); if (logger != null) { logger.debug("bulkio.OutPort CONNECT PORT: " + name + " CONNECTION '" + connectionId + "'"); } } if (logger != null) { logger.trace("bulkio.OutPort connectPort EXIT (port=" + name + ")"); } if (callback != null) { callback.connect(connectionId); } }
/** @generated */ public void disconnectPort(String connectionId) { if (logger != null) { logger.trace("bulkio.OutPort disconnectPort ENTER (port=" + name + ")"); } synchronized (this.updatingPortsLock) { boolean portListed = false; for (connection_descriptor_struct ftPtr : bulkio.utils.emptyIfNull(this.filterTable)) { if (ftPtr.port_name.getValue().equals(this.name)) { portListed = true; break; } } dataOctetOperations port = this.outConnections.remove(connectionId); if (port != null) { byte[] odata = new byte[0]; BULKIO.PrecisionUTCTime tstamp = bulkio.time.utils.notSet(); for (Map.Entry<String, SriMapStruct> entry : this.currentSRIs.entrySet()) { String streamID = entry.getKey(); if (entry.getValue().connections.contains(connectionId)) { if (portListed) { for (connection_descriptor_struct ftPtr : bulkio.utils.emptyIfNull(this.filterTable)) { if ((ftPtr.port_name.getValue().equals(this.name)) && (ftPtr.connection_id.getValue().equals(connectionId)) && (ftPtr.stream_id.getValue().equals(streamID))) { try { port.pushPacket(odata, tstamp, true, streamID); } catch (Exception e) { if (logger != null) { logger.error( "Call to pushPacket failed on port " + name + " connection " + connectionId); } } } } } else { try { port.pushPacket(odata, tstamp, true, streamID); } catch (Exception e) { if (logger != null) { logger.error( "Call to pushPacket failed on port " + name + " connection " + connectionId); } } } } } } this.stats.remove(connectionId); this.active = (this.outConnections.size() != 0); // Remove connectionId from any sets in the currentSRIs.connections values for (Map.Entry<String, SriMapStruct> entry : this.currentSRIs.entrySet()) { entry.getValue().connections.remove(connectionId); } if (logger != null) { logger.trace( "bulkio.OutPort DISCONNECT PORT:" + name + " CONNECTION '" + connectionId + "'"); for (Map.Entry<String, SriMapStruct> entry : this.currentSRIs.entrySet()) { logger.trace( "bulkio.OutPort updated currentSRIs key=" + entry.getKey() + ", value.sri=" + entry.getValue().sri + ", value.connections=" + entry.getValue().connections); } } } if (callback != null) { callback.disconnect(connectionId); } if (logger != null) { logger.trace("bulkio.OutPort disconnectPort EXIT (port=" + name + ")"); } }