Package com.sun.jini.outrigger

Examples of com.sun.jini.outrigger.AdminIterator


            JavaSpaceAdmin admin = (JavaSpaceAdmin) ((Administrable)
                space).getAdmin();
      admin = (JavaSpaceAdmin)
        getConfig().prepare("test.outriggerAdminPreparer",
          admin);
            final AdminIterator i = admin.contents(null, null, BLOCKING_FACTOR);

            while (i.next() != null) {
                i.delete();
            }
            i.close();
        } catch (Exception e) {
            throw new TestException(e.getMessage(),e);
        }
    }
View Full Code Here


        final List copyOfAllEntries = new LinkedList(allEntries);
        JavaSpaceAdmin admin = (JavaSpaceAdmin) ((Administrable)
                services[0]).getAdmin();
  admin = (JavaSpaceAdmin) getConfig().prepare("test.outriggerAdminPreparer",
                 admin);
        final AdminIterator i = admin.contents(null, null, 10);
        Entry weGot = i.next();

        while (weGot != null) {
            boolean accounted = false;
            final Template weGotTemplate = new Template(weGot);
            logger.log(Level.INFO, "Got " + weGot + " from the interator");

            for (Iterator k = allEntries.iterator(); k.hasNext();) {
                final Entry weWrote = (Entry) k.next();
                final Template weWroteTemplate = new Template(weWrote);

                if (weWroteTemplate.matchFieldAreEqual(weGotTemplate)) {
                    k.remove();

                    if (deleteAsWeGo) {
                        i.delete();
                    }
                    accounted = true;
                    break;
                }
            }

            /*
             * At this point we have found it in the list of
             * entries we wrote or its not their
             */
            if (!accounted) {
                throw new TestException(
                        "Extra entries in space!");
            }
            weGot = i.next();
        }
        i.close();

        if (!allEntries.isEmpty()) {
            throw new TestException(
                    "Did not get back all the entries we wrote");
        }
View Full Code Here

        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:");
     
      while (entry != null) {
    logger.log(Level.INFO, "  " + entry);
    entry = i.next();
      }
      throw new TestException("Space is not empty after removing all"
            + " entries");
  }
    }
View Full Code Here

        } 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);
        }
      }
    } finally {
      try {
        iter.close();
      } catch (Exception e) {
      }
    }
  }
  return (Entry[])acc.toArray(new Entry[acc.size()]);
View Full Code Here

        final List copyOfAllEntries = new LinkedList(allEntries);
        JavaSpaceAdmin admin = (JavaSpaceAdmin) ((Administrable)
                services[0]).getAdmin();
  admin = (JavaSpaceAdmin) getConfig().prepare("test.outriggerAdminPreparer",
                 admin);
        final AdminIterator i = admin.contents(null, null, 10);
        Entry weGot = i.next();

        while (weGot != null) {
            boolean accounted = false;
            final Template weGotTemplate = new Template(weGot);
            logger.log(Level.INFO, "Got " + weGot + " from the interator");

            for (Iterator k = allEntries.iterator(); k.hasNext();) {
                final Entry weWrote = (Entry) k.next();
                final Template weWroteTemplate = new Template(weWrote);

                if (weWroteTemplate.matchFieldAreEqual(weGotTemplate)) {
                    k.remove();

                    if (deleteAsWeGo) {
                        i.delete();
                    }
                    accounted = true;
                    break;
                }
            }

            /*
             * At this point we have found it in the list of
             * entries we wrote or its not their
             */
            if (!accounted) {
                throw new TestException(
                        "Extra entries in space!");
            }
            weGot = i.next();
        }
        i.close();

        if (!allEntries.isEmpty()) {
            throw new TestException(
                    "Did not get back all the entries we wrote");
        }
View Full Code Here

        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:");
     
      while (entry != null) {
    logger.log(Level.INFO, "  " + entry);
    entry = i.next();
      }
      throw new TestException("Space is not empty after removing all"
            + " entries");
  }
    }
View Full Code Here

        JavaSpaceAdmin admin = (JavaSpaceAdmin) ((Administrable)
                space).getAdmin();
        admin = (JavaSpaceAdmin) getConfig().prepare("test.outriggerAdminPreparer",
                                                     admin);

        final AdminIterator it = admin.contents(null, null, 1);

        if (it.next() != null) {
            throw new TestException(
                    "Space was not empty upon termination.");
        }

        if (!ReadAndTakeEntryTaskOK) {
View Full Code Here

            JavaSpaceAdmin admin = (JavaSpaceAdmin) ((Administrable)
                space).getAdmin();
      admin = (JavaSpaceAdmin)
        getConfig().prepare("test.outriggerAdminPreparer",
          admin);
            final AdminIterator i = admin.contents(null, null, BLOCKING_FACTOR);

            while (i.next() != null) {
                i.delete();
            }
            i.close();
        } catch (Exception e) {
            throw new TestException(e.getMessage(),e);
        }
    }
View Full Code Here

        } 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);
        }
      }
    } finally {
      try {
        iter.close();
      } catch (Exception e) {
      }
    }
  }
  return (Entry[])acc.toArray(new Entry[acc.size()]);
View Full Code Here

            logger.log(Level.INFO, "Trying shutdown...");
      shutdown(0);
            logger.log(Level.INFO, "success, restarting");
        }
        logger.log(Level.INFO, "Starting to delete entries using iterator");
        AdminIterator i;
        JavaSpaceAdmin admin;

  admin = (JavaSpaceAdmin) ((Administrable) space).getAdmin();
  admin =
      (JavaSpaceAdmin) getConfig().prepare("test.outriggerAdminPreparer",
             admin);
  i = admin.contents(aEntry, null, blockingFactor);
        int j = 0;

  while (next(i) != null) {
      delete(i);
      j++;
     
      if (j % dotInterval == dotInterval - 1) {
    logger.log(Level.INFO, ".");
      }
  }
 
  if (j < numberToWrite) {
      String msg = "\nCould not delete the number of entries we "
    + "wrote, only deleted " + j + " entries";
      throw new TestException(msg);
  } else if (j > numberToWrite) {
      String msg = "\nDeleted more entries than we wrote, deleted "
    + j + " entries";
      throw new TestException(msg);
  }
        logger.log(Level.INFO, "\nFinished deleting, closing iterator");
  i.close();
        logger.log(Level.INFO,
       "Opening new iterator to make sure space is empty");
  i = admin.contents(aEntry, null, blockingFactor);
        j = 0;

  while (next(i) != null) {
      j++;
     
      if (j % dotInterval == dotInterval - 1) {
    logger.log(Level.INFO, ".");
      }
  }
 
  if (j != 0) {
      String msg = "\n" + j
    + " entries were left after we deleted all of them";
      throw new TestException(msg);
  }
        logger.log(Level.INFO,
       "\nFinished checking emptiness, closing iterator");

  i.close();
    }
View Full Code Here

TOP

Related Classes of com.sun.jini.outrigger.AdminIterator

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.