Examples of AEThread


Examples of org.gudy.azureus2.core3.util.AEThread

  // @see org.gudy.azureus2.plugins.utils.resourcedownloader.ResourceDownloaderListener#completed(org.gudy.azureus2.plugins.utils.resourcedownloader.ResourceDownloader, java.io.InputStream)
  public boolean completed(ResourceDownloader downloader, InputStream data) {
    downloader.removeListener(this);
    if (!nextUpdate()) {
      // fire in another thread so completed function can exit
      AEThread thread = new AEThread("AllDownloadsComplete", true) {
        public void runSupport() {
          allDownloadsComplete();
        }
      };
      thread.start();
    }
    return true;
  }
View Full Code Here

Examples of org.gudy.azureus2.core3.util.AEThread

          if (path != null) {

            d_pathParameter.setValue(path);

            new AEThread("SoundTest") {
              public void runSupport() {
                try {
                  Applet.newAudioClip(new File(path).toURL()).play();

                  Thread.sleep(2500);

                } catch (Throwable e) {

                }
              }
            }.start();
          }
        }
      });

      Label d_sound_info = new Label(cArea, SWT.WRAP);
      Messages.setLanguageText(d_sound_info, INTERFACE_PREFIX
          + "wavlocation.info");
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.widthHint = 100;
      d_sound_info.setLayoutData(gridData);

      d_play_sound.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(
          d_pathParameter.getControls()));
      d_play_sound.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(
          new Control[] {
            d_browse,
            d_sound_info
          }));

      //
    }

    BooleanParameter f_play_sound = new BooleanParameter(cArea,
        "Play File Finished", LBLKEY_PREFIX + "playfilefinished");

    // OS X counterpart for alerts (see below for what is disabled)

    if (Constants.isOSX) {

      // per-file info

      gridData = new GridData();
      gridData.horizontalSpan = 3;
      gridData.widthHint = 0;
      gridData.heightHint = 0;
      Composite f_filler = new Composite(cArea, SWT.NONE);
      f_filler.setSize(0, 0);
      f_filler.setLayoutData(gridData);

      final BooleanParameter f_speechEnabledParameter = new BooleanParameter(
          cArea, "Play File Finished Announcement", LBLKEY_PREFIX
              + "playfilespeech");

      final StringParameter f_speechParameter = new StringParameter(cArea,
          "Play File Finished Announcement Text");
      gridData = new GridData();
      gridData.horizontalSpan = 3;
      gridData.widthHint = 150;
      f_speechParameter.setLayoutData(gridData);
      ((Text) f_speechParameter.getControl()).setTextLimit(40);

      f_speechEnabledParameter.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(
          f_speechParameter.getControls()));

      final Label speechInfo = new Label(cArea, SWT.NONE);
      gridData = new GridData();
      gridData.horizontalSpan = 4;
      gridData.horizontalIndent = 24;
      speechInfo.setLayoutData(gridData);

      Messages.setLanguageText(speechInfo, LBLKEY_PREFIX
          + "playfilespeech.info");
    }

    //Option disabled on OS X, as impossible to make it work correctly
    if (!Constants.isOSX) {

      // file info

      gridData = new GridData(GridData.FILL_HORIZONTAL);

      final StringParameter f_pathParameter = new StringParameter(cArea,
          "Play File Finished File", "");

      if (f_pathParameter.getValue().length() == 0) {

        f_pathParameter.setValue("<default>");
      }

      f_pathParameter.setLayoutData(gridData);

      Button f_browse = new Button(cArea, SWT.PUSH);

      f_browse.setImage(imgOpenFolder);

      imgOpenFolder.setBackground(f_browse.getBackground());

      f_browse.setToolTipText(MessageText.getString("ConfigView.button.browse"));

      f_browse.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
          FileDialog dialog = new FileDialog(parent.getShell(),
              SWT.APPLICATION_MODAL);
          dialog.setFilterExtensions(new String[] { "*.wav"
          });
          dialog.setFilterNames(new String[] { "*.wav"
          });

          dialog.setText(MessageText.getString(INTERFACE_PREFIX + "wavlocation"));

          final String path = dialog.open();

          if (path != null) {

            f_pathParameter.setValue(path);

            new AEThread("SoundTest") {
              public void runSupport() {
                try {
                  Applet.newAudioClip(new File(path).toURL()).play();

                  Thread.sleep(2500);
View Full Code Here

Examples of org.gudy.azureus2.core3.util.AEThread

       
        final int test_mode = NetworkAdminSpeedTester.TEST_TYPES[testCombo.getSelectionIndex()];
        final boolean encState = encryptToggle.getSelection();

        Thread t =
      new AEThread("SpeedTest Performer")
      {
        public void
        runSupport()
        {

                    runTest(test_mode, encState);
        }
      };
   
    t.setPriority(Thread.MIN_PRIORITY);
    t.setDaemon(true);
    t.start();
  }
View Full Code Here

Examples of org.gudy.azureus2.core3.util.AEThread

      link_area.addLine( MessageText.getString( "installPluginsWizard.details.loading"));
    
        final StandardPlugin plugin = (StandardPlugin) selected_item.getData();
       
       
        AEThread detailsLoader = new AEThread("Detail Loader") {
          public void runSupport() {          
           final String description = HTMLUtils.convertListToString(HTMLUtils.convertHTMLToText(plugin.getDescription(),""));
           wizard.getDisplay().asyncExec(new AERunnable() {
            public void runSupport() {
              if(pluginList == null || pluginList.isDisposed() || pluginList.getSelectionCount() ==0)
                return;
              if(pluginList.getSelection()[0] != selected_item)
                return;
          
              link_area.reset();
             
              link_area.setRelativeURLBase( plugin.getRelativeURLBase());
             
              link_area.addLine(description);
            }
            });
          }
        };
       
        detailsLoader.setDaemon(true);
        detailsLoader.start();
    }
View Full Code Here

Examples of org.gudy.azureus2.core3.util.AEThread

     
      accept_server = VirtualServerChannelSelectorFactory.createBlocking( address, 0, this );
     
      accept_server.start();
         
      AEThread  read_thread =
        new AEThread( "TRTrackerServer:readSelector")
        {
          public void
          runSupport()
          {
            selectLoop( read_selector );
          }
        };
       
      read_thread.setDaemon(true);
       
      read_thread.start();
       
      AEThread  write_thread =
        new AEThread( "TRTrackerServer:writeSelector")
        {
          public void
          runSupport()
          {
            selectLoop( write_selector );
          }
        };
       
      write_thread.setDaemon(true);
       
      write_thread.start();
     
      AEThread  close_thread =
        new AEThread( "TRTrackerServer:closeScheduler")
        {
          public void
          runSupport()
          {
            closeLoop();
          }
        };
       
      close_thread.setDaemon(true);
       
      close_thread.start();
     
      Logger.log(new LogEvent(LOGID,
          "TRTrackerServer: Non-blocking listener established on port "
              + getPort()));
View Full Code Here

Examples of org.gudy.azureus2.core3.util.AEThread

     * @throws IllegalArgumentException
     */
  protected final Object /*NSAppleEventDescriptor*/ executeScriptWithNewThread(
    final String scriptFormat, final Object[] params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
  {
    Thread worker = new AEThread("ScriptObject", true) {
      public void runSupport() {
        try {
          int pool = NSAutoreleasePool_push();
          long start = System.currentTimeMillis();

          String src;
          if (params == null || params.length == 0) {
            src = scriptFormat;
          } else {
            src = MessageFormat.format(scriptFormat, params);
          }   

          Debug.outNoStack("Executing: \n" + src);

          Object /*NSMutableDictionary*/ errorInfo = new_NSMutableDictionary();
          if (NSAppleScript_execute(new_NSAppleScript(src), errorInfo) == null) {
            Debug.out(String.valueOf(NSMutableDictionary_objectForKey(errorInfo, NSAppleScript_AppleScriptErrorMessage)));
            //logWarning(String.valueOf(errorInfo.objectForKey(NSAppleScript.AppleScriptErrorBriefMessage)));
          }

          Debug.outNoStack(MessageFormat.format("Elapsed time: {0}ms\n",
              new Object[] {
                new Long(System.currentTimeMillis() - start)
              }));
          NSAutoreleasePool_pop(pool);
        } catch (Throwable e) {
          Debug.out(e);
        }
      }
    };

    worker.setPriority(Thread.NORM_PRIORITY - 1);
    worker.start();

    return methNSAppleEventDescriptor_descriptorWithBoolean.invoke(null, true);
    //return NSAppleEventDescriptor.descriptorWithBoolean(true);
  }
View Full Code Here

Examples of org.gudy.azureus2.core3.util.AEThread

          Debug.out(t);
        }
      }
    };

        AEThread t = new AEThread("ScriptObject", true)
        {
            public void runSupport()
            {
                scriptDispatcher.exec(worker);
            }
        };
        t.setPriority(Thread.NORM_PRIORITY - 1);
        t.start();

        return methNSAppleEventDescriptor_descriptorWithBoolean.invoke(null, true);
        //return NSAppleEventDescriptor.descriptorWithBoolean(true);
    }
