Examples of BytestreamCache


Examples of com.caucho.distcache.ByteStreamCache

    }
  }
 
  private long getLastUseTime()
  {
    ByteStreamCache cache = _manager.getCache();

    if (cache == null)
      return _lastUseTime;

    ExtCacheEntry entry = cache.peekExtCacheEntry(_id);
    // server/01ke
   
    if (entry == null)
      return _lastUseTime;
    else
View Full Code Here

Examples of com.caucho.distcache.ByteStreamCache

    // server/01k0
    if (_useCount.get() > 1)
      return true;

    try {
      ByteStreamCache cache = _manager.getCache();

      if (cache == null)
        return ! isNew;

      // server/015m
      if (! isNew && _manager.isSaveOnShutdown())
        return true;

      ExtCacheEntry entry = cache.getExtCacheEntry(_id);
      ExtCacheEntry cacheEntry = _cacheEntry;

      if (entry != null) {
        // server/01a1, #4419
        _idleTimeout = entry.getIdleTimeout() * 4 / 5;
        //_isIdleSet = true;
      }
     
      if (entry != null && cacheEntry != null
          && cacheEntry.getValueHashKey() != null
          && cacheEntry.getValueHashKey().equals(entry.getValueHashKey())) {
        if (log.isLoggable(Level.FINE)) {
          log.fine(this + " session load-same valueHash="
                   + (entry != null ? entry.getValueHashKey() : null));
        }
       
        return true;
      }

      TempOutputStream os = new TempOutputStream();

      if (cache.get(_id, os)) {
        InputStream is = os.getInputStream();

        SessionDeserializer in = _manager.createSessionDeserializer(is);

        if (log.isLoggable(Level.FINE)) {
View Full Code Here

Examples of com.caucho.distcache.ByteStreamCache

  /**
   * Returns a debug string for the session
   */
  public String getSessionSerializationDebug(String id)
  {
    ByteStreamCache cache = getCache();

    if (cache == null)
      return null;

    try {
      TempOutputStream os = new TempOutputStream();

      if (cache.get(id, os)) {
        InputStream is = os.getInputStream();

        StringWriter writer = new StringWriter();

        HessianDebugInputStream dis
View Full Code Here

Examples of com.caucho.distcache.ByteStreamCache

  /**
   * Returns a debug string for the session
   */
  public String getSessionSerializationDebug(String id)
  {
    ByteStreamCache cache = getCache();

    if (cache == null)
      return null;

    try {
      TempOutputStream os = new TempOutputStream();

      if (cache.get(id, os)) {
        InputStream is = os.getInputStream();

        StringWriter writer = new StringWriter();

        HessianDebugInputStream dis
View Full Code Here

Examples of com.caucho.distcache.ByteStreamCache

    // server/01k0
    if (_useCount.get() > 1)
      return true;

    try {
      ByteStreamCache cache = _manager.getCache();

      if (cache == null)
        return ! isNew;

      // server/015m
      if (! isNew && _manager.isSaveOnShutdown())
        return true;

      ExtCacheEntry entry = cache.getExtCacheEntry(_id);
      ExtCacheEntry cacheEntry = _cacheEntry;

      if (entry != null && cacheEntry != null
          && cacheEntry.getValueHashKey() != null
          && cacheEntry.getValueHashKey().equals(entry.getValueHashKey())) {
        return true;
      }

      TempOutputStream os = new TempOutputStream();

      if (cache.get(_id, os)) {
        InputStream is = os.getInputStream();

        SessionDeserializer in = _manager.createSessionDeserializer(is);

        if (log.isLoggable(Level.FINE)) {
View Full Code Here

Examples of com.ibm.commons.util.io.ByteStreamCache

  }

  protected byte[] toByteArray(Object object) throws CredentialStoreException {
    try {
      if(object!=null) {
        ByteStreamCache bs = new ByteStreamCache(1024);
        ObjectOutputStream os = new ObjectOutputStream(bs.getOutputStream());
        try {
          os.writeObject(object);
          return bs.toByteArray();
        } finally {
          os.close();
        }
      }
      return null;
View Full Code Here

Examples of com.ibm.commons.util.io.ByteStreamCache

    try {
      // When no length is specified, the HTTP client core forces Transfert-Encoding: chunked
      // The code bellow shows a workaround, although we should avoid that
      if(false) {
        if(length<0) {
          ByteStreamCache bs = new ByteStreamCache();
          bs.copyFrom(request.getInputStream());
          HttpEntity payloadEntity = new InputStreamEntity(bs.getInputStream(), bs.getLength());
          ((HttpEntityEnclosingRequest) method).setEntity(payloadEntity);
          return method;
        }
      }
      // Regular code
View Full Code Here

Examples of com.ibm.commons.util.io.ByteStreamCache

       
        JarEntry entry = new JarEntry( entryName );
        entry.setMethod( ZipEntry.DEFLATED );
       
        CRC32 checksumCalculator= new CRC32();
        ByteStreamCache bsc = new ByteStreamCache();
        entry.setSize( StreamUtil.copyStream( is, bsc.getOutputStream() ));
        checksumCalculator.update( bsc.toByteArray() );
        entry.setCrc(checksumCalculator.getValue());
       
        jarOS.putNextEntry( entry );
        //Now that we have the correct size, we can copy it to the jar stream
        StreamUtil.copyStream( bsc.getInputStream(), jarOS );
       
        entriesSet.add( entryName );
    }
View Full Code Here

Examples of com.ibm.commons.util.io.ByteStreamCache

  }
 
  private void emit(HttpServletResponse resp, String text, String contentType) throws IOException {
    resp.setStatus(200);
    resp.setContentType(contentType);
    ByteStreamCache bs = new ByteStreamCache();
    InputStream is = new ReaderInputStream(new StringReader(text),"utf-8");
    bs.copyFrom(is);
    resp.setContentLength((int)bs.getLength());
    OutputStream os = resp.getOutputStream();
    bs.copyTo(os);
    os.flush();
  }
View Full Code Here

Examples of org.apache.tapestry5.internal.services.assets.BytestreamCache

        // The content is minimized, but can still be (GZip) compressed.

        StreamableResource output = new StreamableResourceImpl("minimized " + input.getDescription(),
                input.getContentType(), CompressionStatus.COMPRESSABLE,
                input.getLastModified(), new BytestreamCache(bos));

        if (logger.isInfoEnabled())
        {
            long elapsedNanos = System.nanoTime() - startNanos;
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.