@Override public void run() { final SessionID sessionID; try { try { sessionID = statefulSessionComponent.createSession(); } catch (Throwable t) { SessionOpenRequestHandler.this.writeException( channelAssociation, SessionOpenRequestHandler.this.marshallerFactory, invocationId, t, null); return; } // get the affinity of the component final Affinity hardAffinity = statefulSessionComponent.getCache().getStrictAffinity(); SessionOpenRequestHandler.this.writeSessionId( channelAssociation, invocationId, sessionID, hardAffinity); } catch (IOException ioe) { EjbLogger.ROOT_LOGGER.exceptionGeneratingSessionId( ioe, invocationId, channelAssociation.getChannel()); // close the channel IoUtils.safeClose(this.channelAssociation.getChannel()); return; } }
@Override public void deploymentRemoved(DeploymentModuleIdentifier deploymentModuleIdentifier) { try { this.sendModuleUnAvailability(new DeploymentModuleIdentifier[] {deploymentModuleIdentifier}); } catch (IOException e) { EjbLogger.ROOT_LOGGER.failedToSendModuleUnavailabilityMessageToClient( e, deploymentModuleIdentifier, channelAssociation.getChannel()); } }
@Override public void registryAdded(Registry<String, List<ClientMapping>> cluster) { try { EjbLogger.ROOT_LOGGER.debug( "Received new cluster formation notification for cluster " + cluster.getGroup().getName()); this.sendNewClusterFormedMessage(Collections.singleton(cluster)); } catch (IOException ioe) { EjbLogger.ROOT_LOGGER.failedToSendClusterFormationMessageToClient( ioe, cluster.getGroup().getName(), channelAssociation.getChannel()); } finally { // add a listener for receiving node(s) addition/removal from the cluster final ClusterTopologyUpdateListener clusterTopologyUpdateListener = new ClusterTopologyUpdateListener(cluster, this); cluster.addListener(clusterTopologyUpdateListener); // keep track of this update listener so that we cleanup properly this.clusterTopologyUpdateListeners.add(clusterTopologyUpdateListener); } }