protected void markAssociationDown() { this.up = false; for (ManagementEventListener lstr : this.management.getManagementEventListeners()) { try { lstr.onAssociationDown(this); } catch (Throwable ee) { logger.error("Exception while invoking onAssociationDown", ee); } } if (this.server != null) { synchronized (this.server.anonymAssociations) { this.server.anonymAssociations.remove(this); } } }
protected void start() throws Exception { if (this.associationListener == null) { throw new NullPointerException(String.format("AssociationListener is null for Associatoion=%s", this.name)); } if (this.type == AssociationType.CLIENT) { this.scheduleConnect(); } this.started = true; if (logger.isInfoEnabled()) { if (this.type != AssociationType.ANONYMOUS_SERVER) { logger.info(String.format("Started Association=%s", this)); } } for (ManagementEventListener lstr : this.management.getManagementEventListeners()) { try { lstr.onAssociationStarted(this); } catch (Throwable ee) { logger.error("Exception while invoking onAssociationStarted", ee); } } }
protected void stop() throws Exception { if (logger.isInfoEnabled()) { logger.info(String.format("Management requested to stop %s", this.toString())); } this.started = false; for (ManagementEventListener lstr : this.management.getManagementEventListeners()) { try { lstr.onAssociationStopped(this); } catch (Throwable ee) { logger.error("Exception while invoking onAssociationStopped", ee); } } NettySctpChannelInboundHandlerAdapter handler = this.channelHandler; if (handler != null) { handler.closeChannel(); } }
lstr.onAssociationAdded(association); } catch (Throwable ee) { logger.error("Exception while invoking onAssociationAdded", ee);
protected void markAssociationUp() { if (this.server != null) { synchronized (this.server.anonymAssociations) { this.server.anonymAssociations.add(this); } } this.up = true; for (ManagementEventListener lstr : this.management.getManagementEventListeners()) { try { lstr.onAssociationUp(this); } catch (Throwable ee) { logger.error("Exception while invoking onAssociationUp", ee); } } }
lstr.onServerRemoved(removeServer); } catch (Throwable ee) { logger.error("Exception while invoking onServerRemoved", ee);
lstr.onServiceStarted(); } catch (Throwable ee) { logger.error("Exception while invoking onServiceStarted", ee);
lstr.onAssociationRemoved(association); } catch (Throwable ee) { logger.error("Exception while invoking onAssociationRemoved", ee);
lstr.onRemoveAllResources(); } catch (Throwable ee) { logger.error("Exception while invoking onRemoveAllResources", ee);
lstr.onServerAdded(server); } catch (Throwable ee) { logger.error("Exception while invoking onServerAdded", ee);
lstr.onAssociationAdded(association); } catch (Throwable ee) { logger.error("Exception while invoking onAssociationAdded", ee);
protected void markAssociationUp(int maxInboundStreams, int maxOutboundStreams) { if (this.server != null) { synchronized (this.server.anonymAssociations) { this.server.anonymAssociations.add(this); } } this.up = true; this.getAssociationListener().onCommunicationUp(this, maxInboundStreams, maxOutboundStreams); for (ManagementEventListener lstr : this.management.getManagementEventListeners()) { try { lstr.onAssociationUp(this); } catch (Throwable ee) { logger.error("Exception while invoking onAssociationUp", ee); } } }
lstr.onServerRemoved(removeServer); } catch (Throwable ee) { logger.error("Exception while invoking onServerRemoved", ee);
lstr.onServiceStarted(); } catch (Throwable ee) { logger.error("Exception while invoking onServiceStarted", ee);
lstr.onAssociationRemoved(association); } catch (Throwable ee) { logger.error("Exception while invoking onAssociationRemoved", ee);
lstr.onRemoveAllResources(); } catch (Throwable ee) { logger.error("Exception while invoking onRemoveAllResources", ee);
lstr.onServerAdded(server); } catch (Throwable ee) { logger.error("Exception while invoking onServerAdded", ee);
lstr.onAssociationAdded(association); } catch (Throwable ee) { logger.error("Exception while invoking onAssociationAdded", ee);
protected void markAssociationDown() { if (this.up) { // To avoid calling Listener again and again this.up = false; for (ManagementEventListener lstr : this.management.getManagementEventListeners()) { try { lstr.onAssociationDown(this); } catch (Throwable ee) { logger.error("Exception while invoking onAssociationDown", ee); } } this.getAssociationListener().onCommunicationShutdown(this); if (this.server != null) { synchronized (this.server.anonymAssociations) { this.server.anonymAssociations.remove(this); } } } }
/** * Stops this Association. If the underlying SctpChannel is open, marks the * channel for close */ protected void stop() throws Exception { this.started = false; for (ManagementEventListener lstr : this.management.getManagementEventListeners()) { try { lstr.onAssociationStopped(this); } catch (Throwable ee) { logger.error("Exception while invoking onAssociationStopped", ee); } } if (this.getSocketChannel() != null && this.getSocketChannel().isOpen()) { FastList<ChangeRequest> pendingChanges = this.management.getPendingChanges(); synchronized (pendingChanges) { // Indicate we want the interest ops set changed pendingChanges.add(new ChangeRequest(getSocketChannel(), this, ChangeRequest.CLOSE, -1)); } // Finally, wake up our selecting thread so it can make the required // changes this.management.getSocketSelector().wakeup(); } }