Hi Dustin,<br><br>I&#39;m calling MemcachedClient from inside a webapp under Tomcat 5.5, and it is definitely being hit from multiple clients (multiple threads) at the same time.&nbsp; I don&#39;t have assertions enabled.&nbsp; Here&#39;s how I&#39;m calling MemcachedClient:
<br><br>constructing:<br>&nbsp;&nbsp;&nbsp; memcache = new MemcachedClient(new InetSocketAddress(host, port));<br><br>Get from cache:<br>private Map&lt;String, Object&gt; getStuff(Collection&lt;Integer&gt; ids) {<br>&nbsp;&nbsp;&nbsp; StringBuilder buf = new StringBuilder(500);
<br>&nbsp;&nbsp;&nbsp; for (int id : ids) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf.append(&quot;cacheditem:&quot;).append(id).append(&#39; &#39;);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; String request = buf.toString().trim();<br>&nbsp;&nbsp;&nbsp; Map&lt;String, Object&gt; map = memcache.getBulk(request);
<br>&nbsp;&nbsp;&nbsp; log.debug(&quot;Requested &quot;+ids.size()+&quot; items from cache, got &quot;+map.size()+&quot; items back&quot;);<br>&nbsp;&nbsp;&nbsp; return map;<br>}<br><br><br>Put items in the cache:<br>public void putInCache(Collection&lt;MyItem&gt; itemsToCache, Map&lt;Integer, Long&gt; itemLastmodifiedDates) {
<br>&nbsp;&nbsp;&nbsp; for (MyItem j : itemsToCache) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int id = j.getId();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String cachedItemKey = &quot;cacheditem:&quot; + jobId;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; memcache.set(cachedItemKey, 0, j);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Long lastModifiedDate = itemLastmodifiedDates.get

(id);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (lastModifiedDate == null)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new IllegalArgumentException(&quot;itemLastmodifiedDate not found in map for id &quot;+id);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; memcache.set(&quot;itemlastmodified:&quot; + id, 0, lastModifiedDate);
<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br><br>Delete items from cache (when items are updated in the DB):<br>private void delete(int id) {<br>&nbsp;&nbsp;&nbsp; log.debug(&quot;Deleting id &quot;+id);<br>&nbsp;&nbsp;&nbsp; String key = Integer.toString(id);<br>&nbsp;&nbsp;&nbsp; memcache.delete

(&quot;cacheditem:&quot; + key);<br>&nbsp;&nbsp;&nbsp; memcache.delete(&quot;itemlastmodified:&quot; + key);<br>}<br><br><br>That&#39;s the bulk of it.. there&#39;s a bit more to deal with items that have been updated in the database, and it then removes those items from the cache, which is why I&#39;m storing the lastmodified date for each item.&nbsp; 
<br><br>Let me know if you want me to try anything, add logging statements, etc.&nbsp; Thanks,<br><br>Chris<br><br><br><div><span class="gmail_quote">On 10/15/07, <b class="gmail_sendername">Dustin Sallings</b> &lt;<a href="mailto:dustin@spy.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

dustin@spy.net</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><span><br><div><div>On Oct 14, 2007, at 19:06, Chris Lamprecht wrote:
</div><br><blockquote type="cite"><span style="border-collapse: separate; border-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">

public void gotData(String key, int flags, byte[] data) {<br>&nbsp;&nbsp;&nbsp; Collection&lt;GetOperation.Callback&gt; cbs=callbacks.get(key);<br>&nbsp;&nbsp;&nbsp; assert cbs != null : &quot;No callbacks for key &quot; + key;<br>&nbsp;&nbsp;&nbsp; for(GetOperation.Callback

 c : cbs) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;---- NPE here<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; c.gotData(key, flags, data);<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br>Any ideas?&nbsp; I haven&#39;t dug into the code yet to try and debug it.&nbsp; Also previously I tried the 1.4 client version and got an NPE in 
OptimizeGet.java or something like that.&nbsp; Thanks<br></span></blockquote></div><div><br></div></span><div><span style="white-space: pre;">        </span>Are you running with assertions enabled?</div><div><br></div><div><span style="white-space: pre;">

        </span>Can you describe what kinds of operations you have running through this?&nbsp; I&#39;ve never seen that assertion fire nor had an NPE there, so I&#39;d be curious how much you could tell me about what may have led to this state.
</div><br><div> <span style="border-collapse: separate; border-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">

<div>--&nbsp;</div><div>Dustin Sallings</div><br></span> </div><br></div></blockquote></div><br>