コード例 #1
0
  void _pickInitial() throws MongoException {
    if (_curAddress != null) return;

    // we need to just get a server to query for ismaster
    _pickCurrent();

    try {
      _logger.info("current address beginning of _pickInitial: " + _curAddress);

      DBObject im = isMasterCmd();
      if (_isMaster(im)) return;

      synchronized (_allHosts) {
        Collections.shuffle(_allHosts);
        for (ServerAddress a : _allHosts) {
          if (_curAddress == a) continue;

          _logger.info("remote [" + _curAddress + "] -> [" + a + "]");
          _set(a);

          im = isMasterCmd();
          if (_isMaster(im)) return;

          _logger.severe("switched to: " + a + " but isn't master");
        }

        throw new MongoException("can't find master");
      }
    } catch (Exception e) {
      _logger.log(Level.SEVERE, "can't pick initial master, using random one", e);
    }
  }
コード例 #2
0
ファイル: h4Jmf.java プロジェクト: jkoppel/javaparser-to-hs
  public void player_begin(URL url) {
    if (h4JmfPlugin.playMP3 != null) {
      logger.severe("playMP3!=null");
      h4JmfPlugin.cnsl.append("playMP3!=null");
      return;
    }
    if (url == null) {
      h4JmfPlugin.cnsl.append("url==null");
      return;
    }
    MediaLocator mediaLocator = new MediaLocator(url);
    try {
      // final JPanel jpnl_this=this;

      DataSource ds = Manager.createDataSource(mediaLocator);
      // cnsl.append("ds="+ds);
      h4JmfPlugin.playMP3 = Manager.createPlayer(ds);
      /**
       * ********************************************************** ControllerListener moved to
       * outer class addControllerListener done in h4JmfPlugin **********************************
       */
      h4JmfPlugin.player_begin();
    } catch (Exception e) {
      logger.severe(e.getMessage());
      h4JmfPlugin.cnsl.append(e);
      return;
    }
    // h4JmfPlugin.playMP3.realize();
    // logger.info("after realize()");
    // but possible [JMF thread: com.sun.media.PlaybackEngine@1ac13d7[
    // com.sun.media.PlaybackEngine@1ac13d7 ] ( realizeThread)] [error] PlaybackEngine@1ac13d7 ] (
    // realizeThread):   Unable to handle format: mpeglayer3, 16000.0 Hz, 16-bit, Mono,
    // LittleEndian, Signed, 2000.0 frame rate, FrameSize=16384 bits
    // running tshvr under hedwig :11:17:08 PM [JMF thread:
    // com.sun.media.content.unknown.Handler@8c7be5 ( prefetchThread)] [error] Handler@8c7be5 (
    // prefetchThread): Error: Unable to prefetch com.sun.media.PlaybackEngine@6d3b92
  } // player_begin
コード例 #3
0
ファイル: PBVCPlugin.java プロジェクト: vohoaiviet/placecomm
  private long InstancesCount() {

    String sIname = ClassNameTF.getText().trim();
    long lNumberOfInstance = 0;
    if (sIname.length() > 0) {
      String sClassName = ClassNameTF.getText();
      try {
        Cls cls = kb.getCls(sClassName);
        Collection colInstances = kb.getInstances(cls);
        lNumberOfInstance = colInstances.size();
      } catch (Exception e) {
        theLogger.severe("Class not found");
      }

    } else {
      try {
        Collection colInstances = kb.getInstances();
        lNumberOfInstance = colInstances.size();
      } catch (Exception e) {
        theLogger.severe("Class not found");
      }
    }
    return lNumberOfInstance;
  }
コード例 #4
0
ファイル: h4Jmf.java プロジェクト: jkoppel/javaparser-to-hs
  public void chooseFile() {
    if (!h4JmfPlugin.jmf_ok) return;
    if (h4JmfPlugin.playMP3 != null) {
      h4JmfPlugin.cnsl.append("playMP3!=null");
      return;
    }

    String tmpdir = System.getProperty("java.io.tmpdir");
    String[] paths =
        GUIUtilities.showVFSFileDialog(
            view, tmpdir + File.separator, JFileChooser.OPEN_DIALOG, false);
    // if(paths!=null && !paths[0].equals(filename))
    if (paths != null) {
      String filename = paths[0];
      h4JmfPlugin.cnsl.append("filename=" + filename);
      try {
        URL url = new URL("file://" + filename);
        player_begin(url);
      } catch (Exception e) {
        logger.severe(e.getMessage());
        h4JmfPlugin.cnsl.append(e);
      }
    }
  } // chooseFile