Package com.aelitis.azureus.core.networkmanager.impl.tcp

Examples of com.aelitis.azureus.core.networkmanager.impl.tcp.VirtualChannelSelectorImpl$RegistrationData


   
    if( SAFE_SELECTOR_MODE_ENABLED ) {
      initSafeMode();
    }
    else {
      selector_impl = new VirtualChannelSelectorImpl( this, op, pause, randomise_keys );
      selectors = null;
      selectors_keyset_cow  = null;
      selectors_mon = null;
    }
  }
View Full Code Here


    }
   
    selector_impl = null;
    selectors = new HashMap<VirtualChannelSelectorImpl,ArrayList<AbstractSelectableChannel>>();
    selectors_mon = new AEMonitor( "VirtualChannelSelector:FM" );
    selectors.put( new VirtualChannelSelectorImpl( this, op, pause, randomise_keys ), new ArrayList<AbstractSelectableChannel>() );
    selectors_keyset_cow = new HashSet<VirtualChannelSelectorImpl>( selectors.keySet());
  }
View Full Code Here

    if( SAFE_SELECTOR_MODE_ENABLED ) {
      tryselectors_mon.enter();
        //System.out.println( "register - " + channel.hashCode()  + " - " + Debug.getCompressedStackTrace());
        for( Map.Entry<VirtualChannelSelectorImpl, ArrayList<AbstractSelectableChannel>> entry: selectors.entrySet()) {
             
          VirtualChannelSelectorImpl       sel     = entry.getKey();
          ArrayList<AbstractSelectableChannel>   channels   = entry.getValue();
         
          if( channels.size() >= ( TEST_SAFE_MODE?0:MAX_CHANNELS_PER_SAFE_SELECTOR )) {
           
             // it seems that we have a bug somewhere where a selector is being registered
            // but not cancelled on close. As an interim fix scan channels and remove any
            // closed ones
           
            Iterator<AbstractSelectableChannel>  chan_it = channels.iterator();
           
            while( chan_it.hasNext()){
             
              AbstractSelectableChannel  chan = chan_it.next();
             
              if ( !chan.isOpen()){
               
                Debug.out( "Selector '" + getName() + "' - removing orphaned safe channel registration" );
               
                chan_it.remove();
              }
            }
          }
         
          if( channels.size() < MAX_CHANNELS_PER_SAFE_SELECTOR ) {  //there's room in the current selector 

            sel.register( channel, listener, attachment );
            channels.add( channel );
           
            return;
          }
        }
       
        //we couldnt find room in any of the existing selectors, so start up a new one if allowed
       
        //max limit to the number of Selectors we are allowed to create
        if( selectors.size() >= MAX_SAFEMODE_SELECTORS ) {
          String msg = "Error: MAX_SAFEMODE_SELECTORS reached [" +selectors.size()+ "], no more socket channels can be registered. Too many peer connections.";
          Debug.out( msg );
          selectFailure( listener, channel, attachment, new Throwable( msg ) )//reject registration       
          return;
        }
       
        if ( destroyed ){
          String  msg = "socket registered after controller destroyed";
           Debug.out( msg );
          selectFailure( listener, channel, attachment, new Throwable( msg ) )//reject registration       
          return;
        }

        VirtualChannelSelectorImpl sel = new VirtualChannelSelectorImpl( this, op, pause , randomise_keys);
       
        ArrayList<AbstractSelectableChannel> chans = new ArrayList<AbstractSelectableChannel>();
       
        selectors.put( sel, chans );
       
        sel.register( channel, listener, attachment );
       
        chans.add( channel );
       
        selectors_keyset_cow = new HashSet<VirtualChannelSelectorImpl>( selectors.keySet());
      }
