Commit fc7f63e9 authored by Alex Wenckus's avatar Alex Wenckus Committed by alex

1) File transfer should implement cachable. JM-653

2) Changed proxy cache name. JM-654

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3812 b35dd754-fafc-0310-a699-88a17e54d16e
parent eb46cf8c
......@@ -10,12 +10,15 @@
*/
package org.jivesoftware.wildfire.filetransfer;
import org.jivesoftware.util.Cacheable;
import org.jivesoftware.util.CacheSizes;
/**
* Contains all of the meta information associated with a file transfer.
*
* @author Alexander Wenckus
*/
public class FileTransfer {
public class FileTransfer implements Cacheable {
private String sessionID;
private String initiator;
......@@ -96,4 +99,19 @@ public class FileTransfer {
public void setProgress(FileTransferProgress progress) {
this.progress = progress;
}
public int getCachedSize() {
// Approximate the size of the object in bytes by calculating the size
// of each field.
int size = 0;
size += CacheSizes.sizeOfObject(); // overhead of object
size += CacheSizes.sizeOfString(initiator);
size += CacheSizes.sizeOfString(target);
size += CacheSizes.sizeOfString(sessionID);
size += CacheSizes.sizeOfString(fileName);
size += CacheSizes.sizeOfString(mimeType);
size += CacheSizes.sizeOfLong(); // File size
size += CacheSizes.sizeOfObject(); // Progress
return size;
}
}
/**
* $RCSfile$
* $Revision: 1217 $
* $Date: 2005-04-11 18:11:06 -0300 (Mon, 11 Apr 2005) $
* $Revision: 3762 $
* $Date: 2006-04-12 18:07:15 -0500 (Mon, 12 Apr 2005) $
*
* Copyright (C) 1999-2006 Jive Software. All rights reserved.
*
......@@ -56,7 +56,7 @@ public class ProxyConnectionManager {
public ProxyConnectionManager(FileTransferManager manager) {
String cacheName = "File Transfer";
CacheManager.initializeCache(cacheName, "filetransfer", -1, 1000 * 60 * 10);
CacheManager.initializeCache(cacheName, "fileproxytransfer", -1, 1000 * 60 * 10);
connectionMap = CacheManager.getCache(cacheName);
className = JiveGlobals.getProperty("provider.transfer.proxy",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment