Package java.util

Examples of java.util.Vector



    /* ------------------------------------- Private Methods ------------------------------------- */

    Address determineCoordinator() {
        Vector v=channel != null ? channel.getView().getMembers() : null;
        return v != null ? (Address) v.elementAt(0) : null;
    }
View Full Code Here


  public void viewAccepted(View view) {
    if (logmon.isLoggable(BasicLevel.DEBUG))
      logmon.log(BasicLevel.DEBUG,"==== viewAccepted: " + view);

    // Eventually get new coordinator address
    Vector mbrs = view.getMembers();
    coordinatorAddr = (Address) mbrs.elementAt(0);

    if (logmon.isLoggable(BasicLevel.DEBUG))
      logmon.log(BasicLevel.DEBUG,
                 "JGroups setView: " + coordinator + ", " + state);

    if (coordinator) {
      // Test that the server is always master.
      if (! coordinatorAddr.equals(myAddr)) {
        logmon.log(BasicLevel.FATAL, "Bad view for coordinator");
        throw new RuntimeException("Bad view for coordinator");
      }
      return;
    }

    if ((state != RUNNING) && (! coordinatorAddr.equals(myAddr))) {
      // Ask current state to the new coordinator.   
      try {     
        sendTo(coordinatorAddr,new HAStateRequest(myAddr));
        state = INITIALIZING;
      } catch (Exception exc) {
        logmon.log(BasicLevel.ERROR,"JGroups sendTo()",exc);
      }
    }

    if ((mbrs.size() >= nbClusterExpected) &&
        coordinatorAddr.equals(myAddr)) {
      // This server is the new master !
      coordinator = true;
      // Starts the service
      startConsAndServ();
View Full Code Here

    try {
      String section = (String) params.get("section");
      String view = (String) params.get("view");
      int max = Integer.parseInt((String) params.get("max"));
      //Mapping.begin();
      Vector v = Section.getInstance(section).listPublications();
      Vector v2 = new Vector();
      int nb = 0;
      for (int i = 0;(i < v.size() && nb < max); i++) {
        Publication p = (Publication) v.get(i);
        if (IsOnline.getStatus(p)) {
          nb++;
          PublicationResult r = new PublicationResult();
          r._publi = p;
          if( view != null ) {
            r._view = new String(Viewer.getView(p, view));
          }
          v2.add(r);
        }
      }
      //Mapping.rollback();
      return v2;
    } catch (Exception e) {
View Full Code Here

          }
        }
      }

      if (nbMaxCnx != -1) {
        activeSessions = new Vector(nbMaxCnx);
      } else {
        activeSessions = new Vector(servers.length - 1);
      }

      wakeOnConnection.start();
      dispatcher.start();
      watchDog.start();
View Full Code Here

public class ListRootSections implements ObjectSelector {

  public Collection selectObjects(Hashtable params) throws SelectException {
    try {
      //Mapping.begin();
      Vector v = Section.listRootSections();     
      //Mapping.rollback();
      return v;
    } catch (Exception e) {
      Logger.getInstance().error("Erreur du SelectObject",this,e);
      throw new SelectException(e.getMessage());
View Full Code Here

  public Collection selectObjects(Hashtable params) throws SelectException {
    try {
      String rootSection = (String) params.get("rootSection");
      //Mapping.begin();
      Section root = Section.getInstance(rootSection);
      Vector v = root.listSubSections();
      //Mapping.rollback();
      return v;
    } catch (Exception e) {
      Logger.getInstance().error("Erreur du SelectObject", this, e);
      throw new SelectException(e.getMessage());
View Full Code Here

*/
public class FindParentSection implements ObjectSelector {

  public Collection selectObjects(Hashtable params) throws SelectException {
    try {
      Vector v = new Vector();
      int level = Integer.parseInt(params.get("level")+"");
      Section s = Section.getInstance(params.get("section")+"");
      if( level > s.getLevel() ) return v;
      Section parent = s;
      while( parent.getLevel() > level ) {
        parent = parent.getParent();
      }
      v.add(parent);
      return v;
    } catch (Exception e) {
      Logger.getInstance().error("Erreur du SelectObject : "+e.getMessage(),this,e);
      throw new SelectException(e.getMessage());
    }
View Full Code Here

   * Notify all Data source listeners that a data set has been loaded
   *
   * @param e a <code>DataSetEvent</code> value
   */
  protected void notifyDataSetLoaded(DataSetEvent e) {
    Vector l;
    synchronized (this) {
      l = (Vector)m_listeners.clone();
    }
   
    if (l.size() > 0) {
      for(int i = 0; i < l.size(); i++) {
  ((DataSourceListener)l.elementAt(i)).acceptDataSet(e);
      }
      m_dataSet = null;
    }
  }
View Full Code Here

        if (nodeMap == null) {
            nodeMap = new Hashtable();
        }

        if (nodes == null) {
            nodes = new Vector();
        }

        nodeMap.put(elem.getID(), elem);
        nodes.insertElementAt(elem, where);
View Full Code Here

        TransientNode n = (TransientNode) node;

        if ((n.getParent() == this) && n.anonymous) {

            // remove all subnodes, giving them a chance to destroy themselves.
            Vector v = new Vector(); // removeElement modifies the Vector we are enumerating, so we are extra careful.

            for (Enumeration e3 = n.getSubnodes(); e3.hasMoreElements();) {
                v.addElement(e3.nextElement());
            }

            int m = v.size();

            for (int i = 0; i < m; i++) {
                n.removeNode((TransientNode) v.elementAt(i));
            }
        }
    }
View Full Code Here

TOP

Related Classes of java.util.Vector

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.