View Full Code Here

Examples of org.gudy.azureus2.core3.util.AEThread

            ssl_server_socket.setReuseAddress(true);
                           
            server_socket = ssl_server_socket;
           
            Thread accept_thread =
                new AEThread("TRTrackerServer:accept.loop(ssl)")
                {
                  public void
                  runSupport()
                  {
                    acceptLoop( server_socket );
                  }
                };
         
            accept_thread.setDaemon( true );
         
            accept_thread.start();                 
         
            Logger.log(new LogEvent(LOGID,
                "TRTrackerServer: SSL listener established on port "
                    + getPort()));
           
            ok  = true;
          }
         
        }catch( Throwable e){
                 
          Logger.logTextResource(new LogAlert(LogAlert.UNREPEATABLE,
              LogAlert.AT_ERROR, "Tracker.alert.listenfail"), new String[] { ""
              + getPort() });
         
          Logger.log(new LogEvent(LOGID,
              "TRTrackerServer: SSL listener failed on port " + getPort(), e));
           
          if ( e instanceof TRTrackerServerException ){
           
            throw((TRTrackerServerException)e);
           
          }else{
           
            throw( new TRTrackerServerException( "TRTrackerServer: accept fails: " + e.toString()));
          }
        }
       
      }else{
       
        try{
          ServerSocket ss;
         
          int  port = getPort();
         
          if ( _bind_ip != null ){
         
            current_bind_ip = _bind_ip;
           
            ss = new ServerSocketport, 1024, _bind_ip );

          }else if ( bind_ip == null ){
           
            ss = new ServerSocketport, 1024 );
           
          }else{
           
            current_bind_ip = bind_ip;
           
            ss = new ServerSocketport, 1024, bind_ip );
          }
         
          if ( port == 0 ){
           
            setPort( ss.getLocalPort());
          }
         
          ss.setReuseAddress(true);
         
          server_socket = ss;
         
          Thread accept_thread =
              new AEThread("TRTrackerServer:accept.loop")
              {
                public void
                runSupport()
                {
                  acceptLoop( server_socket );
                }
              };
       
          accept_thread.setDaemon( true );
       
          accept_thread.start();                 
       
          Logger.log(new LogEvent(LOGID, "TRTrackerServer: "
              + "listener established on port " + getPort()));
         
          ok  = true;
View Full Code Here

Examples of org.gudy.azureus2.core3.util.AEThread

    }
   
    final String    f_category  = category;
    final String    f_props    = props;
   
    new AEThread( "shareFile" )
    {
      public void
      runSupport()
      {
        try{
View Full Code Here

Examples of org.gudy.azureus2.core3.util.AEThread

        {
          public void
          initializationComplete()
          {
            Thread  t  =
              new AEThread("test")
              {
                public void
                runSupport()
                {
                 
                  testBTMessageHandler();
 
                }
              };
             
            t.setDaemon(true);
           
            t.start();
          }
         
          public void
          closedownInitiated()
          { 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.