Examples of CacheWrapper


Examples of org.eclipse.ui.internal.layout.CacheWrapper

    }

    private void createControlForTop() {
        perspectiveBar = createBarManager(SWT.HORIZONTAL);

        perspectiveCoolBarWrapper = new CacheWrapper(topBar);
        perspectiveCoolBar = new CoolBar(
                perspectiveCoolBarWrapper.getControl(), SWT.FLAT);
        coolItem = new CoolItem(perspectiveCoolBar, SWT.DROP_DOWN);
        toolbarWrapper = new CacheWrapper(perspectiveCoolBar);
        perspectiveBar.createControl(toolbarWrapper.getControl());
        coolItem.setControl(toolbarWrapper.getControl());
        perspectiveCoolBar.setLocked(true);
        perspectiveBar.setParent(perspectiveCoolBar);
        perspectiveBar.update(true);
View Full Code Here

Examples of org.eclipse.ui.internal.layout.CacheWrapper

    // the banner gets a curve along with the new tab style
    // TODO create a dedicated preference for this
    setBannerCurve(PrefUtil.getAPIPreferenceStore().getBoolean(
        IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS));

    CacheWrapper coolbarCacheWrapper = new CacheWrapper(topBar);

    final Control coolBar = createCoolBarControl(coolbarCacheWrapper
        .getControl());
    // need to resize the shell, not just the coolbar's immediate
    // parent, if the coolbar wants to grow or shrink

    coolBar.addListener(SWT.Resize, new Listener() {
      public void handleEvent(Event event) {
        // If the user is dragging the sash then we will need to force
        // a resize. However, if the coolbar was resized programatically
        // then everything is already layed out correctly. There is no
        // direct way to tell the difference between these cases,
        // however
        // we take advantage of the fact that dragging the sash does not
        // change the size of the shell, and only force another layout
        // if the shell size is unchanged.
        Rectangle clientArea = shell.getClientArea();

        if (lastShellSize.x == clientArea.width
            && lastShellSize.y == clientArea.height) {
          LayoutUtil.resize(coolBar);
        }

        lastShellSize.x = clientArea.width;
        lastShellSize.y = clientArea.height;
      }
    });

    if (getWindowConfigurer().getShowCoolBar()) {
      topBar.setLeft(coolbarCacheWrapper.getControl());
    }

    createStatusLine(shell);

    fastViewBar = new FastViewBar(this);
View Full Code Here

Examples of org.olat.core.util.cache.n.CacheWrapper

 
  public CacheWrapper getOrCreateChildCacheWrapper(OLATResourceable ores) {
    String childName = OresHelper.createStringRepresenting(ores).replace(":", "_");
    String fullcacheName = cacheName + "@" + childName;
    synchronized(this) {//cluster_ok by definition of this class as used in single vm
      CacheWrapper cwChild = null;
      if (children == null) {
        children = new HashMap<String, CacheWrapper>();
      } else {
        cwChild = children.get(childName);
      }
View Full Code Here

Examples of org.olat.core.util.cache.n.CacheWrapper

      double inmilis = dur / 1000000;
      double avg = dur / cnt;
      double avgmilis = avg / 1000000;
      getWindowControl().setInfo("sending "+cnt+" messages took "+inmilis+" ms, avg per messages was "+avg+" ns = "+avgmilis+" ms");
    } else if (source == testCachePut) {
      CacheWrapper cw = CoordinatorManager.getCoordinator().getCacher().getOrCreateCache(this.getClass(), "cachetest").
        getOrCreateChildCacheWrapper(ORES_CACHE_TEST);
      // we explicitly use put and not putSilent to show that a put invalidates (and thus removes) this key of this cache in all other cluster nodes.
      cw.update("akey", "hello");
      updateCacheInfo();
    } else if (source == testCachePut2) {
      // we explicitly use put and not putSilent to show that a put invalidates (and thus removes) this key of this cache in all other cluster nodes.
      CacheWrapper cw = CoordinatorManager.getCoordinator().getCacher().getOrCreateCache(this.getClass(), "cachetest").
        getOrCreateChildCacheWrapper(ORES_CACHE_TEST);
      cw.update("akey", "world");
      updateCacheInfo();
    } else if (source == testSFUPerf) {
      // acquire a sync 1000x times (does internally a select-for-update on the database)
      int cnt = 1000;
      long start = System.nanoTime();
View Full Code Here

Examples of org.olat.core.util.cache.n.CacheWrapper

      // ignore
    }
  }
 
  void updateCacheInfo() {
    CacheWrapper cw = CoordinatorManager.getCoordinator().getCacher().getOrCreateCache(this.getClass(), "cachetest").
    getOrCreateChildCacheWrapper(ORES_CACHE_TEST);
    Object val = cw.get("akey");
    cachetest.contextPut("cacheval", val==null? "-null-": val);
    // org.olat.commons.coordinate.cluster.jms.ClusterAdminController:cachetest::0@subcachetypetest::123
  }
View Full Code Here

Examples of org.olat.core.util.cache.n.CacheWrapper

   * @param identity the identity
   * @param notify if true, then the
   * @return a Map containing nodeident+"_"+ e.g. PASSED as key, Boolean (for PASSED), Float (for SCORE), or Integer (for ATTEMPTS) as values
   */
  private Map<String, Serializable> getOrLoadScorePassedAttemptsMap(Identity identity, boolean prepareForNewData) {
    CacheWrapper cw = getCacheWrapperFor(identity);
    synchronized(cw) {  // o_clusterOK by:fj : we sync on the cache to protect access within the monitor "one user in a course".
      // a user is only active on one node at the same time.
      Map<String, Serializable> m = (Map<String, Serializable>) cw.get(FULLUSERSET);
      if (m == null) {
        // cache entry (=all data of the given identity in this course) has expired or has never been stored yet into the cache.
        // or has been invalidated (in cluster mode when puts occurred from an other node for the same cache)
        m = new HashMap<String, Serializable>();
        // load data
        List properties = loadPropertiesFor(identity);
        for (Iterator iter = properties.iterator(); iter.hasNext();) {
          Property property = (Property) iter.next();
          addPropertyToCache(m, property);
        }
        // we use a putSilent here (no invalidation notifications to other cluster nodes), since
        // we did not generate new data, but simply asked to reload it.
        if (prepareForNewData) {
          cw.update(FULLUSERSET, (Serializable) m);
        } else {
          cw.put(FULLUSERSET, (Serializable) m);
        }
      } else {
        // still in cache.
        if (prepareForNewData) { // but we need to notify that data has changed: we reput the data into the cache - a little hacky yes
          cw.update(FULLUSERSET, (Serializable) m);
        }
      }
      return m;
    }
  }
View Full Code Here

Examples of org.olat.core.util.cache.n.CacheWrapper

  }
 
  private CacheWrapper getCacheWrapperFor(Identity identity) {
    // the ores is only for within the cache
    OLATResourceable ores = OresHelper.createOLATResourceableInstanceWithoutCheck("Identity", identity.getKey());
    CacheWrapper cw = courseCache.getOrCreateChildCacheWrapper(ores);
    return cw;
  }
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.