ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » WMB 8 Global Cache

Post new topic  Reply to topic Goto page Previous  1, 2
 WMB 8 Global Cache « View previous topic :: View next topic » 
Author Message
mqjeff
PostPosted: Wed Jun 26, 2013 5:38 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

The question is, what does the base MbGlobalCache functionality do when presented with a serializable object.

Does it automatically assume that it supports a specific toString or toArray or etc. function, or does it merely throw an error that it's not a String.

Given that IBM doesn't document this, it's not unreasonable to expect that the only functions that are supported are those that are actually documented.

The fact that one can make the behavior one wants available with some advanced Java knowledge (yes, alas, this is *advanced* java knowledge) is less germane than a texes legislature's opinion of the time of day.
Back to top
View user's profile Send private message
iShakir
PostPosted: Wed Jun 26, 2013 6:09 am    Post subject: Reply with quote

Apprentice

Joined: 07 Mar 2013
Posts: 47

There has been a mistake in communication here.

Of course I was not implying that the data couldn't be represented by something that could then be put to the cache (and my apologies if that's how it came across.) It's more that the actual act of:

Code:
MbGlobalMap.put(key, Object object)
MbGlobalMap.get(key)


or even:

Code:
MbGlobalMap.put(key, Serializable object)
MbGlobalMap.get(key)


cannot be assumed to work, as per the documentation.


Last edited by iShakir on Wed Jun 26, 2013 6:11 am; edited 1 time in total
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jun 26, 2013 6:10 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

iShakir wrote:
There has been a mistake in communication here.

Of course I was not implying that the data couldn't be represented by something that could then be put to the cache (and my apologies if that's how it came across.) It's more that the actual act of:

Code:
MbGlobalMap.put(key, Object object)


or even:

Code:
MbGlobalMap.put(key, Serializable object)


cannot be assumed to work, as per the documentation.


I'm in full agreement.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Wed Jun 26, 2013 7:29 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

mqjeff wrote:
iShakir wrote:
There has been a mistake in communication here.

Of course I was not implying that the data couldn't be represented by something that could then be put to the cache (and my apologies if that's how it came across.) It's more that the actual act of:

Code:
MbGlobalMap.put(key, Object object)


or even:

Code:
MbGlobalMap.put(key, Serializable object)


cannot be assumed to work, as per the documentation.


I'm in full agreement.


I also.

http://www.tutorialspoint.com/java/java_serialization.htm


Code:
AllergyCode ac = new AllergyCode();
ac.setMyName( "abc" );
MbGlobalMap.put(key, ac);


Under no circumstance would you ever define an object in-line to a call to MbGlobalMap.put.

http://en.wikipedia.org/wiki/Serialization

http://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html

Quote:
Serializability of a class is enabled by the class implementing the java.io.Serializable interface. Classes that do not implement this interface will not have any of their state serialized or deserialized. All subtypes of a serializable class are themselves serializable. The serialization interface has no methods or fields and serves only to identify the semantics of being serializable.

To allow subtypes of non-serializable classes to be serialized, the subtype may assume responsibility for saving and restoring the state of the supertype's public, protected, and (if accessible) package fields. The subtype may assume this responsibility only if the class it extends has an accessible no-arg constructor to initialize the class's state. It is an error to declare a class Serializable if this is not the case. The error will be detected at runtime.

_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
touchofcrypticthunder
PostPosted: Thu Jun 27, 2013 7:42 am    Post subject: Reply with quote

Apprentice

Joined: 08 Jul 2009
Posts: 30

Finally I implemented AllergyCode caching solution using array of String datatype which works fine. I could manage to use string of array as value to GlobalCache for this usecase as there were 2 or 3 fields which was required for cross ref.

But when the usecase involves more number of fields to be put into cache, this solution may not be feasible which requires Java object which I tried to implement in the beginning.

Infact I implemented the java object as Serializable but still it did not work with GlobalCache.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Jun 27, 2013 7:44 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You can use any Serializable object you want.

You just have to explicitly serialize it into a string yourself before you stick it in the global map, and then explicitly unserialize it when you retrieve it from the globla map.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Thu Jun 27, 2013 10:03 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

mqjeff wrote:
You can use any Serializable object you want.

You just have to explicitly serialize it into a string yourself before you stick it in the global map, and then explicitly unserialize it when you retrieve it from the globla map.


As is specified in the English language translation of the Java reference above:

Quote:
To allow subtypes of non-serializable classes to be serialized, the subtype may assume responsibility for saving and restoring the state of the supertype's public, protected, and (if accessible) package fields. The subtype may assume this responsibility only if the class it extends has an accessible no-arg constructor to initialize the class's state. It is an error to declare a class Serializable if this is not the case. The error will be detected at runtime.


If English is difficult to understand for you, specify what is your first language and I will hop on the blue line to get a good translation.

http://www.bluelines.eu/
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
jhart
PostPosted: Fri Jul 19, 2013 7:43 am    Post subject: Reply with quote

Novice

Joined: 12 Dec 2012
Posts: 19
Location: IBM Hursley, UK

In IBM Integration Bus v9, you can now store any Java object as a value in the cache, as long as implements Serializable/Externalizable.
You need to manage these "POJOs" separately from your Java Compute code, and place the jar file containing them into one of the shared-classes directories.

Described here:
http://pic.dhe.ibm.com/infocenter/wmbhelp/v9r0m0/topic/com.ibm.etools.mft.doc/bc23789_.htm
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » WMB 8 Global Cache
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.