2014-12-06 5 views
0

우리의 poc에서는 분할 모드로 2 개의 백업이있는 캐시가 있고 노드를 3 개 시작했습니다. 100 개의 항목이 캐시에로드되었고이를 복구하기위한 단계가있었습니다.primaryValues는 예상대로 동작하지 않습니다.

public void perform() throws GridException { 
     final GridCache<Long, Entity> cache= g.cache("cache"); 
     GridProjection proj= g.forCache("cache"); 

     Collection< Collection<Entity>> list= proj .compute().broadcast(
       new GridCallable< Collection<Entity>>() { 
      @Override public Collection<Entity> call() throws Exception { 

       Collection<Entity> values= cache.primaryValues(); 

       System.out.println("List size on each Node: "+ values.size()); 
        // console from each node shows 28,38,34 respectively, which is correct 

       return values; 
      } 
     }).get(); 

     for (Collection<Entity> e: list){ 
      System.out.println("list size when arrives on main Node :"+ e.size()); 
//console shows 28 for three times, which is not correct 
     } 
} 

나는 primaryValues는() 밖으로 primaryEntrySet에 의해 반환 된 각 요소()의 값을 가지고 컬렉션에 투입하는 것으로 가정합니다. 나 또한 primaryEntrySet을 사용하려고 시도하고 그런 문제없이 작동합니다.

답변

0

GridGain이 캐시 컬렉션을 직렬화하는 방법은 참조에 의한 것이므로 매우 직관적이지 않을 수 있습니다. 나는 (다음 GridGain 오픈 소스 에디션 버전) 아파치의 Ignite 프로젝트와 락스 문제를 제기했다 : 그 동안 https://issues.apache.org/jira/browse/IGNITE-38

를 작동해야하는, 당신의 GridCallable에서 다음을 시도하십시오 :

return new ArrayList(cache.primaryValues()); 
+0

이 작품, 고마워! 내가 언급 한 것을 잊어 버렸습니다.이 방법은 REPLICATED 모드에서 잘 작동합니다. –

관련 문제