English 中文(简体)
Coherence: Gracefully navigate a POF Path with potential null elements
原标题:

In POF-serialized .NET objects, I have Class A containing Class B, and Class B has an Attribute X which I want to extract and use in a filter.

I can use a SimplePofPath to navigate through the POF stream from A to B and grab X. This works well, except when A.B == null.

When A does not have an instance of B where expected, the SimplePofPath fails with message

getChild() method cannot be invoked on the SimplePofValue instance.

Instead of this, I would like an IPofNavigator that does something more graceful than throw an exception when it can t traverse its path because I serialized null in a field. This could be, say, returning a user-supplied "fallback" value.

Does such an implementation exist? If not, how would I get started extending AbstractPofPath on my own? I have taken a look at this custom navigator dealing with contained collections, but can t wrap my head around how to get started implementing navigate().

最佳回答

I was able to do this by extending AbstractPofPath and implementing a recursive navigate(PofValue, int) method much like the one linked. I also stubbed it in C# and provided matching user-type configurations in the .NET client and cluster config files.

Before the recursive call, the method checks to see if its parameter has a typeID equal to PofConstants.V_REFERENCE_NULL, and if so, it simply returns its parameter instead of recursing.

Past few minutes of testing show that this approach maintains behavior acceptable to Filter and Extractor objects.

Further Thoughts: If I had Java equivalents of my .NET classes, I could use ChainedExtractors. However, the cluster wants to know how to deserialize everything in the chain of extractors ;)

问题回答

暂无回答




相关问题
Is there a way to look into L2 hibernate cache?

I have a task to attach Oracle Coherence (it is cache software) in my project. One way of using it is Level2 Hibernate cache. I want to see when hibernate takes results from L2 cache. How can i do ...

Client and Cache configuration for Oracle coherence

I have the specific scenario for which we want to use Coherence as sitributed cache. Which I am gonna describe here. I have 20+ standalone processes which are going to put the data in cache ...

Oracle Coherence w/ ASP.NET application

Is it possible to use Oracle Coherence to provide distributed caching to an ASP.NET application? We would like to use Coherence to scale out an ASP.NET application which does not have distributed ...

Oracle Coherence License Issue

Are there any restrictions for using coherence.jar without any license? coherence.jar is open for downloading without any fee.

热门标签