[jboss-jira] [JBoss JIRA] (DROOLS-345) NotSerializableException when attempting to serialize kcontext.getMatch().getObjects()
Davide Sottara (JIRA)
issues at jboss.org
Sat Dec 14 18:48:35 EST 2013
[ https://issues.jboss.org/browse/DROOLS-345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12931347#comment-12931347 ]
Davide Sottara commented on DROOLS-345:
---------------------------------------
Looking at the collectSet accumulate function code:
{code}
public Object getResult(Serializable context) throws Exception {
CollectListData data = (CollectListData) context;
return Collections.unmodifiableSet( data.map.keySet() );
}
{code}
Indeed, it returns a HashMap's keySet
> NotSerializableException when attempting to serialize kcontext.getMatch().getObjects()
> --------------------------------------------------------------------------------------
>
> Key: DROOLS-345
> URL: https://issues.jboss.org/browse/DROOLS-345
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 6.0.0.CR4
> Environment: Windows, Oracle Java JDK 1.7.0_21
> Reporter: Reinis Vicups
> Assignee: Mark Proctor
>
> Optaplanner is using kcontext.getMatch().getObjects() to retrieve objects participating in the match.
> This rule
> {code}
> rule "failing rule"
> when
> $project : Project
> $resourceParallelism : Set from accumulate( Assignment(project == $project, resource != null, $resource : resource),
> collectSet($resource) )
> then
> scoreHolder.addHardConstraintMatch(kcontext, -Math.abs($resourceParallelism.size() - $project.getOptimalResourceParallelism()));
> end
> {code}
> cause kcontext.getMatch().getObjects() later on to return List with two elements:
> 1. element is instance of Project (serializable)
> 2. element is instance of HashMap$KeySet of Resource (serializable)
> Issue is - HashMap$KeySet is not serializable thus causing the said Exception.
> I checked up with Mr. Proctor and Mr. De Smet. The final assumption was that accumulate could somehow cause HashMap$KeySet to be returned.
> Would be great if someone with understanding could check out how the objects get into kcontext.getMatch().getObjects() from the above rule and if it is drools wrapping my objects in HashMap$KeySet
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list