Package com.sun.sgs.app

Examples of com.sun.sgs.app.DataManager.markForUpdate()


    @Override
    public E poll() {
  E element = null;
  if (headRef != null) {
      DataManager dataManager = AppContext.getDataManager();
      dataManager.markForUpdate(this);
      Entry<E> head = getHeadForUpdate();
      element = head.getElement();
      headRef = head.nextEntryRef;
      if (headRef == null) {
    // last element removed
View Full Code Here


                                (Counters) service.getBinding("counters");
          DataManager dataManager =
        AppContext.getDataManager();
                            for (int i = 0; i < items; i++) {
                                Counter counter = counters.get(i);
        dataManager.markForUpdate(counter);
                            }
                        }}, taskOwner);
            }
            long stop = System.currentTimeMillis();
            System.err.println(
View Full Code Here

     * @param p the period between recurrences, or
     *          {@code TaskServiceImpl.PERIOD_NONE}
     */
    void resetValues(Task t, long s, long p) {
        DataManager dm = AppContext.getDataManager();
        dm.markForUpdate(this);

        /* If the Task is also a ManagedObject then the assumption is
           that the object was already managed by the application so we
           just keep a reference...otherwise, we make it part of our
           state, which has the effect of persisting the task. In either
View Full Code Here

     * <p>
     * @param room the room this player should be in, or {@code null}
     */
    protected void setRoom(SwordWorldRoom room) {
        DataManager dataManager = AppContext.getDataManager();
        dataManager.markForUpdate(this);

        if (room == null) {
            currentRoomRef = null;
            return;
        }
View Full Code Here

    listener = new DummyClientSessionListener(name, session, true);
      } else {
    listener = new DummyClientSessionListener(name, session, false);
      }
      DataManager dataManager = AppContext.getDataManager();
      dataManager.markForUpdate(this);
      ManagedReference<ClientSession> sessionRef =
    dataManager.createReference(session);
      sessions.add(sessionRef);
      String sessionName = session.getName();
      dataManager.setBinding(sessionName, session);
View Full Code Here

    public static abstract class AbstractTask implements Task, Serializable {
        public void run() throws Exception {
            DataManager dataManager = AppContext.getDataManager();
            Counter counter = (Counter) dataManager.getBinding("counter");
            dataManager.markForUpdate(counter);
            counter.decrement();
        }
    }

    public static class ManagedTask extends AbstractTask
View Full Code Here

  // depth on the leaves.
  int leafBits = Math.min(minDepth - depth, maxDirBits);
  int numLeaves = 1 << leafBits;

  DataManager dm = AppContext.getDataManager();
  dm.markForUpdate(this);
        ManagedReference<ScalableHashMap<K, V>> thisRef =
      dm.createReference(this);

  ScalableHashMap[] leaves = new ScalableHashMap[numLeaves];
  for (int i = 0; i < numLeaves; ++i) {
View Full Code Here

    private void split() {
  assert isLeafNode() : "Can't split an directory node";
  assert depth < MAX_DEPTH : "Can't split at maximum depth";

  DataManager dataManager = AppContext.getDataManager();
  dataManager.markForUpdate(this);

        ScalableHashMap<K, V> leftChild =
                new ScalableHashMap<K, V>(
                depth + 1, minDepth, splitThreshold, 1 << maxDirBits);
        ScalableHashMap<K, V> rightChild =
View Full Code Here

  {
      System.err.println(
    "ValidatingChannelListener.receivedMessage: session = " +
    session);
      DataManager dm = AppContext.getDataManager();
      dm.markForUpdate(this);
      sessionRef = dm.createReference(session);
  }

  public void validateSession(ClientSession session) {
      if (this.sessionRef == null) {
View Full Code Here

    public static abstract class AbstractTask implements Task, Serializable {
        public void run() throws Exception {
            DataManager dataManager = AppContext.getDataManager();
            Counter counter = (Counter) dataManager.getBinding("counter");
            dataManager.markForUpdate(counter);
            counter.decrement();
        }
    }

    public static class ManagedTask extends AbstractTask
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.