Examples of IdManager


Examples of be.demmel.jgws.utils.IDManager

    private List<GWVector> possibleSpawns;
    private List<NpcData> npcs;
   
    public MapData() {
        //FIXME: what if it runs out of IDs?
        this.agentIDs = new IDManager(1, 1000);
        this.localIDs = new IDManager(1, 1000);
        this.possibleSpawns = new ArrayList<>();
        this.npcs = new ArrayList<>();
    }
View Full Code Here

Examples of com.dooapp.gaedo.google.datastore.IdManager

    if (!repository.containsKey(parentField.getType())) {
      throw new NonStoredParentException(parentField);
    }
    DatastoreFinderService parentService = (DatastoreFinderService) repository
        .get(parentField.getType());
    IdManager parentIdManager = parentService.getIdManager();
    Object parentObject = parentField.get(data);
    String parentKind = parentService.getKind();
    if (!parentIdManager.hasKey(parentKind, parentObject)) {
      parentIdManager.createKey(parentKind, parentObject);
    }
    return parentIdManager.getKey(parentKind, parentObject);
  }
View Full Code Here

Examples of com.dooapp.gaedo.google.datastore.IdManager

   * @return
   */
  public static IdManager createIdManager(Class<?> containedClass,
      DatastoreService datastore, ServiceRepository repository, PropertyProvider provider, HierarchyManager hierarchyManager) {
    logger.config("defining id manager");
    IdManager returned = null;
    Field[] fields = containedClass.getDeclaredFields();
    for (Field f : fields) {
      // only non static fields are used
      if (!Modifier.isStatic(f.getModifiers())) {
        boolean isIdField = f.getAnnotation(Id.class) != null;
        if (isIdField) {
          if (logger.isLoggable(Level.FINE)) {
            logger.fine("found id field of "
                + containedClass.getName() + "\nIt is "
                + f.toGenericString());
          }
          if (returned != null)
            throw new BadIdAnnotatedClassException(containedClass);
          if (logger.isLoggable(Level.CONFIG))
            logger.config("the field " + f.toGenericString()
                + " seems to be an id field");
          if (Long.class.equals(f.getType())
              || Long.TYPE.equals(f.getType())) {
            returned = new LongIdManager(containedClass, datastore, provider, repository, hierarchyManager);
            logger.config("using standard LongIdManager");
          } else if (String.class.equals(f.getType())) {
            logger.config("using standard StringIdManager");
          } else {
            throw new NoSuchIdManagerException(f);
          }
          if (logger.isLoggable(Level.FINE)) {
            logger.fine("As a consequence, id manager is a "
                + returned.getClass().getName());
          }
        }
        // Side effect : access to the field !
        f.setAccessible(true);
      }
View Full Code Here

Examples of com.dooapp.gaedo.google.datastore.IdManager

   */
  public static IdManager createIdManager(Class<?> containedClass,
      DatastoreService datastore, ServiceRepository repository, PropertyProvider provider, HierarchyManager hierarchyManager) {
    logger.config("defining id manager");
    Property id = AnnotationUtils.locateIdField(provider, containedClass, Long.TYPE, Long.class, String.class);
    IdManager returned = null;
    if (Long.class.equals(id.getType())
            || Long.TYPE.equals(id.getType())) {
      returned = new LongIdManager(containedClass, datastore, provider, repository, hierarchyManager);
    }
    if (returned == null)
View Full Code Here

Examples of com.thinkaurelius.titan.graphdb.idmanagement.IDManager

            partitionBits = 0;
            hasLocalPartitions = false;
            placementStrategy = new DefaultPlacementStrategy(0);
        }
        log.debug("Partition IDs? [{}], Local Partitions? [{}]",partitionIDs,hasLocalPartitions);
        idManager = new IDManager(partitionBits);
        Preconditions.checkArgument(idManager.getMaxPartitionCount() < Integer.MAX_VALUE);
        this.maxPartitionID = (int) idManager.getMaxPartitionCount();

        long baseBlockSize = config.getLong(IDS_BLOCK_SIZE_KEY, IDS_BLOCK_SIZE_DEFAULT);
        idAuthority.setIDBlockSizer(new SimpleVertexIDBlockSizer(baseBlockSize));
View Full Code Here

Examples of org.jboss.messaging.core.impl.IDManager

         // We get references to some plugins lazily to avoid problems with circular MBean
         // dependencies

         // Create the wired components
         messageIDManager = new IDManager("MESSAGE_ID", 4096, persistenceManager);
         channelIDManager = new IDManager("CHANNEL_ID", 10, persistenceManager);
         destinationJNDIMapper = new DestinationJNDIMapper(this);
         connFactoryJNDIMapper = new ConnectionFactoryJNDIMapper(this);
         connectionManager = new SimpleConnectionManager();
         connectorManager = new SimpleConnectorManager();
         memoryManager = new SimpleMemoryManager();
View Full Code Here

Examples of org.jboss.messaging.core.impl.IDManager

         // We get references to some plugins lazily to avoid problems with circular MBean
         // dependencies

         // Create the wired components
         messageIDManager = new IDManager("MESSAGE_ID", 4096, persistenceManager);
         channelIDManager = new IDManager("CHANNEL_ID", 10, persistenceManager);
         destinationJNDIMapper = new DestinationJNDIMapper(this);
         connFactoryJNDIMapper = new ConnectionFactoryJNDIMapper(this);
         connectionManager = new SimpleConnectionManager();
         connectorManager = new SimpleConnectorManager();
         memoryManager = new SimpleMemoryManager();
View Full Code Here

Examples of org.jboss.messaging.core.impl.IDManager

        
         PersistenceManager pm = serverPeer.getPersistenceManagerInstance();
        
         TransactionRepository tr = serverPeer.getTxRepository();
        
         IDManager idManager = serverPeer.getChannelIDManager();
        
         int nodeId = serverPeer.getServerPeerID();
        
         ClusterNotifier clusterNotifier = serverPeer.getClusterNotifier();
View Full Code Here

Examples of org.jboss.messaging.core.impl.IDManager

         // We get references to some plugins lazily to avoid problems with circular MBean
         // dependencies

         // Create the wired components
         messageIDManager = new IDManager("MESSAGE_ID", 4096, persistenceManager);
         channelIDManager = new IDManager("CHANNEL_ID", 10, persistenceManager);
         destinationJNDIMapper = new DestinationJNDIMapper(this);
         connFactoryJNDIMapper = new ConnectionFactoryJNDIMapper(this);
         connectionManager = new SimpleConnectionManager();
         connectorManager = new SimpleConnectorManager();
         memoryManager = new SimpleMemoryManager();
View Full Code Here

Examples of org.jboss.messaging.core.impl.IDManager

      super.tearDown();
   }
  
   public void test1() throws Exception
   {
      IDManager idm = new IDManager("test_counter", 1000, pm);
      idm.start();
     
      int blockSize = 37;
           
      long nextLow = Long.MIN_VALUE;
     
      for (int i = 0; i < 1000; i++)
      {
         IDBlock block = idm.getIDBlock(blockSize);
                  
         assertTrue(block.getLow() >= nextLow);
        
         assertEquals(blockSize, 1 + block.getHigh() - block.getLow());
        
         nextLow = block.getHigh() + 1;        
      }
     
      idm.stop();
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.