Repository: ignite Updated Branches: refs/heads/ignite-1770 91b8d2e8e -> 6768e9d5e
IGNITE-1770: Fixing project build problems. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6768e9d5 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6768e9d5 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6768e9d5 Branch: refs/heads/ignite-1770 Commit: 6768e9d5e3a1f72d9760b053bd2962597df8e43f Parents: 91b8d2e Author: vozerov-gridgain <[email protected]> Authored: Wed Oct 28 12:25:30 2015 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Wed Oct 28 12:25:30 2015 +0300 ---------------------------------------------------------------------- modules/microbench/pom.xml | 34 ---------- .../java/org/apache/ignite/MyBenchmark.java | 9 +-- .../util/MarshallerContextMicrobenchImpl.java | 66 ++++++++++++++++++++ 3 files changed, 71 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/6768e9d5/modules/microbench/pom.xml ---------------------------------------------------------------------- diff --git a/modules/microbench/pom.xml b/modules/microbench/pom.xml index 1241bcd..6bf58d0 100644 --- a/modules/microbench/pom.xml +++ b/modules/microbench/pom.xml @@ -59,40 +59,6 @@ <version>${jmh.version}</version> <scope>provided</scope> </dependency> - - <dependency> - <groupId>org.apache.ignite</groupId> - <artifactId>ignite-core</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${spring.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-beans</artifactId> - <version>${spring.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>${spring.version}</version> - <scope>test</scope> - </dependency> </dependencies> <build> http://git-wip-us.apache.org/repos/asf/ignite/blob/6768e9d5/modules/microbench/src/main/java/org/apache/ignite/MyBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/microbench/src/main/java/org/apache/ignite/MyBenchmark.java b/modules/microbench/src/main/java/org/apache/ignite/MyBenchmark.java index 9eba07a..1f3dce4 100644 --- a/modules/microbench/src/main/java/org/apache/ignite/MyBenchmark.java +++ b/modules/microbench/src/main/java/org/apache/ignite/MyBenchmark.java @@ -35,7 +35,7 @@ import org.apache.ignite.internal.portable.PortableContext; import org.apache.ignite.internal.portable.PortableMetaDataHandler; import org.apache.ignite.internal.portable.streams.PortableSimpleMemoryAllocator; import org.apache.ignite.internal.util.IgniteUtils; -import org.apache.ignite.marshaller.MarshallerContextTestImpl; + import org.apache.ignite.marshaller.optimized.OptimizedMarshaller; import org.apache.ignite.marshaller.portable.PortableMarshaller; import org.apache.ignite.portable.PortableException; @@ -43,6 +43,7 @@ import org.apache.ignite.portable.PortableMarshalAware; import org.apache.ignite.portable.PortableMetadata; import org.apache.ignite.portable.PortableReader; import org.apache.ignite.portable.PortableWriter; +import org.apache.ignite.util.MarshallerContextMicrobenchImpl; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; @@ -96,16 +97,16 @@ public class MyBenchmark { marsh = new PortableMarshaller(); PortableContext ctx = new PortableContext(metaHnd, null); - marsh.setContext(new MarshallerContextTestImpl(null)); + marsh.setContext(new MarshallerContextMicrobenchImpl(null)); IgniteUtils.invoke(PortableMarshaller.class, marsh, "setPortableContext", ctx); optMarsh = new OptimizedMarshaller(); - optMarsh.setContext(new MarshallerContextTestImpl(null)); + optMarsh.setContext(new MarshallerContextMicrobenchImpl(null)); marshAddrBytes = marsh.marshal(new Address()); optMarshAddrBytes = optMarsh.marshal(new Address()); - byte[] data = marsh.marshal(newCustomer(1)); + byte[] data = marsh.marshal(new Address()); System.out.println(data.length); } http://git-wip-us.apache.org/repos/asf/ignite/blob/6768e9d5/modules/microbench/src/main/java/org/apache/ignite/util/MarshallerContextMicrobenchImpl.java ---------------------------------------------------------------------- diff --git a/modules/microbench/src/main/java/org/apache/ignite/util/MarshallerContextMicrobenchImpl.java b/modules/microbench/src/main/java/org/apache/ignite/util/MarshallerContextMicrobenchImpl.java new file mode 100644 index 0000000..9454c1b --- /dev/null +++ b/modules/microbench/src/main/java/org/apache/ignite/util/MarshallerContextMicrobenchImpl.java @@ -0,0 +1,66 @@ +/* + * 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.util; + +import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.internal.MarshallerContextAdapter; +import org.apache.ignite.plugin.PluginProvider; +import org.jsr166.ConcurrentHashMap8; + +import java.util.List; +import java.util.concurrent.ConcurrentMap; + +/** + * Test marshaller context. + */ +public class MarshallerContextMicrobenchImpl extends MarshallerContextAdapter { + /** */ + private final static ConcurrentMap<Integer, String> map = new ConcurrentHashMap8<Integer, String>(); + + /** + * Initializes context. + * + * @param plugins Plugins. + */ + public MarshallerContextMicrobenchImpl(List<PluginProvider> plugins) { + super(plugins); + } + + /** + * Initializes context. + */ + public MarshallerContextMicrobenchImpl() { + super(null); + } + + /** {@inheritDoc} */ + @Override protected boolean registerClassName(int id, String clsName) throws IgniteCheckedException { + String oldClsName = map.putIfAbsent(id, clsName); + + if (oldClsName != null && !oldClsName.equals(clsName)) + throw new IgniteCheckedException("Duplicate ID [id=" + id + ", oldClsName=" + oldClsName + ", clsName=" + + clsName + ']'); + + return true; + } + + /** {@inheritDoc} */ + @Override protected String className(int id) { + return map.get(id); + } +} \ No newline at end of file
