Package net.jini.core.entry

Examples of net.jini.core.entry.Entry


                private int count = 0;

                protected Entry doQuery(JavaSpace space, Entry tmpl)
                        throws UnusableEntryException, TransactionException,
                        InterruptedException, RemoteException {
                    Entry rtn;

                    if (useIfExists) {
                        rtn = space.takeIfExists(tmpl, null, queryTimeOut);
                    } else {
                        rtn = space.take(tmpl, null, queryTimeOut);
                    }
                    count++;

                    /*
                     * Don't need to do null test here because the
                     * string concatenation operator is smart enough
                     * to convert a null reference to the string "null"
                     */
                    logger.log(Level.INFO, "Take back #" + count + ":" + rtn);
                    return rtn;
                }
            }, nullTemplate);

            logger.log(Level.INFO, "Auditor Summary after emptySpace call");
            rslt.dump();

            /*
             * In a short test like this with only one client there should
             * be no entries left.
             */
            if (rslt.totalEntries != 0) {
                ((JavaSpaceAuditor) space).dumpLog();
                throw new TestException(
                        "Not all entries that were writen were removed");
            }

            /*
             * There should be one more take than write
             * auditor.emptySpace() detects empty with a take that
             * returns null
             */
            if (rslt.writeAttemptCount + 1 != rslt.takesAttemptCount) {
                throw new TestException(
                        "Did not have an equal number of writes and takes");
            }
        } catch (UnusableEntryException e) {
            dumpUnusableEntryException(e);
      throw e;
        }

        // Use the Admin to make sure the space is really empty
        JavaSpaceAdmin admin = (JavaSpaceAdmin) ((Administrable)
                services[0]).getAdmin();
        admin =
      (JavaSpaceAdmin) getConfig().prepare("test.outriggerAdminPreparer",
             admin);
  final AdminIterator i = admin.contents(nullTemplate, null, 10);
 
  Entry entry = i.next();
 
  if (entry != null) {
      logger.log(Level.INFO, "Space is not empty after removing"
           + " entries:");
     
View Full Code Here


            logger.log(level, "comparison loop");
            logger.log(level, "");
        }//endif
        int i = 0;
        for(Iterator itr1=hashSet1.iterator(); itr1.hasNext(); i++) {
            Entry attribute1 = (Entry)itr1.next();
            displayAttribute(attribute1, "attributeSet1[" + i + "]", level);
            int j = 0;
            for(Iterator itr2=hashSet2.iterator(); itr2.hasNext(); j++) {
                Entry attribute2 = (Entry)itr2.next();
                displayAttribute(attribute2, "attributeSet2[" + j + "]", level);
                if(specialCheck(attribute2, attribute1)
       ||  attribute2.equals(attribute1) ) {
                    hashSet2.remove(attribute2);
                    break;
                }
            }//end loop(attributeSet2)
            if( !((Level.OFF).equals(level)) )  logger.log(level, "");
View Full Code Here

      if (findHash(realClass, false).longValue() != hash)
    throw throwNewUnusableEntryException(
        new IncompatibleClassChangeError(realClass + " changed"));

      Entry entryObj = (Entry) realClass.newInstance();

      Field[] fields = getFields(realClass);

      /*
       * Loop through the fields, ensuring no primitives and
       * checking for wildcards.
       */
      int nvals = 0;    // index into this.values[]
      for (int i = 0; i < fields.length; i++) {
    Throwable nested = null;
    try {
        if (!usableField(fields[i]))
      continue;
       
        final MarshalledInstance val = values[nvals++];
        Object value = (val == null ? null : val.get(integrity));
        fields[i].set(entryObj, value);
    } catch (Throwable e) {
        nested = e;
    }

    if (nested != null) {  // some problem occurred
        if (badFields == null) {
      badFields = new ArrayList(fields.length);
      except = new ArrayList(fields.length);
        }
        badFields.add(fields[i].getName());
        except.add(nested);
    }
      }

      /* See if any fields have vanished from the class,
       * because of the hashing this should never happen but
       * throwing an exception that provides more info
       * (instead of AssertionError) seems harmless.
       */
      if (nvals < values.length) {
    throw throwNewUnusableEntryException(
      entryObj,    // should this be null?
      null,      // array of bad-field names
      new Throwable[] {  // array of exceptions
          new IncompatibleClassChangeError(
            "A usable field has been removed from " +
            entryObj.getClass().getName() +
            " since this EntryRep was created")
      });
      }

      // if there were any bad fields, throw the exception
View Full Code Here

     *          If an exception has been thrown during space checking.
     */
    public boolean checkSpace(JavaSpace space, Transaction txn)
            throws TestException {
        try {
            Entry result = (Entry) space.readIfExists(null, txn,
              JavaSpace.NO_WAIT);

            if (result != null) {
                return false;
            }
View Full Code Here

    /**
     * Create the service-owned attributes for an Outrigger server.
     */
    private static Entry[] attributesFor() {
  final Entry info = new ServiceInfo("JavaSpace",
      "Sun Microsystems, Inc.", "Sun Microsystems, Inc.",
      com.sun.jini.constants.VersionConstants.SERVER_VERSION, "", "");
 
  final Entry type =
      new com.sun.jini.lookup.entry.BasicServiceType("JavaSpace");

  return new Entry[]{info, type};
    }
View Full Code Here

      browser.leaseMgr.renewUntil(lease, Lease.ANY, null);
    }
    try {
      while (true) {
        try {
    Entry e = set.next();
    if (e == null)
      break;
    acc.add(e);
        } catch (UnusableEntryException e) {
    Browser.logger.log(Level.INFO, "unusable entry", e);
        }
      }
    } finally {
      if (lease != null) {
        try {
    browser.leaseMgr.cancel(lease);
        } catch (Exception e) {
        }
      }
    }
  } else {
    AdminIterator iter =
         ((JavaSpaceAdmin) proxy).contents(null, null, 128);
    try {
      while (true) {
        try {
    Entry e = iter.next();
    if (e == null)
      break;
    acc.add(e);
        } catch (UnusableEntryException e) {
    Browser.logger.log(Level.INFO, "unusable entry", e);
View Full Code Here

        this.transactional = endpoint.isTransactional();
        this.transactionTimeout = endpoint.getTransactionTimeout();
    }

    public void process(Exchange exchange) throws Exception {
        Entry entry;
        Object body = exchange.getIn().getBody();

        if (!(body instanceof Entry)) {
            entry = new InEntry();
View Full Code Here

        this.javaSpace = javaSpace;
        this.transactionHelper = transactionHelper;
        this.transactionTimeout = transactionTimeout;
        this.verb = verb;
        if (templateId != null) {
            Entry tmpl = (Entry) this.endpoint.getCamelContext().getRegistry().lookup(templateId);
            template = javaSpace.snapshot(tmpl);
        } else {
            this.template = javaSpace.snapshot(new InEntry());
        }
    }
View Full Code Here

            DefaultExchange exchange = (DefaultExchange) endpoint.createExchange(ExchangePattern.InOut);
            Message message = exchange.getIn();
            if (transactionHelper != null) {
                tnx = transactionHelper.getJiniTransaction(transactionTimeout).transaction;
            }
            Entry entry = null;
            switch (verb) {
            case JavaSpaceConsumer.TAKE:
                entry = javaSpace.take(template, tnx, 100);
                break;
            case JavaSpaceConsumer.READ:
View Full Code Here

        this.transactional = endpoint.isTransactional();
        this.transactionTimeout = endpoint.getTransactionTimeout();
    }

    public void process(Exchange exchange) throws Exception {
        Entry entry;
        Object body = exchange.getIn().getBody();

        if (!(body instanceof Entry)) {
            entry = new InEntry();
View Full Code Here

TOP

Related Classes of net.jini.core.entry.Entry

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.