Examples of Expiration


Examples of com.google.appengine.api.memcache.Expiration

            started = new Date().getTime();

            String id = AC_BASE + session.getId();
            Date expire = new Date(started
                    + (getMaxInactiveIntervalSeconds(session) * 1000));
            Expiration expires = Expiration.onDate(expire);

            memcache.put(id, bytes, expires);

            DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
            Entity entity = new Entity(AC_BASE, id);
View Full Code Here

Examples of com.tankz.components.Expiration

    smallestLifeTime = Integer.MAX_VALUE;
  }

  @Override
  protected void process(Entity e, int accumulatedDelta) {
    Expiration expiration = expirationMapper.get(e);

    expiration.reduceLifeTime(accumulatedDelta);

    if (expiration.isExpired()) {
      world.deleteEntity(e);
    } else if (expiration.getLifeTime() < smallestLifeTime) {
      smallestLifeTime = expiration.getLifeTime();
    }
  }
View Full Code Here

Examples of com.tankz.components.Expiration

    }
  }

  @Override
  protected void added(Entity e) {
    Expiration expiration = expirationMapper.get(e);
    if (!isRunning() || expiration.getLifeTime() < getRemainingTimeUntilProcessing()) {
      startDelayedRun(expiration.getLifeTime());
    }
  }
View Full Code Here

Examples of com.tankz.components.Expiration

public class EntityFactory {
  public static Entity createExplosion(World world, float x, float y) {
    Entity e = world.createEntity();
    e.addComponent(new Transform(x, y));
    e.addComponent(new SpatialForm("explosion"));
    e.addComponent(new Expiration(200));
    e.addToWorld();
    return e;
  }
View Full Code Here

Examples of com.tankz.components.Expiration

    Entity e = world.createEntity();
    world.getManager(GroupManager.class).add(e, "bullets");
    Transform transform = new Transform(x, y, angle);
    e.addComponent(transform);
    e.addComponent(new SpatialForm("bullet"));
    e.addComponent(new Expiration(1500));

    Body b = new Body(new Box(10, 10), 0.2f);
    b.setUserData(e);
    b.addExcludedBody(shooter.getComponent(Physics.class).getBody());
    b.setBitmask(1);
View Full Code Here

Examples of org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo.Expiration

    final long now = new Date().getTime();
    final long maxAbsoluteExpiryTime = now + maxRelativeExpiryTime;
    if (info == null || info.getExpiration() == null) {
      return maxAbsoluteExpiryTime;
    }
    Expiration expiry = info.getExpiration();
    if (expiry.getMillis() < 0l) {
      throw new InvalidRequestException("Cannot set a negative expiration: "
          + expiry.getMillis());
    }
    long relExpiryTime, absExpiryTime;
    if (expiry.isRelative()) {
      relExpiryTime = expiry.getMillis();
      absExpiryTime = now + relExpiryTime;
    } else {
      absExpiryTime = expiry.getMillis();
      relExpiryTime = absExpiryTime - now;
    }
    // Need to cap the expiry so we don't overflow a long when doing math
    if (relExpiryTime > Expiration.MAX_RELATIVE_EXPIRY_MS) {
      throw new InvalidRequestException("Expiration "
          + expiry.toString() + " is too far in the future!");
    }
    // Fail if the requested expiry is greater than the max
    if (relExpiryTime > maxRelativeExpiryTime) {
      throw new InvalidRequestException("Expiration " + expiry.toString()
          + " exceeds the max relative expiration time of "
          + maxRelativeExpiryTime + " ms.");
    }
    return absExpiryTime;
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo.Expiration

      if (info.getPool() != null) {
        b.setPool(info.getPool());
      }

      Expiration expiry = info.getExpiration();
      if (expiry != null) {
        assert (!expiry.isRelative());
        b.setExpiration(PBHelper.convert(expiry));
      }

      directives.add(b.build());
    }
View Full Code Here

Examples of org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo.Expiration

    return limit;
  }

  private static Expiration parseExpirationString(String ttlString)
      throws IOException {
    Expiration ex = null;
    if (ttlString != null) {
      if (ttlString.equalsIgnoreCase("never")) {
        ex = CacheDirectiveInfo.Expiration.NEVER;
      } else {
        long ttl = DFSUtil.parseRelativeTime(ttlString);
View Full Code Here

Examples of org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo.Expiration

        builder.setReplication(replication);
      }

      String ttlString = StringUtils.popOptionWithArgument("-ttl", args);
      try {
        Expiration ex = parseExpirationString(ttlString);
        if (ex != null) {
          builder.setExpiration(ex);
        }
      } catch (IOException e) {
        System.err.println(
View Full Code Here

Examples of org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo.Expiration

        builder.setPool(poolName);
        modified = true;
      }
      String ttlString = StringUtils.popOptionWithArgument("-ttl", args);
      try {
        Expiration ex = parseExpirationString(ttlString);
        if (ex != null) {
          builder.setExpiration(ex);
          modified = true;
        }
      } catch (IOException e) {
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.