Package java.util

Examples of java.util.Dictionary


  static Object[] look(AbstractPool factory, LockTable set,
             LockControl control, ActiveLock startingLock,
             byte deadlockWake) {

    // step one, get a list of all waiters
    Dictionary waiters = Deadlock.getWaiters(set);

    // This stack will track the potential deadlock chain
    // The Stack consists of

    // start (Vector element 0)
    // - Compatibility space of waiter A
    // - Stack of compatibility spaces with granted lock for waiter A

    Stack chain = new Stack();

    chain.push(startingLock.getCompatabilitySpace());
    chain.push(control.getGrants());
outer:  for (;;) {

      if (chain.isEmpty()) {
        // all done
        break outer;
      }

      List grants = (List) chain.peek();
      if (grants.isEmpty()) {
        // pop this list of granted locks and back to the previous one
        rollback(chain);
        continue outer;
      }
      int endStack = grants.size() - 1;
      Object space = ((Lock) grants.get(endStack)).getCompatabilitySpace();

      // this stack of granted locks can contain multiple entries
      // for a single space. We don't want to do deadlock detection
      // twice so check to see if we have seen this space already.
      for (int gs = 0; gs < endStack; gs++) {
        if (space.equals(((Lock) grants.get(gs)).getCompatabilitySpace())) {
          chain.push(space); // set up as rollback() expects.
          rollback(chain);
          continue outer;
        }
      }

      // find if this space is waiting on anyone
inner:    for (;;) {
        int index = chain.indexOf(space);
        if (index != -1) {

          // We could be seeing a situation here like
          // Granted T1{S}, T2{S}
          // Waiting T1{X} - deadlock checking on this
          //
          // In this case it's not a deadlock, although it
          // depends on the locking policy of the Lockable. E.g.
          // Granted T1(latch)
          // Waiting T1(latch)
          //  is a deadlock.
          //

          if ((index == (chain.size() - 1)) ||
            ((index == (chain.size() - 2))
            && (index == (chain.indexOf(grants) - 1)))) {

            // potential self deadlock, but probably not!
            ActiveLock lock = (ActiveLock) waiters.get(space);

            if (lock.canSkip) {
              // not a deadlock ...
              chain.push(space); // set up as rollback() expects.

              rollback(chain);
              continue outer;
            }
          }

          return Deadlock.handle(factory, chain, index, waiters, deadlockWake);
        }
        chain.push(space);

        Lock waitingLock = (Lock) waiters.get(space);
        if (waitingLock == null) {
          // end of the road, no deadlock in this path
          // pop items until the previous Stack
          rollback(chain);
          continue outer;
        }

        // Is a LockControl or another ActiveLock
        Object waitOn = waiters.get(waitingLock);
        if (waitOn instanceof LockControl) {

          LockControl waitOnControl = (LockControl) waitOn;

          // This lock control may have waiters but no
View Full Code Here


  static StandardException buildException(AbstractPool factory,
                      Object[] data) {

    Stack chain = (Stack) data[0];
    Dictionary waiters = (Dictionary) data[1];


    LanguageConnectionContext lcc = (LanguageConnectionContext)
      ContextService.getContext(LanguageConnectionContext.CONTEXT_ID);

    TableNameInfo tabInfo = null;
    TransactionInfo[] tt = null;
    TransactionController tc = null;

    if (lcc != null) {

      try {
        tc = lcc.getTransactionExecute();
        tabInfo = new TableNameInfo(lcc, false);

        tt = tc.getAccessManager().getTransactionInfo();

      } catch (StandardException se) {
        // just don't get any table info.
      }
    }


    StringBuffer sb = new StringBuffer(200);

    Hashtable attributes = new Hashtable(17);

    String victimXID = null;

    for (int i = 0; i < chain.size(); i++) {
      Object space = chain.elementAt(i);
      if (space instanceof List) {
        List grants = (List) space;

        if (grants.size() != 0) {

          sb.append("  Granted XID : ");

          for (int j = 0; j < grants.size(); j ++) {

            if (j != 0)
              sb.append(", ");

            Lock gl = (Lock) grants.get(j);

            sb.append("{");
            sb.append(gl.getCompatabilitySpace().getOwner());
            sb.append(", ");
            sb.append(gl.getQualifier());
            sb.append("} ");
          }
          sb.append('\n');
        }
        continue;
      }
      // Information about the lock we are waiting on
      // TYPE |TABLENAME                     |LOCKNAME
      Lock lock = ((Lock) waiters.get(space));
     
      // see if this lockable object wants to participate
      lock.getLockable().lockAttributes(VirtualLockTable.ALL, attributes);

      addInfo(sb, "Lock : ", attributes.get(VirtualLockTable.LOCKTYPE));
View Full Code Here

 
  /**
   * @param deviceId
   */
  private void setupUPnPListenerWatcher() {
    Dictionary dict = device.getDescriptions(null);
    this.deviceId = (String) dict.get(UPnPDevice.ID);
    this.serviceId=service.getId();
    UPnPTargetListener = new Properties();
    UPnPTargetListener.put(UPnPDevice.ID,deviceId);
    UPnPTargetListener.put(UPnPService.ID,serviceId);
    UPnPTargetListener.put(UPnPDevice.TYPE,dict.get(UPnPDevice.TYPE));
    UPnPTargetListener.put(UPnPService.TYPE,service.getType());
    String ANY_UPnPEventListener = "("+Constants.OBJECTCLASS+"="+UPnPEventListener.class.getName()+")";
   
    synchronized (LOCK) {
        try {
View Full Code Here

    private MavenConfiguration retrieveMavenConfiguration() {
        MavenConfiguration mavenConfiguration = null;
        try {
            Configuration configuration = configurationAdmin.getConfiguration(ServiceConstants.PID);
            if (configuration != null) {
                @SuppressWarnings("rawtypes")
        Dictionary dictonary = configuration.getProperties();
                if (dictonary != null) {
                    DictionaryPropertyResolver resolver = new DictionaryPropertyResolver(dictonary);
                    mavenConfiguration = new MavenConfigurationImpl(resolver, ServiceConstants.PID);
                }
View Full Code Here

        String oldPid = (String) this.session.get(PROPERTY_CONFIG_PID);
        if (oldPid != null && !oldPid.equals(pid) && !force) {
            System.err.println("Another config is being edited.  Cancel / update first, or use the --force option");
            return;
        }
      Dictionary props;

      //User selected to use file instead.
      if (useFile) {
        Configuration configuration = this.findConfigurationByFileName(admin, pid);
        if(configuration == null) {
View Full Code Here

      String factoryPid = fileName.substring(0, fileName.lastIndexOf(FACTORY_SEPARATOR));
      String absoluteFileName = FILE_PREFIX+storage.getAbsolutePath() + File.separator + fileName + CONFIG_SUFFIX;
      Configuration[] configurations = admin.listConfigurations(String.format(PID_FILTER, factoryPid));
      if (configurations != null) {
        for (Configuration configuration : configurations) {
          Dictionary dictionary = configuration.getProperties();
          if (dictionary != null) {
            String fileInstallFileName = (String) dictionary.get(FILEINSTALL_FILE_NAME);
            if (absoluteFileName.equals(fileInstallFileName)) {
              return configuration;
            }
          }
        }
View Full Code Here

    public void setStorage(File storage) {
        this.storage = storage;
    }

    protected void doExecute(ConfigurationAdmin admin) throws Exception {
        Dictionary props = getEditedProps();
        if (props == null) {
            System.err.println("No configuration is being edited. Run the edit command first");
        } else if (!bypassStorage && storage != null) {
          String pid = (String) this.session.get(PROPERTY_CONFIG_PID);
          File storageFile = new File(storage, pid + ".cfg");
            Properties p = new Properties(storageFile);
            for (Enumeration keys = props.keys(); keys.hasMoreElements();) {
                Object key = keys.nextElement();
                if (!"service.pid".equals(key) && !"felix.fileinstall.filename".equals(key)) {
                    p.put((String) key, (String) props.get(key));
                }
            }
            storage.mkdirs();
            p.save();
            this.session.put(PROPERTY_CONFIG_PID, null);
View Full Code Here

    protected void printHeaders(Bundle bundle) throws Exception {
        String title = Util.getBundleName(bundle);
        System.out.println("\n" + title);
        System.out.println(Util.getUnderlineString(title));
        if (indent == 0) {
            Dictionary dict = bundle.getHeaders();
            Enumeration keys = dict.keys();
            while (keys.hasMoreElements()) {
                Object k = keys.nextElement();
                Object v = dict.get(k);
                System.out.println(k + " = " + Util.getValueString(v));
            }
        } else {
            System.out.println(generateFormattedOutput(bundle));
        }
View Full Code Here

        StringBuilder output = new StringBuilder();
        Map<String, Object> otherAttribs = new HashMap<String, Object>();
        Map<String, Object> bundleAttribs = new HashMap<String, Object>();
        Map<String, Object> serviceAttribs = new HashMap<String, Object>();
        Map<String, Object> packagesAttribs = new HashMap<String, Object>();
        Dictionary dict = bundle.getHeaders();
        Enumeration keys = dict.keys();

        // do an initial loop and separate the attributes in different groups
        while (keys.hasMoreElements()) {
            String k = (String) keys.nextElement();
            Object v = dict.get(k);
            if (k.startsWith(BUNDLE_PREFIX)) {
                // starts with Bundle-xxx
                bundleAttribs.put(k, v);
            } else if (k.endsWith(SERVICE_SUFFIX)) {
                // ends with xxx-Service
View Full Code Here

        command.execute(session);

        // the PID and an empty Dictionary should have been set on the session       
        assertEquals("The PID should be set on the session",
                     PID, session.get(ConfigCommandSupport.PROPERTY_CONFIG_PID));
        Dictionary props = (Dictionary) session.get(ConfigCommandSupport.PROPERTY_CONFIG_PROPS);
        assertNotNull("Should have a Dictionary on the session", props);
        assertTrue("Should have an empty Dictionary on the session", props.isEmpty());
    }
View Full Code Here

TOP

Related Classes of java.util.Dictionary

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.