Examples of CacheEntry


Examples of org.infinispan.container.entries.CacheEntry

      TestingUtil.replaceComponent(cache, ClusteringDependentLogic.class, spyCdl1, true);
      doAnswer(new Answer() {
         @Override
         public Object answer(InvocationOnMock invocation) throws Throwable {
            Object[] arguments = invocation.getArguments();
            CacheEntry entry = (CacheEntry) arguments[0];
            Object key = entry.getKey();
            InvocationContext ctx = (InvocationContext) arguments[3];
            Address source = ctx.getOrigin();
            checkPoint.trigger("pre_commit_entry_" + key + "_from_" + source);
            checkPoint.awaitStrict("resume_commit_entry_" + key + "_from_" + source, 10, SECONDS);
            Object result = invocation.callRealMethod();
View Full Code Here

Examples of org.infinispan.grid.demo.CacheEntry

      buttonCancel.setText("Cancel");

    buttonOK.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
       
        entity = new CacheEntry(keytext.getText(), valuetext.getText(), lifespantext.getText(), maxIdletext.getText(), "-");
       
        shell.dispose();
      }
    });
View Full Code Here

Examples of org.jasig.portal.CacheEntry

                                log
                                        .debug("retreived transformation character block cache for a key \""
                                                + cacheKey + "\"");
                            // start channel threads
                            for(int i=0;i<cacheEntries.size();i++) {
                                CacheEntry ce = cacheEntries.get(i);
                                if (ce.getCacheType().equals(CacheType.CHANNEL_CONTENT)) {
                                    String channelSubscribeId = ((ChannelContentCacheEntry)ce).getChannelId();
                                    if(channelSubscribeId!=null) {
                                        try {
                                            channelManager.startChannelRendering(req, res, channelSubscribeId);
                                        } catch (PortalException e) {
                                            log.error("UserInstance::renderState() : unable to start rendering channel (subscribeId=\""+channelSubscribeId+"\", user="+person.getID()+" layoutId="+uPreferencesManager.getCurrentProfile().getLayoutId(),e);
                                        }
                                    } else {
                                        log.error("channel entry " + Integer.toString(i)
                                            + " in character cache is invalid (user=" + person.getID() + ")!");
                                    }
                                }
                            }
                            channelManager.commitToRenderingChannelSet();

                            // go through the output loop
                            CachingSerializer cSerializer = (CachingSerializer) markupSerializer;
                            cSerializer.setDocumentStarted(true);

                            for(int sb=0; sb<cacheEntries.size();sb++) {
                                CacheEntry ce = cacheEntries.get(sb);
                                if (log.isDebugEnabled()) {
                                    DebugCachingSerializer dcs = new DebugCachingSerializer();
                                    log.debug("----------printing " + ce.getCacheType() + " cache block "+Integer.toString(sb));
                                    ce.replayCache(dcs, channelManager, req, res);
                                    log.debug(dcs.getCache());
                                }

                                // get cache block output
                                ce.replayCache(cSerializer, channelManager, req, res);
                            }

                            cSerializer.flush();
                            output_produced = true;
                        }
                    }
                    // if this failed, try XSLT cache
                    if ((!ccaching) || (!ccache_exists)) {
                        // obtain XSLT cache

                        SAX2BufferImpl cachedBuffer = systemCache.get(cacheKey);
                        if (cachedBuffer != null) {
                            // replay the buffer to channel incorporation filter
                            if (log.isDebugEnabled()) {
                                log.debug("retreived XSLT transformation cache for a key '" + cacheKey + "'");
                            }
                           
                            // attach rendering buffer downstream of the cached buffer
                            ChannelRenderingBuffer crb = new ChannelRenderingBuffer(cachedBuffer, channelManager, ccaching, req, res);
                           
                            // attach channel incorporation filter downstream of the channel rendering buffer
                            cif.setParent(crb);
                            crb.setOutputAtDocumentEnd(true);
                            cachedBuffer.outputBuffer(crb);

                            output_produced = true;
                        }
                    }
                }
                // fallback on the regular rendering procedure
                if (!output_produced) {

                    // obtain transformer handlers for both structure and theme stylesheets
                    TransformerHandler ssth = XSLT.getTransformerHandler(ResourceLoader.getResourceAsURL(this.getClass(), ssd.getStylesheetURI()).toString());
                    TransformerHandler tsth = XSLT.getTransformerHandler(tsd.getStylesheetURI(), localeManager
                            .getLocales(), this);

                    // obtain transformer references from the handlers
                    Transformer sst = ssth.getTransformer();
                    sst.setErrorListener(cErrListener);
                    Transformer tst = tsth.getTransformer();
                    tst.setErrorListener(cErrListener);
                   
                    // pass resourcesDao into transformer
                    tst.setParameter(ResourcesXalanElements.SKIN_RESOURCESDAO_PARAMETER_NAME, resourcesElementsProvider);
                    tst.setParameter(ResourcesXalanElements.CURRENT_REQUEST, req);

                    // initialize ChannelRenderingBuffer and attach it downstream of the structure transformer
                    ChannelRenderingBuffer crb = new ChannelRenderingBuffer(channelManager, ccaching, req, res);
                    ssth.setResult(new SAXResult(crb));

                    // determine and set the stylesheet params
                    // prepare .uP element and detach flag to be passed to the stylesheets
                    // Including the context path in front of uPElement is necessary for phone.com browsers to work
                    sst.setParameter("baseActionURL", uPElement.getUPFile());
                    // construct idempotent version of the uPElement
                    UPFileSpec uPIdempotentElement = new UPFileSpec(uPElement);
                    sst.setParameter("baseIdempotentActionURL", uPElement.getUPFile());

                    Hashtable<String, String> supTable = userPreferences.getStructureStylesheetUserPreferences()
                            .getParameterValues();
                    for (Map.Entry<String, String> param : supTable.entrySet()) {
                        String pName = param.getKey();
                        String pValue = param.getValue();
                        if (log.isDebugEnabled())
                            log.debug("setting sparam \"" + pName + "\"=\"" + pValue
                                    + "\".");
                        sst.setParameter(pName, pValue);
                    }

                    // all the parameters are set up, fire up structure transformation

                    // filter to fill in channel/folder attributes for the "structure" transformation.
                    StructureAttributesIncorporationFilter saif = new StructureAttributesIncorporationFilter(ssth,
                            userPreferences.getStructureStylesheetUserPreferences());

                    // This is a debug statement that will print out XML incoming to the
                    // structure transformation to a log file serializer to a printstream
                    StringWriter dbwr1 = null;
                    OutputFormat outputFormat = null;
                    if (logXMLBeforeStructureTransformation && log.isDebugEnabled()) {
                        dbwr1 = new StringWriter();
                        outputFormat = new OutputFormat();
                        outputFormat.setIndenting(true);
                        XMLSerializer dbser1 = new XMLSerializer(dbwr1, outputFormat);
                        SAX2DuplicatingFilterImpl dupl1 = new SAX2DuplicatingFilterImpl(ssth, dbser1);
                        dupl1.setParent(saif);
                    }

                    // if operating in the detach mode, need wrap everything
                    // in a document node and a <layout_fragment> node
                    boolean detachMode = !rootNodeId.equals(UPFileSpec.USER_LAYOUT_ROOT_NODE);
                    if (detachMode) {
                        saif.startDocument();
                        saif.startElement("",
                                "layout_fragment",
                                "layout_fragment",
                                new org.xml.sax.helpers.AttributesImpl());

                        //                            emptyt.transform(new DOMSource(rElement),new SAXResult(new ChannelSAXStreamFilter((ContentHandler)saif)));
                        if (rElement == null) {
                            ulm.getUserLayout(new ChannelSAXStreamFilter((ContentHandler) saif));
                        }
                        else {
                            ulm.getUserLayout(rElement.getId(), new ChannelSAXStreamFilter((ContentHandler) saif));
                        }

                        saif.endElement("", "layout_fragment", "layout_fragment");
                        saif.endDocument();
                    }
                    else {
                        if (rElement == null) {
                            ulm.getUserLayout(saif);
                        }
                        else {
                            ulm.getUserLayout(rElement.getId(), saif);
                        }
                        //                            emptyt.transform(new DOMSource(rElement),new SAXResult((ContentHandler)saif));
                    }
                    // all channels should be rendering now

                    // Debug piece to print out the recorded pre-structure transformation XML
                    if (logXMLBeforeStructureTransformation && log.isDebugEnabled()) {
                            log.debug("XML incoming to the structure transformation :\n\n"
                                            + dbwr1.toString() + "\n\n");
                    }

                    // prepare for the theme transformation

                    // set up of the parameters
                    tst.setParameter("baseActionURL", uPElement.getUPFile());
                    tst.setParameter("baseIdempotentActionURL", uPIdempotentElement.getUPFile());
                    if (externalLoginUrl != null) {
                        tst.setParameter("EXTERNAL_LOGIN_URL", externalLoginUrl);
                    }

                    Hashtable<String, String> tupTable = userPreferences.getThemeStylesheetUserPreferences()
                            .getParameterValues();
                    for (Map.Entry<String, String> param : tupTable.entrySet()) {
                        String pName = param.getKey();
                        String pValue = param.getValue();
                        if (log.isDebugEnabled())
                            log.debug("setting tparam \"" + pName + "\"=\"" + pValue
                                    + "\".");
                        tst.setParameter(pName, pValue);
                    }

                    VersionsManager versionsManager = VersionsManager.getInstance();
                    Version[] versions = versionsManager.getVersions();

                    for (Version version : versions) {
                        String paramName = "version-" + version.getFname();
                        tst.setParameter(paramName, version.dottedTriple());
                    }

                    // the uP_productAndVersion stylesheet parameter is deprecated
                    // instead use the more generic "version-UP_VERSION" generated from the
                    // framework's functional name when all versions are pulled immediately
                    // above.
                    Version uPortalVersion = versionsManager.getVersion(IPermission.PORTAL_FRAMEWORK);
                    tst.setParameter("uP_productAndVersion", "uPortal " + uPortalVersion.dottedTriple());

                    final Locale[] locales = localeManager.getLocales();
                    if (locales != null && locales.length > 0 && locales[0] != null) {
                        tst.setParameter("USER_LANG", locales[0].toString().replace('_', '-'));
                    }

                    // initialize a filter to fill in channel attributes for the "theme" (second) transformation.
                    // attach it downstream of the channel rendering buffer
                    ThemeAttributesIncorporationFilter taif = new ThemeAttributesIncorporationFilter(
                            (XMLReader) crb, userPreferences.getThemeStylesheetUserPreferences());
                    // attach theme transformation downstream of the theme attribute incorporation filter
                    taif.setAllHandlers(tsth);

                    // This is a debug statement that will print out XML incoming to the
                    // theme transformation to a log file serializer to a printstream
                    StringWriter dbwr2 = null;
                    if (logXMLBeforeThemeTransformation && log.isDebugEnabled()) {
                        dbwr2 = new StringWriter();
                        XMLSerializer dbser2 = new XMLSerializer(dbwr2, outputFormat);
                        SAX2DuplicatingFilterImpl dupl2 = new SAX2DuplicatingFilterImpl(tsth, dbser2);
                        dupl2.setParent(taif);
                    }

                    if (CACHE_ENABLED && !ccaching) {
                        // record cache
                        // attach caching buffer downstream of the theme transformer
                        SAX2BufferImpl newCache = new SAX2BufferImpl();
                        tsth.setResult(new SAXResult(newCache));

                        // attach channel incorporation filter downstream of the caching buffer
                        cif.setParent(newCache);

                        systemCache.put(cacheKey, newCache);
                        newCache.setOutputAtDocumentEnd(true);
                        if (log.isDebugEnabled())
                            log.debug("recorded transformation cache with key \""
                                    + cacheKey + "\"");
                    }
                    else {
                        // attach channel incorporation filter downstream of the theme transformer
                        tsth.setResult(new SAXResult(cif));
                    }
                    // fire up theme transformation
                    crb.stopBuffering();
                    crb.outputBuffer();
                    crb.clearBuffer();

                    // Debug piece to print out the recorded pre-theme transformation XML
                    if (logXMLBeforeThemeTransformation && log.isDebugEnabled()) {
                        log.debug("XML incoming to the theme transformation :\n\n"
                                + dbwr2.toString() + "\n\n");
                    }

                    if (CACHE_ENABLED && ccaching) {
                        // save character block cache
                        List<CacheEntry> cacheBlocks = cif.getCacheBlocks();
                        if(cacheBlocks == null) {
                            log
                                    .error("CharacterCachingChannelIncorporationFilter returned invalid cache entries!");
                        }
                        else {
                            // record cache
                            systemCharacterCache.put(cacheKey, cacheBlocks);
                            if (log.isDebugEnabled()) {
                                log
                                        .debug("recorded transformation character block cache with key \""
                                                + cacheKey + "\"");

                                log.debug("Printing transformation cache blocks:");
                                for (int i=0; i<cacheBlocks.size(); i++) {
                                    CacheEntry ce = cacheBlocks.get(i);
                                    if (ce.getCacheType().equals(CacheType.CHARACTERS)) {
                                        log.debug("----------piece "+Integer.toString(i));
                                    } else if (ce.getCacheType().equals(CacheType.CHANNEL_CONTENT)) {
                                        log.debug("----------channel content entry "+Integer.toString(i));
                                    }
                                    DebugCachingSerializer dcs = new DebugCachingSerializer();
                                    ce.replayCache(dcs, channelManager, req, res);
                                    log.debug(dcs.getCache());
                                }
                            }
                        }
                    }
View Full Code Here

Examples of org.jruby.runtime.callsite.CacheEntry

     *
     * @param name The name of the method to search for
     * @return The method, or UndefinedMethod if not found
     */   
    public CacheEntry searchWithCache(String name) {
        CacheEntry entry = cacheHit(name);

        if (entry != null) return entry;

        // we grab serial number first; the worst that will happen is we cache a later
        // update with an earlier serial number, which would just flush anyway
View Full Code Here

Examples of org.nasutekds.server.types.CacheEntry

      cacheMisses.getAndIncrement();
      return null;
    }
    else
    {
      CacheEntry cacheEntry = ref.get();
      if (cacheEntry == null)
      {
        // Indicate cache miss.
        cacheMisses.getAndIncrement();
        return null;
      }
      else
      {
        // Indicate cache hit.
        cacheHits.getAndIncrement();
        return cacheEntry.getEntry();
      }
    }
  }
