| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | FileClientSessionCache.CacheFile
A file containing a piece of cached data. |
| pack-priv static class | FileClientSessionCache.Impl
This cache creates one file per SSL session using "host.port" for the file name. |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final Map | caches
Maps directories to the cache instances that are backed by those directories. |
| private static final Logger | |
| public static final int |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static synchronized void | |
| public static synchronized SSLClientSessionCache | Returns: a cache backed by the given directoryto store files in directory)Returns a cache backed by the given directory. |
| caches | back to summary |
|---|---|
| pack-priv static final Map<File, FileClientSessionCache. Maps directories to the cache instances that are backed by those directories. We synchronize access using the cache instance, so it's important that everyone shares the same instance. | |
| logger | back to summary |
|---|---|
| private static final Logger logger | |
| MAX_SIZE | back to summary |
|---|---|
| public static final int MAX_SIZE | |
| FileClientSessionCache | back to summary |
|---|---|
| private FileClientSessionCache() | |
| reset | back to summary |
|---|---|
| pack-priv static synchronized void reset() For testing. | |
| usingDirectory | back to summary |
|---|---|
| public static synchronized SSLClientSessionCache usingDirectory(File directory) throws IOException Returns a cache backed by the given directory. Creates the directory (including parent directories) if necessary. This cache should have exclusive access to the given directory.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv long | |
| pack-priv final String |
| Modifier and Type | Method and Description |
|---|---|
| public int | compareTo(File
The abstract pathname to be compared to this abstract
pathname another)Overrides java. Implements java. |
| public long | lastModified()
Overrides java. |
| lastModified | back to summary |
|---|---|
| pack-priv long lastModified | |
| name | back to summary |
|---|---|
| pack-priv final String name | |
| CacheFile | back to summary |
|---|---|
| pack-priv CacheFile(File dir, String name) | |
| compareTo | back to summary |
|---|---|
| public int compareTo(File another) Overrides java. Implements java. Doc from java. Compares two abstract pathnames lexicographically. The ordering defined by this method depends upon the underlying system. On UNIX systems, alphabetic case is significant in comparing pathnames; on Microsoft Windows systems it is not.
| |
| lastModified | back to summary |
|---|---|
| public long lastModified() Overrides java. Doc from java. Returns the time that the file denoted by this abstract pathname was last modified.
| |
putSessionData). Files are read on
cache hits, but not on cache misses.
When the number of session files exceeds MAX_SIZE, we delete the least-recently-used file. We don't current persist the last access time, so the ordering actually ends up being least-recently-modified in some cases and even just "not accessed in this process" if the filesystem doesn't track last modified times.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Map | accessOrder
Map of name -> File. |
| pack-priv final File | directory
Directory to store session files in. |
| pack-priv String[] | initialFiles
The initial set of files. |
| pack-priv int | size
The number of files on disk. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private static String | |
| public synchronized byte[] | getSessionData(String host, int port)
Implements org. |
| private void | indexFiles()
Lazily updates accessOrder to know about all files as opposed to just the files accessed since this process started. |
| pack-priv static void | |
| pack-priv static void | |
| private void | |
| private static Map | |
| public synchronized void | putSessionData(SSLSession
to cache data for session, byte[] to cache sessionData)Implements org. |
| accessOrder | back to summary |
|---|---|
| pack-priv Map<String, File> accessOrder Map of name -> File. Keeps track of the order files were accessed in. | |
| directory | back to summary |
|---|---|
| pack-priv final File directory Directory to store session files in. | |
| initialFiles | back to summary |
|---|---|
| pack-priv String[] initialFiles The initial set of files. We use this to defer adding information about all files to accessOrder until necessary. | |
| size | back to summary |
|---|---|
| pack-priv int size The number of files on disk. | |
| Impl | back to summary |
|---|---|
| pack-priv Impl(File directory) throws IOException Constructs a new cache backed by the given directory. | |
| delete | back to summary |
|---|---|
private void delete(File file)
| |
| fileName | back to summary |
|---|---|
| private static String fileName(String host, int port) Gets the file name for the given host and port. | |
| getSessionData | back to summary |
|---|---|
| public synchronized byte[] getSessionData(String host, int port) Implements org. Doc from org. Gets data from a pre-existing session for a given server host and port.
| |
| indexFiles | back to summary |
|---|---|
| private void indexFiles() Lazily updates accessOrder to know about all files as opposed to just the files accessed since this process started. | |
| logReadError | back to summary |
|---|---|
| pack-priv static void logReadError(String host, File file, Throwable t) | |
| logWriteError | back to summary |
|---|---|
| pack-priv static void logWriteError(String host, File file, Throwable t) | |
| makeRoom | back to summary |
|---|---|
| private void makeRoom() Deletes old files if necessary. | |
| newAccessOrder | back to summary |
|---|---|
| private static Map Creates a new access-ordered linked hash map. | |
| putSessionData | back to summary |
|---|---|
| public synchronized void putSessionData(SSLSession session, byte[] sessionData) Implements org. Doc from org. Stores session data for the given session.
| |