@Override public void tick(long now) { if (now - this.initiatedTime >= STOP_TIMER_TIMEOUT) { if (this.aspFactoryImpl.association.isConnected()) { logger.warn(String .format("Asp=%s was stopped but underlying Association=%s was not stopped after TIMEOUT=%d ms. Forcing stop now", this.aspFactoryImpl.getName(), this.aspFactoryImpl.association.getName(), STOP_TIMER_TIMEOUT)); try { this.aspFactoryImpl.transportManagement.stopAssociation(this.aspFactoryImpl.association.getName()); } catch (Exception e) { logger.error(String.format("Exception while trying to stop Association=%s", this.aspFactoryImpl.association.getName())); } } // Finally cancel this.cancel(); }// if(now-this.initiatedTime >= STOP_TIMER_TIMEOUT) }
public void onNewRemoteConnection(Server globalServer, Association association, SCTPServerConnection connection) { logger.debug("New remote connection"); try { final String peerAddress = association.getPeerAddress(); final int peerPort = association.getPeerPort(); final String localAddress = association.getHostAddress(); final int localPort = association.getHostPort(); SCTPServerConnection remoteClientConnection = new SCTPServerConnection(null, InetAddress.getByName(peerAddress), peerPort, InetAddress.getByName(localAddress), localPort, parser, null, this, globalServer, association, connection.getManagement()); notifyListeners(remoteClientConnection); } catch (Exception exc) { logger.error("Error creating new remote connection"); } }
protected void unsetAssociation() throws Exception { if (this.association != null) { if (this.association.isStarted()) { throw new Exception(String.format("Association=%s is still started. Stop first", this.association.getName())); } this.association.setAssociationListener(null); this.association = null; } }
protected void setAssociation(Association association) { // Unset the listener to previous association if (this.association != null) { this.association.setAssociationListener(null); } this.association = association; this.associationName = this.association.getName(); // Set the listener for new association this.association.setAssociationListener(this); }
Association asso = associations.get(s); sb.append(M3UAOAMMessages.NEW_LINE); sb.append("ASSOCIATION ").append(asso.getIpChannelType().getType()).append(" name=").append(asso.getName()) .append(" started=").append(asso.isStarted()).append(" peerIp=").append(asso.getPeerAddress()) .append(" peerPort=").append(asso.getPeerPort()); if (asso.getAssociationType() == AssociationType.CLIENT) { sb.append(" hostIp=").append(asso.getHostAddress()).append(" hostPort=").append(asso.getHostPort()); } else { sb.append(" server=").append(asso.getServerName()); sb.append(" type=").append(asso.getAssociationType()); String[] secondaryHostAdd = asso.getExtraHostAddresses();
if (a.getName().equals(serverAssociationName)) { serverAssociation = a; break; serverAssociation.setAssociationListener(new ServerAssociationListener()); this.management.startAssociation(serverAssociationName); if (!server.isStarted()) { new Object[] { serverAssociation.getHostAddress(), serverAssociation.getHostPort(), serverAssociation.getPeerAddress(), serverAssociation.getPeerPort() }); logger.debug("Server Association Status: Started[{}] Connected[{}] Up[{}] ", new Object[]{serverAssociation.isStarted(), serverAssociation.isConnected(), serverAssociation.isUp()}); logger.trace("Server Association [{}]", serverAssociation);
@Override public String getName() { return this.wrappedAssociation.getName(); }
Association associationTemp = n.getValue(); if (peerAddress.equals(associationTemp.getPeerAddress()) && associationTemp.getPeerPort() == peerPort) { throw new Exception(String.format("Already has association=%s with same peer address=%s and port=%d", associationTemp.getName(), peerAddress, peerPort));
protected void stop() throws Exception { FastList<String> tempAssociations = associations; for (FastList.Node<String> n = tempAssociations.head(), end = tempAssociations.tail(); (n = n.getNext()) != end;) { String assocName = n.getValue(); Association associationTemp = this.management.getAssociation(assocName); if (associationTemp.isStarted()) { throw new Exception(String.format("Stop all the associations first. Association=%s is still started", associationTemp.getName())); } } synchronized (this.anonymAssociations) { // stopping all anonymous associations for (Association ass : this.anonymAssociations) { ass.stopAnonymousAssociation(); } this.anonymAssociations.clear(); } this.started = false; if (logger.isInfoEnabled()) { logger.info(String.format("Stoped Server=%s", this.name)); } // Stop underlying channel and wait till its done if (this.getIpChannel() != null) { try { this.getIpChannel().close().sync(); } catch (Exception e) { logger.warn(String.format("Error while stopping the Server=%s", this.name), e); } } }
for (FastMap.Entry<String, Association> n = associationsTemp.head(), end = associationsTemp.tail(); (n = n.getNext()) != end;) { Association associationTemp = n.getValue(); if (associationTemp.isStarted()) { ((AssociationImpl) associationTemp).stop(); for (FastMap.Entry<String, Association> n = this.associations.head(), end = this.associations.tail(); (n = n.getNext()) != end;) { Association associationTemp = n.getValue(); if (associationTemp.isConnected()) { assConnected = true; break;
@Override public CurrentAlarmList getCurrentAlarmList() { CurrentAlarmListImpl al = new CurrentAlarmListImpl(); if (wrappedSctpManagement.isStarted()) { Map<String, Association> lstAss = wrappedSctpManagement.getAssociations(); for (Association ass : lstAss.values()) { if (ass.isStarted()) { if (!ass.isConnected()) { AlarmMessage alm = this.generateAssociationAlarm(ass, false, true, ""); this.alc.prepareAlarm(alm); al.addAlarm(alm); } int congLevel = ass.getCongestionLevel(); if (congLevel > 0) { AlarmMessage alm = this.generateCongestionAlarm(ass, congLevel, false, true, ""); this.alc.prepareAlarm(alm); al.addAlarm(alm); } } } } return al; }
if (association.isStarted()) { throw new Exception(String.format("Association name=%s is started. Stop before removing", assocName)); for (FastList.Node<Server> n = this.servers.head(), end = this.servers.tail(); (n = n.getNext()) != end;) { Server serverTemp = n.getValue(); if (serverTemp.getName().equals(association.getServerName())) { FastList<String> newAssociations2 = new FastList<String>(); newAssociations2.addAll(((NettyServerImpl) serverTemp).associations);
@Override public boolean isStarted() { return this.wrappedAssociation.isStarted(); }
boolean isConnected() { if (remoteClientAssociation == null) { return false; } return this.remoteClientAssociation.isConnected(); } }
protected void write(M3UAMessage message) { try { ByteBufAllocator byteBufAllocator = this.association.getByteBufAllocator(); ByteBuf byteBuf; if (byteBufAllocator != null) { this.association.send(payloadData); int congLevel = this.association.getCongestionLevel(); if (message instanceof PayloadData) { PayloadData payloadData2 = (PayloadData) message; this.association.send(payloadData);
if (association.isStarted()) { throw new Exception(String.format(M3UAOAMMessages.ASSOCIATION_IS_STARTED, associationName)); if (association.getAssociationListener() != null) { throw new Exception(String.format(M3UAOAMMessages.ASSOCIATION_IS_ASSOCIATED, associationName));
@Override public int getHostPort() { return this.wrappedAssociation.getHostPort(); }
@Override public int getPeerPort() { return this.wrappedAssociation.getPeerPort(); }
@Override public String getPeerAddress() { return this.wrappedAssociation.getPeerAddress(); }
@Override public String getHostAddress() { return this.wrappedAssociation.getHostAddress(); }