CS-15778: Fetching thumbnail modified with review comments

This commit is contained in:
Rajesh Battala 2012-08-16 15:31:02 +05:30
parent 86f2508186
commit 6d356b4b49
2 changed files with 6 additions and 3 deletions

View File

@ -25,7 +25,7 @@ public class AjaxFIFOImageCache {
private List<Integer> fifoQueue;
private Map<Integer, byte[]> cache;
private int cacheSize;
private int nextKey = 1;
private int nextKey = 0;
public AjaxFIFOImageCache(int cacheSize) {
this.cacheSize = cacheSize;
@ -57,6 +57,9 @@ public class AjaxFIFOImageCache {
}
public synchronized byte[] getImage(int key) {
if (key == 0) {
key = nextKey;
}
if(cache.containsKey(key)) {
if(s_logger.isTraceEnabled())
@ -70,7 +73,7 @@ public class AjaxFIFOImageCache {
}
public synchronized int getNextKey() {
return nextKey++;
return ++nextKey;
}
public synchronized int getKey() {

View File

@ -99,7 +99,7 @@ public class ConsoleProxyAjaxImageHandler implements HttpHandler {
ConsoleProxyClient viewer = ConsoleProxy.getVncViewer(param);
AjaxFIFOImageCache imageCache =viewer.getAjaxImageCache();
byte[] img = imageCache.getImage(imageCache.getKey() - 1);
byte[] img = imageCache.getImage(0);
if(img != null) {
Headers hds = t.getResponseHeaders();