0 Replies Latest reply: Sep 21, 2010 1:41 PM by 653147 RSS

    Functor pattern - register Context ?

    653147
      Hi - hope you can help us !

      I'm afraid I posted this to the wrong forum, so its a duplicate - my mistake, apologies! I should have posted here right away.

      We are trying to run the Functor example code in order to understand how this works before we write our own, but we are running into an error with the Context. Executing this code taken directly from the example:

      ====================================
      public class FunctorPatternExample
      {
      public static void main(String[] args) throws InterruptedException, ExecutionException
      {
      try
      {
      ContextsManager contextsManager = DefaultContextsManager.getInstance();
      Identifier contextIdentifier = contextsManager.registerContext("myCounter", new Counter(0));
      FunctorSubmitter functorSubmitter = DefaultFunctorSubmitter.getInstance();
      //functorSubmitter.submitCommand(contextIdentifier, new LoggingCommand("Commenced", 0));

      for (int i = 0; i < 50; i++)
      {
      Future<Long> future = functorSubmitter.submitFunctor(contextIdentifier, new NextValueFunctor());
      System.out.println(future.get());
      }
      =====================================

      results in this error:

      =====================================
      2010-09-21 13:05:14.304/0.312 Oracle Coherence 3.5.3/465 <Info> (thread=main, member=n/a): Loaded operational configuration from resource "jar:file:/C:/dev/CU_Clustering/mh_cu/EarContent/APP-INF/lib/coherence.jar!/tangosol-coherence.xml"
      2010-09-21 13:05:14.304/0.312 Oracle Coherence 3.5.3/465 <Info> (thread=main, member=n/a): Loaded operational overrides from resource "jar:file:/C:/dev/CU_Clustering/mh_cu/EarContent/APP-INF/lib/coherence.jar!/tangosol-coherence-override-dev.xml"
      2010-09-21 13:05:14.304/0.312 Oracle Coherence 3.5.3/465 <Info> (thread=main, member=n/a): Loaded operational overrides from resource "jar:file:/C:/architect/Enterprise%20Architecture/XPath%20and%20KMD%20PoC/coherence-3%5b1%5d.6-common-1.7.1.18316.jar!/tangosol-coherence-override.xml"
      2010-09-21 13:05:14.319/0.327 Oracle Coherence 3.5.3/465 <D5> (thread=main, member=n/a): Optional configuration override "/custom-mbeans.xml" is not specified

      Oracle Coherence Version 3.5.3/465
      Grid Edition: Development mode
      Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

      2010-09-21 13:05:14.491/0.499 Oracle Coherence GE 3.5.3/465 <Info> (thread=main, member=n/a): Loaded cache configuration from "jar:file:/C:/dev/CU_Clustering/mh_cu/EarContent/APP-INF/lib/coherence.jar!/coherence-cache-config.xml"

      Using the Incubator Extensible Environment for Coherence Cache Configuration
      Copyright (c) 2010, Oracle Corporation. All Rights Reserved.

      2010-09-21 13:05:15.005/1.013 Oracle Coherence GE 3.5.3/465 <D5> (thread=Cluster, member=n/a): Service Cluster joined the cluster with senior service member n/a
      2010-09-21 13:05:18.264/4.272 Oracle Coherence GE 3.5.3/465 <Info> (thread=Cluster, member=n/a): Created a new cluster "cluster:0xDDEB" with Member(Id=1, Timestamp=2010-09-21 13:05:14.849, Address=10.100.153.51:8088, MachineId=63283, Location=site:cp.ad.kohls.com,machine:SF536LK1,process:5680, Role=KohlsMhCuFunctorPatternExample, Edition=Grid Edition, Mode=Development, CpuCount=2, SocketCount=2) UID=0x0A6499330000012B35788EE1F7331F98
      2010-09-21 13:05:18.295/4.303 Oracle Coherence GE 3.5.3/465 <D5> (thread=Invocation:Management, member=1): Service Management joined the cluster with senior service member 1
      2010-09-21 13:05:18.482/4.490 Oracle Coherence GE 3.5.3/465 <D5> (thread=DistributedCache, member=1): Service DistributedCache joined the cluster with senior service member 1
      Exception in thread "main" java.lang.IllegalArgumentException: Can't submit Command com.oracle.coherence.patterns.functor.internal.SingleFunctorCommand@13c6a22 to Context Identifier{myCounter} as the Context does not exist
      at com.oracle.coherence.patterns.command.DefaultCommandSubmitter.submitCommand(DefaultCommandSubmitter.java:90)
      at com.oracle.coherence.patterns.functor.DefaultFunctorSubmitter.submitCommand(DefaultFunctorSubmitter.java:165)
      at com.oracle.coherence.patterns.functor.DefaultFunctorSubmitter.submitFunctor(DefaultFunctorSubmitter.java:196)
      at com.oracle.coherence.patterns.functor.DefaultFunctorSubmitter.submitFunctor(DefaultFunctorSubmitter.java:175)
      at com.kohls.mh.cu.test.FunctorPatternExample.main(FunctorPatternExample.java:31)
      =====================================

      We don't find any discussion of Contexts or registerContext in the Developer's Guide, so we're a little confused at this point. We've been using Coherence for a while and have been working with both local and distributed cache schemes, so we understand the basics, but we just don't understand this.

      Can one of you Coherence gurus out there give us some advice?

      Thanks !!