Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache size #846

Merged
merged 4 commits into from
Mar 12, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ public void clearAllCaches()
for (int i = 0; i < names.length; i++) {
cache = manager.getCache(names[i]);
if (cache != null) cache.removeAll();
manager.removeCache(names[i]);
}
} catch (Exception e) {
//the cache is not alive.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ public void shutdown(SecurityContext ctx)
//Need to write the current group.
if (!omeroGateway.isConnected()) return;
omeroGateway.logout();
CacheServiceFactory.shutdown(container);
DataServicesFactory.registry.getCacheService().clearAllCaches();
PixelsServicesFactory.shutDownRenderingControls(container.getRegistry());

if (executor != null) executor.shutdown();
Expand Down Expand Up @@ -745,7 +745,7 @@ public void exitApplication(boolean forceQuit, boolean exit)
if (env != null && env.isRunAsPlugin())
title = "Exit Plugin";
MessageBox box = new MessageBox(
singleton.registry.getTaskBar().getFrame(),
DataServicesFactory.registry.getTaskBar().getFrame(),
title, message,
IconManager.getInstance().getIcon(
IconManager.INFORMATION_MESSAGE_48));
Expand All @@ -759,6 +759,7 @@ public void exitApplication(boolean forceQuit, boolean exit)
}
shutdown(null);
if (exit) {
CacheServiceFactory.shutdown(container);
singleton = null;
container.exit();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ public static RndProxyDef convert(RenderingDef rndDef)
proxy.setBitResolution(def.getBitResolution().getValue());

ChannelBinding c;
Collection bindings = rndDef.copyWaveRendering();
Iterator k = bindings.iterator();
Collection<ChannelBinding> bindings = rndDef.copyWaveRendering();
Iterator<ChannelBinding> k = bindings.iterator();
int i = 0;
int[] rgba;
ChannelBindingsProxy cb;
while (k.hasNext()) {
c = (ChannelBinding) k.next();
c = k.next();
cb = proxy.getChannel(i);
if (cb == null) {
cb = new ChannelBindingsProxy();
Expand Down Expand Up @@ -674,15 +674,16 @@ private static int getCacheSize()
int n = 0;
int sizeCache = 0;
RenderingControlProxy proxy;
Entry entry;
Entry<Long, RenderingControl> entry;
Iterator<Entry<Long, RenderingControl>> i;
if (singleton.pixelsSource != null) n = 1;
if (n == 0 && m == 0) return maxSize*FACTOR;
else if (n == 0 && m > 0) {
sizeCache = (maxSize/(m+1))*FACTOR;
//reset all the image caches.
Iterator i = singleton.rndSvcProxies.entrySet().iterator();
i = singleton.rndSvcProxies.entrySet().iterator();
while (i.hasNext()) {
entry = (Entry) i.next();
entry = i.next();
proxy = (RenderingControlProxy) entry.getValue();
proxy.setCacheSize(sizeCache);
}
Expand All @@ -693,9 +694,9 @@ else if (n == 0 && m > 0) {
}
sizeCache = (maxSize/(m+n+1))*FACTOR;
//reset all the image caches.
Iterator i = singleton.rndSvcProxies.entrySet().iterator();
i = singleton.rndSvcProxies.entrySet().iterator();
while (i.hasNext()) {
entry = (Entry) i.next();
entry = i.next();
proxy = (RenderingControlProxy) entry.getValue();
proxy.setCacheSize(sizeCache);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,8 @@ void setRenderingEngine(RenderingEnginePrx servant)
void shutDown()
{
try {
context.getCacheService().removeCache(cacheID);
if (cacheID >= 0)
context.getCacheService().removeCache(cacheID);
if (checker.isNetworkup()) servant.close();
} catch (Exception e) {}
}
Expand All @@ -940,7 +941,8 @@ void shutDown()
void setCacheSize(int size)
{
if (imageSize == 0) imageSize = 1;
context.getCacheService().setCacheEntries(cacheID, size/imageSize);
if (cacheID >= 0)
context.getCacheService().setCacheEntries(cacheID, size/imageSize);
}

/**
Expand Down