View Full Code Here

    if( SAFE_SELECTOR_MODE_ENABLED ) {
      tryselectors_mon.enter();
        //System.out.println( "pause - " + channel.hashCode() + " - " + Debug.getCompressedStackTrace());
      for( Map.Entry<VirtualChannelSelectorImpl, ArrayList<AbstractSelectableChannel>> entry: selectors.entrySet()) {
         
          VirtualChannelSelectorImpl       sel     = entry.getKey();
          ArrayList<AbstractSelectableChannel>   channels   = entry.getValue();
         
          if( channels.contains( channel ) ) {
            sel.pauseSelects( channel );
            return;
          }
        }
       
        Debug.out( "pauseSelects():: channel not found!" );
View Full Code Here

    if( SAFE_SELECTOR_MODE_ENABLED ) {
      tryselectors_mon.enter();
        //System.out.println( "resume - " + channel.hashCode() + " - " + Debug.getCompressedStackTrace());
      for( Map.Entry<VirtualChannelSelectorImpl, ArrayList<AbstractSelectableChannel>> entry: selectors.entrySet()) {
         
          VirtualChannelSelectorImpl       sel     = entry.getKey();
          ArrayList<AbstractSelectableChannel>   channels   = entry.getValue();
         
          if( channels.contains( channel ) ) {
            sel.resumeSelects( channel );
            return;
          }
        }
       
        Debug.out( "resumeSelects():: channel not found!" );
View Full Code Here

    if( SAFE_SELECTOR_MODE_ENABLED ) {
      tryselectors_mon.enter();
        //System.out.println( "cancel - " + channel.hashCode()  + " - " + Debug.getCompressedStackTrace());
      for( Map.Entry<VirtualChannelSelectorImpl, ArrayList<AbstractSelectableChannel>> entry: selectors.entrySet()) {
         
          VirtualChannelSelectorImpl       sel     = entry.getKey();
          ArrayList<AbstractSelectableChannel>   channels   = entry.getValue();
         
          if( channels.remove( channel ) ) {
            sel.cancel( channel );
            return;
          }
        }
      }
      finally{ selectors_mon.exit()}
View Full Code Here

            if (!result.hasIssues())
            {
               try
               {
                  log.debug("Attempting registration");
                  RegistrationData registrationData = persistentRegistrationInfo.getRegistrationData();
                  Holder<String> registrationHandle = new Holder<String>();
                  Holder<byte[]> registrationState = new Holder<byte[]>();

                  // invocation
                  persistentEndpointInfo.getRegistrationService().register(
                     registrationData.getConsumerName(),
                     registrationData.getConsumerAgent(),
                     registrationData.isMethodGetSupported(),
                     registrationData.getConsumerModes(),
                     registrationData.getConsumerWindowStates(),
                     registrationData.getConsumerUserScopes(),
                     registrationData.getCustomUserProfileData(),
                     registrationData.getRegistrationProperties(),
                     new Holder<List<Extension>>(),
                     registrationHandle,
                     registrationState
                  );
View Full Code Here

            if (!result.hasIssues())
            {
               try
               {
                  log.debug("Attempting registration");
                  RegistrationData registrationData = persistentRegistrationInfo.getRegistrationData();
                  Holder<String> registrationHandle = new Holder<String>();
                  Holder<byte[]> registrationState = new Holder<byte[]>();

                  // invocation
                  persistentEndpointInfo.getRegistrationService().register(
View Full Code Here

      @WebParam(mode = WebParam.Mode.OUT, name = "registrationState", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<byte[]> registrationState)
      throws V1MissingParameters, V1OperationFailed
   {
      try
      {
         RegistrationData registrationData = WSRPTypeFactory.createRegistrationData(consumerName, consumerAgent, methodGetSupported);

         if (ParameterValidation.existsAndIsNotEmpty(consumerModes))
         {
            registrationData.getConsumerModes().addAll(consumerModes);
         }
         if (ParameterValidation.existsAndIsNotEmpty(consumerWindowStates))
         {
            registrationData.getConsumerWindowStates().addAll(consumerWindowStates);
         }
         if (ParameterValidation.existsAndIsNotEmpty(consumerUserScopes))
         {
            registrationData.getConsumerUserScopes().addAll(consumerUserScopes);
         }
//      registrationData.getCustomUserProfileData().addAll(customUserProfileData);
         if (ParameterValidation.existsAndIsNotEmpty(registrationProperties))
         {
            registrationData.getRegistrationProperties().addAll(WSRPUtils.transform(registrationProperties, V1ToV2Converter.PROPERTY));
         }
         if (ParameterValidation.existsAndIsNotEmpty(extensions.value))
         {
            registrationData.getExtensions().addAll(WSRPUtils.transform(extensions.value, V1ToV2Converter.EXTENSION));
         }

         RegistrationContext registrationContext = producer.register(registrationData);
         registrationHandle.value = registrationContext.getRegistrationHandle();
         registrationState.value = registrationContext.getRegistrationState();
View Full Code Here

      @WebParam(mode = WebParam.Mode.OUT, name = "registrationState", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<byte[]> registrationState)
      throws V1MissingParameters, V1OperationFailed
   {
      try
      {
         RegistrationData registrationData = WSRPTypeFactory.createRegistrationData(consumerName, consumerAgent, methodGetSupported);

         if (ParameterValidation.existsAndIsNotEmpty(consumerModes))
         {
            registrationData.getConsumerModes().addAll(consumerModes);
         }
         if (ParameterValidation.existsAndIsNotEmpty(consumerWindowStates))
         {
            registrationData.getConsumerWindowStates().addAll(consumerWindowStates);
         }
         if (ParameterValidation.existsAndIsNotEmpty(consumerUserScopes))
         {
            registrationData.getConsumerUserScopes().addAll(consumerUserScopes);
         }
//      registrationData.getCustomUserProfileData().addAll(customUserProfileData);
         if (ParameterValidation.existsAndIsNotEmpty(registrationProperties))
         {
            registrationData.getRegistrationProperties().addAll(WSRPUtils.transform(registrationProperties, V1ToV2Converter.PROPERTY));
         }
         if (ParameterValidation.existsAndIsNotEmpty(extensions.value))
         {
            registrationData.getExtensions().addAll(WSRPUtils.transform(extensions.value, V1ToV2Converter.EXTENSION));
         }

         RegistrationContext registrationContext = producer.register(WSRPTypeFactory.createRegister(registrationData, null, null));
         registrationHandle.value = registrationContext.getRegistrationHandle();
         registrationState.value = registrationContext.getRegistrationState();
View Full Code Here

TOP

Related Classes of com.aelitis.azureus.core.networkmanager.impl.tcp.VirtualChannelSelectorImpl$RegistrationData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.