View Full Code Here

Examples of org.objectweb.perseus.cache.api.CacheEntry

                State s = tx.lookup(pn);
                if (s != null && s != VirtualState.instance) {
                    return s.getCacheEntry();
                } else {
                    //Fetch an instance (new or from the cache)
                    CacheEntry ce = tpm.getObjectById(tx, pn);
                    //clear the state
                    tpm.refresh(tx, ce);
                    //if it exists then object loading else exception
                    tpm.readIntention(tx, ce, null);
                    return ce;
View Full Code Here

Examples of org.wso2.carbon.clustering.hazelcast.jsr107.CacheEntry

*/
public class LeastRecentlyUsedEvictionAlgorithm implements EvictionAlgorithm {

    @SuppressWarnings("unchecked")
    public void evict(CacheImpl cache) {
        CacheEntry lruCacheEntry = null;
        for (Object o : cache.getAll()) {
            CacheEntry cacheEntry = (CacheEntry) o;
            if (lruCacheEntry == null) {
                lruCacheEntry = cacheEntry;
            } else if (lruCacheEntry.getLastAccessed() > cacheEntry.getLastAccessed()) {
                lruCacheEntry = cacheEntry;
            }
        }
        if (lruCacheEntry != null) {
            cache.evict(lruCacheEntry.getKey());
View Full Code Here

Examples of org.wso2.carbon.clustering.hazelcast.jsr107.CacheEntry

*/
public class MostRecentlyUsedEvictionAlgorithm implements EvictionAlgorithm {

    @SuppressWarnings("unchecked")
    public void evict(CacheImpl cache) {
        CacheEntry mruCacheEntry = null;
        for (Object o : cache.getAll()) {
            CacheEntry cacheEntry = (CacheEntry) o;
            if (mruCacheEntry == null) {
                mruCacheEntry = cacheEntry;
            } else if (mruCacheEntry.getLastAccessed() < cacheEntry.getLastAccessed()) {
                mruCacheEntry = cacheEntry;
            }
        }
        if (mruCacheEntry != null) {
            cache.evict(mruCacheEntry.getKey());
View Full Code Here

Examples of org.wso2.carbon.clustering.hazelcast.jsr107.CacheEntry

public class RandomEvictionAlgorithm implements EvictionAlgorithm {
    private static Random random = new Random();

    @SuppressWarnings("unchecked")
    public void evict(CacheImpl cache) {
        CacheEntry lruCacheEntry = null;
        Collection all = cache.getAll();
        int evictionIndex = random.nextInt(all.size());
        int index = 0;

        for (Object anAll : all) {
            CacheEntry cacheEntry = (CacheEntry) anAll;
            if (index == evictionIndex) {
                lruCacheEntry = cacheEntry;
                break;
            }
            index++;
View Full Code Here

Examples of org.xlightweb.client.HttpCache.CacheEntry

      }
     
        
      // handle caching
      try {
            CacheEntry ce = cache.get(request, minFresh);
            // is cache entry valid?
            if (ce != null) {
               
                if ((maxOld != null) && (ce.isAfter(maxOld))) {
                    forwardForCache(exchange);
                    return;
                }
               
                // must revalidate?
                if (ce.mustRevalidate(minFresh)) {
                   
                    if (isOnlyIfCached) {
                        countCacheMiss++;
                        exchange.sendError(504);
                       
                    } else {
                        IValidationHandler validationHdl = new IValidationHandler() {
                           
                            public void onRevalidated(boolean isNotModified, CacheEntry ce) {
                               
                                if (isNotModified) {
                                    try {
                                        countCacheHit++;
                                        IHttpResponse resp = ce.newResponse();
                                        resp.setHeader(XHEADER_NAME, "HIT - revalidated (xLightweb)");
                                        exchange.send(resp);
                                    } catch (IOException ioe) {
                                        exchange.sendError(ioe);
                                    }
                                } else  {
                                    try {
                                        countCacheMiss++;
                                        IHttpResponse resp = ce.newResponse();
                                        exchange.send(resp);
                                    } catch (IOException ioe) {
                                        exchange.sendError(ioe);
                                    }
                                }
                            }
                           
                            public void onException(IOException ioe) {
                                exchange.sendError(ioe);
                            }
                           
                        };

                        ce.revalidate(validationHdl);
                    }
                 
                // no, return cached response
                } else {
                    countCacheHit++;
                    IHttpResponse resp = ce.newResponse();
                    resp.setHeader(XHEADER_NAME, "HIT  (xLightweb)");

                    exchange.send(resp);
                }
              
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.