Пример #1
0
  @Override
  public synchronized void join(
      String theClientName, ObjectReceiver theClient, String theApplicationName) {
    try {
      Tracer.info(this, "Entering Session Join");
      SessionJoinInformationUpdated.newCase(
          CommunicatorSelector.getProcessName(), theClientName, theApplicationName, myName, this);
      JoinInfo retVal = new JoinInfo();
      retVal.newSession = clients.size() == 0;
      ProcessGroup processGroupRemote = multicastGroups.get(theApplicationName);
      ProcessGroupLocal procesGroupLocal = localProcessGroups.get(theApplicationName);
      retVal.newApplication = processGroupRemote == null;

      if (processGroupRemote == null) {
        MulticastGroupCreated.newCase(CommunicatorSelector.getProcessName(), myName, this);
        AProcessGroup processGroup = new AProcessGroup(myName, theApplicationName, null);
        procesGroupLocal = processGroup;
        addSessionListenerLocal(procesGroupLocal);
        processGroupRemote = (ProcessGroup) UnicastRemoteObject.exportObject(processGroup, 0);
        multicastGroups.put(theApplicationName, processGroupRemote);
        localProcessGroups.put(theApplicationName, procesGroupLocal);
      }
      clients.put(theClient, theClientName);
      addSessionListener(theClient);
      notifyClientJoinedRemote(
          processGroupRemote,
          toSerializedProcesstGroups(),
          clients,
          myName,
          theClientName,
          theClient,
          theApplicationName,
          retVal.newSession,
          retVal.newApplication);
      notifyClientJoinedLocal(
          procesGroupLocal,
          toSerializedProcesstGroups(),
          clients,
          myName,
          theClientName,
          theClient,
          theApplicationName,
          retVal.newSession,
          retVal.newApplication);
      Tracer.info(this, "Leaving Session Join");
      // why was this commented out?
      ServerClientJoined.newCase(
          CommunicatorSelector.getProcessName(), theClientName, theApplicationName, myName, this);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return;
  }
Пример #2
0
 @Override
 public void leave(String theClientName, ObjectReceiver theClient, String theApplicationName) {
   SessionLeaveInformationUpdated.newCase(
       CommunicatorSelector.getProcessName(), theClientName, theApplicationName, myName, this);
   clients.remove(theClient);
   removeSessionListener(theClient);
   notifyClentLeftRemote(theClientName, theClient, theApplicationName);
   //		ServerClientLeft.newCase(ACommunicatorSelector.getProcessName(), theClientName,
   // theApplicationName, myName, this);
 }