相关推荐
-
VB中实现链表
在VB中实现链表操作。内附详细注解。 可实现队列、堆栈、双向链表,纯环链表、MAP、集合、数据容器等功能。
-
VB-数组、集合、泛型
变量、数组、集合、泛型的发展 最开始用内存中一个位置映射一个值,用变量来“使用”这个值。 进一步发展,用变量来引用一组值,这就是数组。由数组概念,发展出链表、堆、栈,进行排序、检索等。 但这并不能完全表达,由此发展出集合概念,它是更强大的数组,都依赖于Object基类。 随之而来的是集合中元素并不一定是...
-
循环链表以及相关操作(VB实现)
循环链表以及相关操作(VB实现)首先建立一个工程,然后增加一个类并且命名为(node,cls),在node.cls中加入以下代码.Option ExplicitPublic x As LongPublic count As LongPublic nextnode As node在Form1.frm中加入以下代码。Option Explic
-
在Visual Basic编程中运用数据结构
在Visual Basic编程中运用数据结构章新苏 (江苏省水利科学研究所材料结构室)摘要:本文讨论了在VB编程中利用数组和自定义数据类型构造链表、栈和队列等数据结构的方法。关键词:Visual Basic,数据结构1.引言 Basic语言拥有较高的普及率,同时在Windows操作系统中Visual Basic以功能强、代码量小,容易上手和所见即所得的可视化
-
2.VB中的数据结构
1.标识符 规则:字母或者下划线开头;不能使用VB关键字;不要使用特殊意义的标识符;不区分变量的大小写,一般来说首字母大写,符号常量均大写 x-y 错误,-号不能出现;1av错误,数字不可开头;不允许出现减号,空格 2.常量 直接常量:直接反应类型 系统常量:形式:vbcrlf 回车换行组合符 符号常量:形式:Const 符号常量名 [ As 类型] = 表达式 其...
-
计算机二级循环链表,计算机二级VB辅导:循环链表以及相关操作
循环链表以及相关操作(VB实现)首先建立一个工程,然后增加一个类并且命名为(node,cls),在node.cls中加入以下代码.Option ExplicitPublic x As LongPublic count As LongPublic nextnode As node在Form1.frm中加入以下代码。Option ExplicitDim head As nodeDim pointer ...
-
用VB实现循环队列算法收藏
在日常代码编制时,许多人会忽略一些最基本的算法,导致代码冗余,思路不清楚。我曾经至少两次在CSDN里遇到这类问题:我想在页面的右边显示一个列表,列表长度为20,新加入一个用户后,显示在列表开头,再加入的用户,显示在这个用户的下边,当用户数量超过20后,挤掉最前面的那一位,第二位加入的用户成了第一位,依次循环,保证列表最多显示20位用户。当然,实际问题可能与此有些出入,比如Coder是想显示
-
链表的用法
久违的链表 mua mua mua !!!#include<bits/stdc++.h> using namespace std; struct node{ int data; // 单链表的数据域 struct node *Next; // 单链表的指针域 }; /** 建立1:头插,逆序 */ node *creat1(int n){ node *he...
-
关于VB中数据的存储格式和寻址方式
最麻烦的是Variant类型,因为VB是设计成一种傻瓜式的语言,对数据类型没有严格的规定,甚至可以不用声明变量而直接使用,所以在反汇编后的VB程序中,关于类型转换的语句占了很大一部分,只要一涉及数据计算,总会看到一堆数来回转换,其中许多函数的参数,还有未经声明直接使用的变量等,都是Variant类型。还是有许多不明白的地方,比如中间的七位到底有什么用,在那些有Var字样的函数内部实现的过程究竟是怎样(我跟进了一个vbaVarAdd发现极其复杂)等等,还请各位大大指出来,帮助我们这些在黑暗中摸索的菜鸟们。
-
精彩编程与编程技巧-VB自定义数据结构的传输转换...
精彩编程与编程技巧-VB自定义数据结构的传输转换 ...
56 楼 lj1096959784 2014-12-22 14:31
ERROR [2014-12-15 14:26:52,926] com.schooner.MemCached.AscIIClient:-1 - ++++ exception thrown while trying to get object from cache for key: discount_quota79com.bst.discount.entity.DiscountInfoabcBank
ERROR [2014-12-15 14:26:52,928] com.schooner.MemCached.AscIIClient:-1 - null
java.nio.BufferUnderflowException: null
at java.nio.Buffer.nextGetIndex(Buffer.java:492) ~[na:1.7.0_51]
at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:249) ~[na:1.7.0_51]
at com.schooner.MemCached.SockInputStream.read(Unknown Source) ~[Memcached-Java-Client-3.0.2.jar:na]
at com.schooner.MemCached.AscIIClient.get(Unknown Source) [Memcached-Java-Client-3.0.2.jar:na]
at com.schooner.MemCached.AscIIClient.get(Unknown Source) [Memcached-Java-Client-3.0.2.jar:naat com.schooner.MemCached.AscIIClient.get(Unknown Source) [Memcached-Java-Client-3.0.2.jar:na]
at com.schooner.MemCached.AscIIClient.get(Unknown Source) [Memcached-Java-Client-3.0.2.jar:na]
at com.whalin.MemCached.MemCachedClient.get(Unknown Source) [Memcached-Java-Client-3.0.2.jar:na]
at com.bst.common.tool.MemCachedUtil.get(MemCachedUtil.java:131) [MemCachedUtil.class:na]
at com.bst.discount.service.impl.MemoryCachedService.getDiscountInfoByCode(MemoryCachedService.java:57) [MemoryCachedService.class:na]
at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_51]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_51]
55 楼 kongshanxuelin 2014-08-28 10:20
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:218)
at sun.nio.ch.IOUtil.read(IOUtil.java:186)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:359)
- locked <1aa3c8d> (a java.lang.Object)
at com.schooner.MemCached.SockInputStream.readFromChannel(Unknown Source)
at com.schooner.MemCached.SockInputStream.read(Unknown Source)
at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2283)
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2296)
at java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:2791)
at java.io.ObjectInputStream.readHandle(ObjectInputStream.java:1449)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1327)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1964)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1888)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
54 楼 YDY20082008 2013-05-17 11:56
53 楼 问风尘 2013-01-06 17:14
近来我在使用你们开发的Memcached Java Client2.6.1时,遇到以下问题,一直没有解决,能帮我分析一下吗?
我向memcached中存基本对象时如String,时没有问题。
但是我向memcached中存序列化好的对象时,出现以下错误,请帮我看一看:
107366 [http-8080-1] ERROR com.danga.MemCached.MemCachedClient - ++++ exception thrown while trying to get object from cache for key: testVod77e266e-d238-4381-a90a-b812f5222f59
107366 [http-8080-1] ERROR com.danga.MemCached.MemCachedClient - org.apache.catalina.session.TestVo
java.io.IOException: org.apache.catalina.session.TestVo
at com.schooner.MemCached.ObjectTransCoder.decode(ObjectTransCoder.java:61)
at com.schooner.MemCached.AscIIClient.get(AscIIClient.java:758)
at com.schooner.MemCached.AscIIClient.get(AscIIClient.java:609)
at com.schooner.MemCached.AscIIClient.get(AscIIClient.java:605)
at com.danga.MemCached.MemCachedClient.get(MemCachedClient.java:911)
at org.apache.catalina.session.MemcachedSession.getAttribute(MemcachedSession.java:27)
at org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:110)
at org.apache.jsp.test1_jsp._jspService(test1_jsp.java:90)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
你可以利用我们的客户端直接向memcached存取Java 对象,而不必先序列化再存,我们的客户端会为你做序列化和反序列化的工作,例如:
TestClass tc = new TestClass("foo", "bar", new Integer(32));
mc.set("foo", tc);
TestClass tt = (TestClass) mc.get("foo");
但是,你必须保证这个类(TestClass)能够被client找到,也就是说你要把包含这个类定义的Jar文件包含到class path里面,不然客户端在反序列化的时候会报class not found的错误,这就是出现你上述错误地原因。
谢谢你的回复!
正如你所说,我把对象的Jar包放到class path之后,可以get出来了,但
是不能转化回来,报以下错误:
2011-8-5 19:00:47 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet jsp threw exception
java.lang.ClassCastException: org.apache.catalina.session.TestVo cannot be cast to org.apache.catalina.session.TestVo
at org.apache.jsp.test1_jsp._jspService(test1_jsp.java:66)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
这两个类是一样的啊,却不能转化,不知是什么原因。
还有就是如果新加类到memcached中都要把这个类放到class path中,感觉挺麻烦的,有没有方法杜绝呢?
我貌似找到原因了,放入memcached的对象跟本不用序列化,由client序列化,这样就不用把这个类放到class path中去了。
再次感谢楼主的回复!
你好,我也遇到这个问题,但是好像重启不影响使用,而且我java对象已经序列化过了,这个序列化过会有影响吗?? 谢谢
52 楼 gaowenming 2012-11-21 10:02
java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:474)
at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:205)
at com.schooner.MemCached.SockInputStream.read(Unknown Source)
at com.schooner.MemCached.SockInputStream.getLine(Unknown Source)
at com.schooner.MemCached.AscIIClient.set(Unknown Source)
at com.schooner.MemCached.AscIIClient.set(Unknown Source)
at com.danga.MemCached.MemCachedClient.set(Unknown Source)
这个问题的解决办法:
使用binaryProtocal就可以了。
构造client的时候增加了参数true,使用binaryProtocal进行传输。
按照这个办法同样有问题
51 楼 gaowenming 2012-11-21 10:01
[2012-11-21 09:58:00,598] [ERROR] [main] [c.s.M.AscIIClient:-1] - ++++ exception thrown while writing bytes to server on set
[2012-11-21 09:58:00,599] [ERROR] [main] [c.s.M.AscIIClient:-1] - null
java.nio.BufferUnderflowException: null
at java.nio.Buffer.nextGetIndex(Buffer.java:474) ~[na:1.6.0_25]
at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:208) ~[na:1.6.0_25]
at com.schooner.MemCached.SockInputStream.read(Unknown Source) ~[java_memcached-release_2.6.6.jar:na]
at com.schooner.MemCached.SockInputStream.getLine(Unknown Source) ~[java_memcached-release_2.6.6.jar:na]
at com.schooner.MemCached.AscIIClient.set(Unknown Source) [java_memcached-release_2.6.6.jar:na]
at com.schooner.MemCached.AscIIClient.set(Unknown Source) [java_memcached-release_2.6.6.jar:na]
at com.danga.MemCached.MemCachedClient.set(Unknown Source) [java_memcached-release_2.6.6.jar:na]
at com.founder.barcode.bussiness.util.MemCacheUtil.putCache(MemCacheUtil.java:175) [MemCacheUtil.class:na]
at com.founder.barcode.bussiness.cache.CipherKeyCache.init(CipherKeyCache.java:40) [CipherKeyCache.class:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_25]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_25]
50 楼 huecome 2012-06-13 14:59
49 楼 gxlcliqi 2012-06-05 02:45
在用户量更大的时候没有问题,但是在用户量相对较少的时候出现:
"http://*:8080-524" daemon prio=10 tid=0x00002aaab75df000 nid=0x7c17 in Object.wait() [0x000000006282d000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000077f570820> (a org.apache.commons.pool.impl.GenericObjectPool$Latch)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1123)
- locked <0x000000077f570820> (a org.apache.commons.pool.impl.GenericObjectPool$Latch)
at com.schooner.MemCached.SchoonerSockIOPool.getConnection(SchoonerSockIOPool.java:547)
at com.schooner.MemCached.SchoonerSockIOPool.getSock(SchoonerSockIOPool.java:485)
at com.schooner.MemCached.AscIIClient.get(AscIIClient.java:693)
at com.schooner.MemCached.AscIIClient.get(AscIIClient.java:630)
at com.schooner.MemCached.AscIIClient.get(AscIIClient.java:626)
代码如下:
SockIOPool pool = SockIOPool.getInstance("dx_memcached");
pool.setServers(serverlist);
pool.setHashingAlg(SchoonerSockIOPool.NATIVE_HASH);
pool.setMaxIdle(1000 * 60 * 30);
pool.setMaxConn(600);
pool.setMinConn(100);
pool.initialize();
memcachedClient = new MemCachedClient("dx_memcached", false);
48 楼 estn_h 2012-05-29 00:15
47 楼 askylark 2012-05-18 11:17
java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:474)
at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:205)
at com.schooner.MemCached.SockInputStream.read(Unknown Source)
at com.schooner.MemCached.SockInputStream.getLine(Unknown Source)
at com.schooner.MemCached.AscIIClient.set(Unknown Source)
at com.schooner.MemCached.AscIIClient.set(Unknown Source)
at com.danga.MemCached.MemCachedClient.set(Unknown Source)
这个问题的解决办法:
使用binaryProtocal就可以了。
构造client的时候增加了参数true,使用binaryProtocal进行传输。
46 楼 love123455555 2012-04-19 11:24
45 楼 sankby 2012-04-13 11:23
请问这个版本使用二进制协议访问,memcache需要什么版本,什么配置?
44 楼 askylark 2012-03-06 13:04
java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:474)
at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:205)
at com.schooner.MemCached.SockInputStream.read(Unknown Source)
at com.schooner.MemCached.SockInputStream.getLine(Unknown Source)
at com.schooner.MemCached.AscIIClient.set(Unknown Source)
at com.schooner.MemCached.AscIIClient.set(Unknown Source)
at com.danga.MemCached.MemCachedClient.set(Unknown Source)
43 楼 javcol 2011-12-22 17:57
static final int CACHE_INITCONN = 200;
/** 最小连接数 5**/
static final int CACHE_MINCONN = 5;
/****最大连接数 250 **/
static final int CACHE_MAXCONN = 1000;
/** 设置一个连接最大空闲时间6小时***/
static final int CACHE_MAXIDLE = 1000 * 60 * 60 * 6;
/** 设置主线程睡眠时间 每隔30秒醒来 然后 开始维护 连接数大小**/
static final int CACHE_MAINSLEEP = 10;
/** // 设置tcp 相关的树形 关闭nagle算法 设置 读取 超时3秒钟 set the read timeout to 3 secs不设置连接超时 */
static final boolean CACHE_NAGLE = true;
static final int CACHE_SOCKETTO = 3000;
static final int CACHE_SOCKETCONNECTTO = 3000;
/****/
static final boolean CACHE_ALIVECHEK =true;
这是我的相关参数!!
42 楼 javcol 2011-12-22 17:56
是否那些相关的参数没有配置好呢/希望得到你们的帮助,谢谢!!
at com.schooner.MemCached.SchoonerSockIOPool.getConnection(SchoonerSockIOPool.java:540)
at com.schooner.MemCached.SchoonerSockIOPool.getSock(SchoonerSockIOPool.java:452)
at com.schooner.MemCached.AscIIClient.get(AscIIClient.java:670)
at com.schooner.MemCached.AscIIClient.get(AscIIClient.java:609)
at com.schooner.MemCached.AscIIClient.get(AscIIClient.java:605)
at com.danga.MemCached.MemCachedClient.get(MemCachedClient.java:911)
at com.covics.memcached.client.Memcached.get(Memcached.java:145)
at com.covics.bs.service.impl.AbstractBaseMcc.getInMccByKey(AbstractBaseMcc.java:65)
at com.covics.bs.service.memcached.MemberMcc.getMemberInMccdByEmail(MemberMcc.java:104)
at com.covics.meefon.service.member.MemberService.findTbMemberByEmailOrCode(MemberService.java:306)
at com.covics.meefon.service.impl.Service_1_9.service_check_user(Service_1_9.java:375)
at com.covics.meefon.service.impl.Service_1_9.service(Service_1_9.java:135)
at com.covics.meefon.service.impl.AbstractBaseDataService.parseService(AbstractBaseDataService.java:213)
at com.covics.meefon.service.impl.FactoryServiceImpl.logicService(FactoryServiceImpl.java:91)
at com.covics.meefon.servlet.Portal.doPost(Portal.java:174)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
41 楼 MengLee 2011-09-07 16:25
1、首先是java memcached client可以用连接池,其实xmc也支持连接池,设置连接池的话,针对小数据的存取吞吐量会有一个提升,大并发下跟java memcached client没有差距。
2、大数据的存取,java memcached client去掉了压缩功能,比较的时候,其他client有没有将压缩的阈值设大来防止压缩,如果没有也是不公平的。
我觉得去掉压缩设置功能是个很大的败笔, 对用户不太友好,至少也要提供一个可选择的余地。server端一个slab最大容纳1M,存入大对象的时候压缩一下可以有效的利用memcached内存空间。
谢谢你的建议,我们会认真考虑。现阶段你可以自行压缩数据,然后存入memcached,取出数据之后,自行解压即可。
40 楼 waterdh 2011-09-07 12:21
1、首先是java memcached client可以用连接池,其实xmc也支持连接池,设置连接池的话,针对小数据的存取吞吐量会有一个提升,大并发下跟java memcached client没有差距。
2、大数据的存取,java memcached client去掉了压缩功能,比较的时候,其他client有没有将压缩的阈值设大来防止压缩,如果没有也是不公平的。
我觉得去掉压缩设置功能是个很大的败笔, 对用户不太友好,至少也要提供一个可选择的余地。server端一个slab最大容纳1M,存入大对象的时候压缩一下可以有效的利用memcached内存空间。
39 楼 MengLee 2011-08-19 17:42
Exception in thread "Thread-1001" java.lang.OutOfMemoryError: Direct buffer memory
at java.nio.Bits.reserveMemory(Bits.java:633)
at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:98)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
at com.schooner.MemCached.SchoonerSockIOPool$TCPSockIO.<init>(SchoonerSockIOPool.java:1327)
at com.schooner.MemCached.SchoonerSockIOFactory.createSocket(SchoonerSockIOFactory.java:73)
at com.schooner.MemCached.SchoonerSockIOFactory.makeObject(SchoonerSockIOFactory.java:43)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1181)
at com.schooner.MemCached.SchoonerSockIOPool.getConnection(SchoonerSockIOPool.java:513)
at com.schooner.MemCached.SchoonerSockIOPool.getSock(SchoonerSockIOPool.java:452)
at com.schooner.MemCached.AscIIClient.set(AscIIClient.java:360)
at com.schooner.MemCached.AscIIClient.set(AscIIClient.java:227)
at com.danga.MemCached.MemCachedClient.set(MemCachedClient.java:467)
而在2.5.1的时候则没有这个问题。
jvm的参数是-Xms1024m -Xmx1024m
能不能把你测试的参数告诉我?比如开了多少个线程,连接池大小,等等。
您也可以下载2.6.2的jar再试试。
38 楼 prolurker 2011-08-17 15:32
Exception in thread "Thread-1001" java.lang.OutOfMemoryError: Direct buffer memory
at java.nio.Bits.reserveMemory(Bits.java:633)
at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:98)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
at com.schooner.MemCached.SchoonerSockIOPool$TCPSockIO.<init>(SchoonerSockIOPool.java:1327)
at com.schooner.MemCached.SchoonerSockIOFactory.createSocket(SchoonerSockIOFactory.java:73)
at com.schooner.MemCached.SchoonerSockIOFactory.makeObject(SchoonerSockIOFactory.java:43)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1181)
at com.schooner.MemCached.SchoonerSockIOPool.getConnection(SchoonerSockIOPool.java:513)
at com.schooner.MemCached.SchoonerSockIOPool.getSock(SchoonerSockIOPool.java:452)
at com.schooner.MemCached.AscIIClient.set(AscIIClient.java:360)
at com.schooner.MemCached.AscIIClient.set(AscIIClient.java:227)
at com.danga.MemCached.MemCachedClient.set(MemCachedClient.java:467)
而在2.5.1的时候则没有这个问题。
jvm的参数是-Xms1024m -Xmx1024m
37 楼 wjjava 2011-08-05 19:14
近来我在使用你们开发的Memcached Java Client2.6.1时,遇到以下问题,一直没有解决,能帮我分析一下吗?
我向memcached中存基本对象时如String,时没有问题。
但是我向memcached中存序列化好的对象时,出现以下错误,请帮我看一看:
107366 [http-8080-1] ERROR com.danga.MemCached.MemCachedClient - ++++ exception thrown while trying to get object from cache for key: testVod77e266e-d238-4381-a90a-b812f5222f59
107366 [http-8080-1] ERROR com.danga.MemCached.MemCachedClient - org.apache.catalina.session.TestVo
java.io.IOException: org.apache.catalina.session.TestVo
at com.schooner.MemCached.ObjectTransCoder.decode(ObjectTransCoder.java:61)
at com.schooner.MemCached.AscIIClient.get(AscIIClient.java:758)
at com.schooner.MemCached.AscIIClient.get(AscIIClient.java:609)
at com.schooner.MemCached.AscIIClient.get(AscIIClient.java:605)
at com.danga.MemCached.MemCachedClient.get(MemCachedClient.java:911)
at org.apache.catalina.session.MemcachedSession.getAttribute(MemcachedSession.java:27)
at org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:110)
at org.apache.jsp.test1_jsp._jspService(test1_jsp.java:90)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
你可以利用我们的客户端直接向memcached存取Java 对象,而不必先序列化再存,我们的客户端会为你做序列化和反序列化的工作,例如:
TestClass tc = new TestClass("foo", "bar", new Integer(32));
mc.set("foo", tc);
TestClass tt = (TestClass) mc.get("foo");
但是,你必须保证这个类(TestClass)能够被client找到,也就是说你要把包含这个类定义的Jar文件包含到class path里面,不然客户端在反序列化的时候会报class not found的错误,这就是出现你上述错误地原因。
谢谢你的回复!
正如你所说,我把对象的Jar包放到class path之后,可以get出来了,但
是不能转化回来,报以下错误:
2011-8-5 19:00:47 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet jsp threw exception
java.lang.ClassCastException: org.apache.catalina.session.TestVo cannot be cast to org.apache.catalina.session.TestVo
at org.apache.jsp.test1_jsp._jspService(test1_jsp.java:66)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
这两个类是一样的啊,却不能转化,不知是什么原因。
还有就是如果新加类到memcached中都要把这个类放到class path中,感觉挺麻烦的,有没有方法杜绝呢?
我貌似找到原因了,放入memcached的对象跟本不用序列化,由client序列化,这样就不用把这个类放到class path中去了。
再次感谢楼主的回复!