Top Description Fields Constructors Methods
org.glassfish.grizzly.http.server.filecache

public final Class FileCacheEntry

extends Object
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable
Imports
java.io.File, java.nio.ByteBuffer, java.util.concurrent.atomic.AtomicBoolean, java.util.logging.Level, .Logger, org.glassfish.grizzly.Grizzly, org.glassfish.grizzly.http.CompressionConfig, .HttpRequestPacket, org.glassfish.grizzly.http.util.ContentType

The entry value in the file cache map.
Author
Alexey Stashok

Field Summary

Modifier and TypeField and Description
pack-priv ByteBuffer
private boolean
pack-priv ByteBuffer
pack-priv volatile File
pack-priv long
public ContentType
public String
public String
private final FileCache
public String
private AtomicBoolean
public FileCacheKey
public long
public String
private static final Logger
pack-priv File
pack-priv long
public String
public String
public volatile long
public FileCache.CacheType
public String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
canServeCompressed(final HttpRequestPacket request)

Returns true if this entry could be served compressed as response to this (passed) specific HttpRequestPacket.

protected void
finalize()

Overrides java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

public ByteBuffer

Returns:

the entry's ByteBuffer reference
getByteBuffer
(final boolean
if true the compressed ByteBuffer will be returned, otherwise uncompressed ByteBuffer will be returned as the result.
isCompressed
)

Returns the entry's ByteBuffer representation.

public File

Returns:

the entry's File reference
getFile
(final boolean
if true the compressed File reference will be returned, otherwise uncompressed File reference will be returned as the result.
isCompressed
)

Returns the entry's File reference.

public long

Returns:

the entry file size
getFileSize
(final boolean
if true the compressed file size will be returned, otherwise uncompressed file size will be returned as the result.
isCompressed
)

Returns the entry file size.

public void
run()

Implements java.lang.Runnable.run.

Runs this operation.

pack-priv void
setCanBeCompressed(final boolean canBeCompressed)

true means this entry could be served compressed, if client supports compression, or false if this entry should be always served as it is.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsgetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

bbback to summary
pack-priv ByteBuffer bb
canBeCompressedback to summary
private boolean canBeCompressed
compressedBbback to summary
pack-priv ByteBuffer compressedBb
compressedFileback to summary
pack-priv volatile File compressedFile
compressedFileSizeback to summary
pack-priv long compressedFileSize
contentTypeback to summary
public ContentType contentType
dateback to summary
public String date
Etagback to summary
public String Etag
fileCacheback to summary
private final FileCache fileCache
hostback to summary
public String host
isCompressedback to summary
private AtomicBoolean isCompressed
keyback to summary
public FileCacheKey key
lastModifiedback to summary
public long lastModified
lastModifiedHeaderback to summary
public String lastModifiedHeader
LOGGERback to summary
private static final Logger LOGGER
plainFileback to summary
pack-priv File plainFile
plainFileSizeback to summary
pack-priv long plainFileSize
requestURIback to summary
public String requestURI
serverback to summary
public String server
timeoutMillisback to summary
public volatile long timeoutMillis
typeback to summary
public FileCache.CacheType type
xPoweredByback to summary
public String xPoweredBy

Constructor Detail

FileCacheEntryback to summary
public FileCacheEntry(FileCache fileCache)

Method Detail

canServeCompressedback to summary
public boolean canServeCompressed(final HttpRequestPacket request)

Returns true if this entry could be served compressed as response to this (passed) specific HttpRequestPacket. Or false will be returned otherwise.

finalizeback to summary
protected void finalize() throws Throwable

Overrides java.lang.Object.finalize.

Doc from java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the finalize method to dispose of system resources or to perform other cleanup.

When running in a Java virtual machine in which finalization has been disabled or removed, the garbage collector will never call finalize(). In a Java virtual machine in which finalization is enabled, the garbage collector might call finalize only after an indefinite delay.

The general contract of finalize is that it is invoked if and when the Java virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The finalize method may take any action, including making this object available again to other threads; the usual purpose of finalize, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The finalize method of class Object performs no special action; it simply returns normally. Subclasses of Object may override this definition.

The Java programming language does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the finalize method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The finalize method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored.

Annotations
@Override
Exceptions
Throwable:
the Exception raised by this method
getByteBufferback to summary
public ByteBuffer getByteBuffer(final boolean isCompressed)

Returns the entry's ByteBuffer representation.

Parameters
isCompressed:boolean

if true the compressed ByteBuffer will be returned, otherwise uncompressed ByteBuffer will be returned as the result.

Returns:ByteBuffer

the entry's ByteBuffer reference

getFileback to summary
public File getFile(final boolean isCompressed)

Returns the entry's File reference.

Parameters
isCompressed:boolean

if true the compressed File reference will be returned, otherwise uncompressed File reference will be returned as the result.

Returns:File

the entry's File reference

getFileSizeback to summary
public long getFileSize(final boolean isCompressed)

Returns the entry file size.

Parameters
isCompressed:boolean

if true the compressed file size will be returned, otherwise uncompressed file size will be returned as the result.

Returns:long

the entry file size

runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override
setCanBeCompressedback to summary
pack-priv void setCanBeCompressed(final boolean canBeCompressed)

true means this entry could be served compressed, if client supports compression, or false if this entry should be always served as it is.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override