//package com.cache;
//
//
//
//import java.io.IOException;
//import java.io.ObjectOutputStream;
//import java.io.OutputStream;
//import java.util.ArrayList;
//import java.util.Collection;
//import java.util.HashMap;
//import java.util.HashSet;
//import java.util.Iterator;
//import java.util.Map;
//import java.util.NoSuchElementException;
//import java.util.Set;
//
//import org.jivesoftware.util.LinkedListNode;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
///**
// * Default, non-distributed implementation of the Cache interface.
// * The algorithm for cache is as follows: a HashMap is maintained for fast
// * object lookup. Two linked lists are maintained: one keeps objects in the
// * order they are accessed from cache, the other keeps objects in the order
// * they were originally added to cache. When objects are added to cache, they
// * are first wrapped by a CacheObject which maintains the following pieces
// * of information:<ul>
// *
// * <li> The size of the object (in bytes).
// * <li> A pointer to the node in the linked list that maintains accessed
// * order for the object. Keeping a reference to the node lets us avoid
// * linear scans of the linked list.
// * <li> A pointer to the node in the linked list that maintains the age
// * of the object in cache. Keeping a reference to the node lets us avoid
// * linear scans of the linked list.</ul><p>
// *
// * To get an object from cache, a hash lookup is performed to get a reference
// * to the CacheObject that wraps the real object we are looking for.
// * The object is subsequently moved to the front of the accessed linked list
// * and any necessary cache cleanups are performed. Cache deletion and expiration
// * is performed as needed.
// *
// * @author Matt Tucker
// */
//public class DefaultCache<K, V> implements Cache<K, V> {
//
// private static final Logger Log = LoggerFactory.getLogger(DefaultCache.class);
//
// /**
// * The map the keys and values are stored in.
// */
// protected Map<K, DefaultCache.CacheObject<V>> map;
//
// /**
// * Linked list to maintain order that cache objects are accessed
// * in, most used to least used.
// */
// protected org.jivesoftware.util.LinkedList lastAccessedList;
//
// /**
// * Linked list to maintain time that cache objects were initially added
// * to the cache, most recently added to oldest added.
// */
// protected org.jivesoftware.util.LinkedList ageList;
//
// /**
// * Maximum size in bytes that the cache can grow to.
// */
// private long maxCacheSize;
//
// /**
// * Maintains the current size of the cache in bytes.
// */
// private int cacheSize = 0;
//
// /**
// * Maximum length of time objects can exist in cache before expiring.
// */
// protected long maxLifetime;
//
// /**
// * Maintain the number of cache hits and misses. A cache hit occurs every
// * time the get method is called and the cache contains the requested
// * object. A cache miss represents the opposite occurence.<p>
// *
// * Keeping track of cache hits and misses lets one measure how efficient
// * the cache is; the higher the percentage of hits, the more efficient.
// */
// protected long cacheHits, cacheMisses = 0L;
//
// /**
// * The name of the cache.
// */
// private String name;
//
// /**
// * Create a new default cache and specify the maximum size of for the cache in
// * bytes, and the maximum lifetime of objects.
// *
// * @param name a name for the cache.
// * @param maxSize the maximum size of the cache in bytes. -1 means the cache
// * has no max size.
// * @param maxLifetime the maximum amount of time objects can exist in
// * cache before being deleted. -1 means objects never expire.
// */
// public DefaultCache(String name, long maxSize, long maxLifetime) {
// this.name = name;
// this.maxCacheSize = maxSize;
// this.maxLifetime = maxLifetime;
//
// // Our primary data structure is a HashMap. The default capacity of 11
// // is too small in almost all cases, so we set it bigger.
// map = new HashMap<K, CacheObject<V>>(103);
//
// lastAccessedList = new org.jivesoftware.util.LinkedList();
// ageList = new org.jivesoftware.util.LinkedList();
// }
//
// public synchronized V put(K key, V value) {
// // Delete an old entry if it exists.
// V answer = remove(key);
//
// int objectSize = calculateSize(value);
//
// // If the object is bigger than the entire cache, simply don't add it.
// if (maxCacheSize > 0 && objectSize > maxCacheSize * .90) {
// Log.warn("Cache: " + name + " -- object with key " + key +
// " is too large to fit in cache. Size is " + objectSize);
// return value;
// }
// cacheSize += objectSize;
// DefaultCache.CacheObject<V> cacheObject = new DefaultCache.CacheObject<V>(value, objectSize);
// map.put(key, cacheObject);
// // Make an entry into the cache order list.
// LinkedListNode lastAccessedNode = lastAccessedList.addFirst(key);
// // Store the cache order list entry so that we can get back to it
// // during later lookups.
// cacheObject.lastAccessedListNode = lastAccessedNode;
// // Add the object to the age list
// LinkedListNode ageNode = ageList.addFirst(key);
// // We make an explicit call to currentTimeMillis() so that total accuracy
// // of lifetime calculations is better than one second.
// ageNode.timestamp = System.currentTimeMillis();
// cacheObject.ageListNode = ageNode;
//
// // If cache is too full, remove least used cache entries until it is
// // not too full.
// cullCache();
//
// return answer;
// }
//
// public synchronized V get(Object key) {
// // First, clear all entries that have been in cache longer than the
// // maximum defined age.
// deleteExpiredEntries();
//
// DefaultCache.CacheObject<V> cacheObject = map.get(key);
// if (cacheObject == null) {
// // The object didn't exist in cache, so increment cache misses.
// cacheMisses++;
// return null;
// }
//
// // The object exists in cache, so increment cache hits. Also, increment
// // the object's read count.
// cacheHits++;
// cacheObject.readCount++;
//
// // Remove the object from it's current place in the cache order list,
// // and re-insert it at the front of the list.
// cacheObject.lastAccessedListNode.remove();
// lastAccessedList.addFirst(cacheObject.lastAccessedListNode);
//
// return cacheObject.object;
// }
//
// public synchronized V remove(Object key) {
// DefaultCache.CacheObject<V> cacheObject = map.get(key);
// // If the object is not in cache, stop trying to remove it.
// if (cacheObject == null) {
// return null;
// }
// // remove from the hash map
// map.remove(key);
// // remove from the cache order list
// cacheObject.lastAccessedListNode.remove();
// cacheObject.ageListNode.remove();
// // remove references to linked list nodes
// cacheObject.ageListNode = null;
// cacheObject.lastAccessedListNode = null;
// // removed the object, so subtract its size from the total.
// cacheSize -= cacheObject.size;
// return cacheObject.object;
// }
//
// public synchronized void clear() {
// Object[] keys = map.keySet().toArray();
// for (int i = 0; i < keys.length; i++) {
// remove(key
没有合适的资源?快使用搜索试试~ 我知道了~
DWR 长连接方式上传图片
共254个文件
jar:93个
class:72个
java:65个
4星 · 超过85%的资源 需积分: 10 14 下载量 100 浏览量
2011-11-02
20:57:22
上传
评论 1
收藏 24.54MB RAR 举报
温馨提示
DWR 长连接方式上传图片,java 反响ajax上传图片DWR 长连接方式上传图片,java 反响ajax上传图片DWR 长连接方式上传图片,java 反响ajax上传图片
资源推荐
资源详情
资源评论
收起资源包目录
DWR 长连接方式上传图片 (254个子文件)
Conditions$GeneratedCriteria.class 13KB
Conditions$Criteria.class 7KB
Actuator.class 7KB
ResultData.class 6KB
DataDao.class 5KB
ImageMultipartFile.class 4KB
JdbcDataSource.class 4KB
WelcomeAct.class 3KB
ConditionsParser.class 3KB
GenerateUtils.class 3KB
CMSUtils.class 2KB
BaseWebMessage.class 2KB
CollectionsUtils.class 2KB
JdbcTransaction.class 2KB
DefaultHandlerExceptionResolver.class 2KB
AbstractDefaultHandlerFile.class 2KB
JdbcUtils.class 2KB
TypeHandlerRegistry$1.class 2KB
DateTypeEditor.class 2KB
Conditions.class 2KB
DataBindingInterceptor.class 2KB
WriteLogUtils.class 2KB
BlobTypeHandler.class 2KB
SqlBuilder.class 2KB
Conditions$Criterion.class 2KB
DateTypeHandler.class 2KB
ComentDataListener.class 1KB
FloatTypeHandler.class 1KB
BooleanTypeHandler.class 1KB
BigDecimalTypeHandler.class 1KB
BigIntegerTypeHandler.class 1KB
DoubleTypeHandler.class 1KB
SqlTimestampTypeHandler.class 1KB
IntegerTypeHandler.class 1KB
ByteTypeHandler.class 1KB
LongTypeHandler.class 1KB
StringTypeHandler.class 1KB
GenericTokenParser.class 1KB
SqlTimeTypeHandler.class 1KB
SqlDateTypeHandler.class 1KB
ByteArrayTypeHandler.class 1KB
Fields.class 1KB
DefaultSqlSessionFactory.class 1KB
TypeHandlerRegistry.class 1KB
CMSDataUtils.class 1KB
Configuration.class 1KB
PollingModelDataListener.class 1KB
ObjectTypeHandler.class 1KB
ShortTypeHandler.class 1KB
ImageMultipartFileTypeEditor.class 921B
TestRegex.class 897B
CometAct.class 859B
PropertyEditorRegistrars.class 819B
IMessage$1.class 731B
UploadFileAct.class 721B
JdbcUtils$1.class 682B
WebSite.class 682B
UploadFileExcetion.class 645B
WebFrontMessage.class 623B
WebAdminMessage.class 623B
BaseException.class 613B
JdbcTransaction$1.class 613B
GenerateConfig.class 603B
ImageMultipartFile$1.class 599B
IMessage.class 444B
TypeHandler.class 404B
DataSourceException.class 396B
IResultMessage.class 390B
Environment.class 338B
SqlSessionFactory.class 233B
ResultDataListener.class 176B
Transaction.class 174B
.classpath 838B
org.eclipse.wst.common.component 442B
org.eclipse.wst.jsdt.ui.superType.container 49B
conditions.ftl 9KB
conditions.ftl 9KB
dao.ftl 4KB
dao.ftl 4KB
conditionsParser.ftl 2KB
conditionsParser.ftl 2KB
index.html 1KB
upload.html 1KB
index.html 491B
admin_error.html 272B
404.html 258B
activemq-all-5.1.0.jar 3.62MB
aspectjweaver.jar 1.8MB
dwr.jar 1.13MB
freemarker-2.3.16.jar 860KB
castor-1.3.2-xml.jar 777KB
mysql-connector-java-5.1.18-bin.jar 771KB
org.springframework.context-sources-3.0.4.RELEASE.jar 672KB
jackson-mapper-lgpl-1.8.0.jar 656KB
org.springframework.context-3.0.4.RELEASE.jar 650KB
mybatis-3.0.4.jar 626KB
c3p0-0.9.1.2.jar 596KB
janino.jar 588KB
org.springframework.beans-3.0.4.RELEASE.jar 543KB
org.springframework.beans-sources-3.0.4.RELEASE.jar 511KB
共 254 条
- 1
- 2
- 3
资源评论
- Ynter2014-02-04挺好的例子,值得研究,虽然最后没用上。
- yewufu2013-07-01这个例子挺好用的。
- danielchirs2013-01-15这个确实我也没有看懂他怎么....
- 眺望太空的稻草人2013-10-28非常感谢。能用。就是得仔细研究一下。
- big_cucumber2012-12-21我实在是没看懂。。。
Thinks_quiet
- 粉丝: 6
- 资源: 28
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功