Index: modules/core/src/test/java/org/apache/ignite/internal/processors/cache/QueryResponseTest.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/test/java/org/apache/ignite/internal/processors/cache/QueryResponseTest.java (revision ) +++ modules/core/src/test/java/org/apache/ignite/internal/processors/cache/QueryResponseTest.java (revision ) @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import javax.cache.Cache; +import org.apache.ignite.cache.CacheAtomicityMode; +import org.apache.ignite.cache.query.QueryCursor; +import org.apache.ignite.cache.query.ScanQuery; +import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.internal.util.typedef.internal.U; +import org.apache.ignite.lang.IgniteBiPredicate; +import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; +import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; +import org.apache.ignite.testframework.GridTestExternalClassLoader; +import org.apache.ignite.testframework.config.GridTestProperties; +import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; + +public class QueryResponseTest extends GridCommonAbstractTest { + private static String CACHE_NAME = "cache"; + + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration iCfg = super.getConfiguration(gridName); + + CacheConfiguration cc = defaultCacheConfiguration(); + + cc.setName(CACHE_NAME); + cc.setAtomicityMode(CacheAtomicityMode.ATOMIC); + + if (gridName.endsWith("1")) { + iCfg.setClientMode(true); + + iCfg.setClassLoader(new UsersClassLoader()); + } + + iCfg.setCacheConfiguration(cc); + iCfg.setPeerClassLoadingEnabled(true); + + TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(); + + ipFinder.setAddresses(Collections.singleton("127.0.0.1")); + + ((TcpDiscoverySpi)iCfg.getDiscoverySpi()).setIpFinder(ipFinder); + + return iCfg; + } + + /** + * + */ + private static class UsersClassLoader extends GridTestExternalClassLoader { + /** + * @throws MalformedURLException If failed + */ + public UsersClassLoader() throws MalformedURLException { + super(new URL[] {new URL(GridTestProperties.getProperty("p2p.uri.cls"))}); + } + } + + public void test() throws Exception { + startGrid(1); + ClassLoader ldr = grid(1).configuration().getClassLoader(); + + IgniteBiPredicate predicate = (IgniteBiPredicate)ldr.loadClass("org.apache.ignite.tests.p2p.KeyPrefixPredicate").newInstance(); + + for (int i = 0; i <= 1000; i++) { + grid(1).cache(CACHE_NAME).put(String.valueOf(i), String.valueOf(i)); + } + + ScanQuery scan = new ScanQuery<>(predicate); + + Set keys = new HashSet<>(); + + try (QueryCursor> cursor = grid(1).cache(CACHE_NAME).query(scan)) { + for (Cache.Entry entry : cursor) { + String key = entry.getKey(); + keys.add(key); + } + } + + assert keys.size() == 11; + } + + public void testSrv() throws Exception { + ClassLoader ldr = QueryResponseTest.class.getClassLoader(); + + startGrid(0); + + while (true) { + U.sleep(1000); + try { + ldr.loadClass("org.apache.ignite.tests.p2p.KeyPrefixPredicate"); + System.out.println("FOUND"); + } + catch (Exception e) { + System.out.println("CNF"); + } + } + } +} Index: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java (date 1436540254000) +++ modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java (revision ) @@ -505,7 +505,7 @@ default: throw new IgniteCheckedException("Failed to send response to node. Unsupported direct type [message=" - + msg + "]"); + + msg + "]", msg.classError()); } } Index: parent/pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- parent/pom.xml (date 1436540254000) +++ parent/pom.xml (revision ) @@ -393,8 +393,8 @@ maven-compiler-plugin 3.1 - 1.7 - 1.7 + 1.8 + 1.8 Index: modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/KeyPrefixPredicate.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/KeyPrefixPredicate.java (revision ) +++ modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/KeyPrefixPredicate.java (revision ) @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.tests.p2p; + +import java.io.Serializable; +import org.apache.ignite.Ignite; +import org.apache.ignite.lang.IgniteBiPredicate; +import org.apache.ignite.resources.IgniteInstanceResource; + +public class KeyPrefixPredicate implements IgniteBiPredicate, Serializable { + + @IgniteInstanceResource + Ignite ignite; + + @Override + public boolean apply(String e1, Object e2) { + ignite.log().error(">>>>>>>>>>>>> Predicate USED!!!!"); + return e1 != null && e1.startsWith("11"); + } + +} \ No newline at end of file