Home Help Center

Making Ice objects Java Serializable

blairblair Member Blair ZajacOrganization: Sony Pictures ImageworksProject: VnP ✭✭
We're building a three tier application with Python/Perl/C++ clients, a Java middle-tier and a database backend. We have a large number of boxes for the middle-tier that have many gigs of free memory and plan on using memcached to store the results of database queries and other calculations for faster response times and throughput.

We're currently using this Java memcached client:

http://www.whalin.com/memcached/

which allows you to serialize any Serializable object, say using one of our structures.

/** Attribute list entry */
struct NodeAttribute {
string skey;
string svalue;
};

This structure ends up as

public final class NodeAttribute implements java.lang.Cloneable
{
public String skey;

public String svalue;
...
...

If we add java.io.Serializable, then we can do

MemCachedClient mc = new MemCachedClient();
String key = "cacheKey1";
NodeAttribute value = new NodeAttribute("abc", "def");
mc.set(key, value);

While it appears that we can use the --stream option to slice2java and then write some code that will serialize the Ice objects, having the objects be serializable would make it easier.

So we could have our build.xml patch these files by hand, it seems better to have it done in slice2java.

It appears that the C# and VB mappings have Serializable attributes you can add in the slice file. Is there a reason this wasn't done or can't be done with Java?

BTW, looking at Freeze. it looks heavier than what we need with memcached. We have a persistent backend already with the authoritative data and memcached just provides very fast LRU cache for it. It doesn't appear we need the disk backed Berkeley DB that Freeze uses.

Regards,
Blair

Comments

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi Blair,

    There's no technical reason for the lack of support for serialization in Ice for Java. It wouldn't be difficult to add, it's just never been a priority. If you have a commercial need for this feature, please contact us at [email protected].

    Take care,
    - Mark
Sign In or Register to comment.