http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/apache/ignite/internal/processors/interop/GridInteropTarget.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/interop/GridInteropTarget.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/interop/GridInteropTarget.java new file mode 100644 index 0000000..75d16d4 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/interop/GridInteropTarget.java @@ -0,0 +1,108 @@ +/* + * 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.interop; + +import org.apache.ignite.*; +import org.jetbrains.annotations.*; + +/** + * Interop target abstraction. + */ +public interface GridInteropTarget { + /** + * Synchronous IN operation. + * + * @param type Operation type. + * @param stream Input stream. + * @return Value specific for the given operation otherwise. + * @throws IgniteCheckedException In case of failure. + */ + public int inOp(int type, GridPortableInputStream stream) throws IgniteCheckedException; + + /** + * Synchronous IN operation which returns managed object as result. + * + * @param type Operation type. + * @param stream Input stream. + * @return Managed result. + * @throws IgniteCheckedException If case of failure. + */ + public Object inOpObject(int type, GridPortableInputStream stream) throws IgniteCheckedException; + + /** + * Synchronous OUT operation. + * + * @param type Operation type. + * @param stream Native stream address. + * @param arr Native array address. + * @param cap Capacity. + * @throws IgniteCheckedException In case of failure. + */ + public void outOp(int type, long stream, long arr, int cap) throws IgniteCheckedException; + + /** + * Synchronous IN-OUT operation. + * + * @param type Operation type. + * @param inStream Input stream. + * @param outStream Native stream address. + * @param outArr Native array address. + * @param outCap Capacity. + * @throws IgniteCheckedException In case of failure. + */ + public void inOutOp(int type, GridPortableInputStream inStream, long outStream, long outArr, int outCap) + throws IgniteCheckedException; + + /** + * Synchronous IN-OUT operation with optional argument. + * + * @param type Operation type. + * @param inStream Input stream. + * @param outStream Native stream address. + * @param outArr Native array address. + * @param outCap Capacity. + * @param arg Argument (optional). + * @throws IgniteCheckedException In case of failure. + */ + public void inOutOp(int type, GridPortableInputStream inStream, long outStream, long outArr, int outCap, + @Nullable Object arg) throws IgniteCheckedException; + + /** + * Asynchronous IN operation. + * + * @param type Operation type. + * @param futId Future ID. + * @param in Input stream. + * @throws IgniteCheckedException In case of failure. + */ + public void inOpAsync(int type, long futId, GridPortableInputStream in) throws IgniteCheckedException; + + /** + * Asynchronous IN-OUT operation. + * + * @param type Operation type. + * @param futId Future ID. + * @param in Input stream. + * @param outStream Native stream address. + * @param outArr Native array address. + * @param outCap Capacity. + * @throws IgniteCheckedException In case of failure. + */ + public void inOutOpAsync(int type, long futId, GridPortableInputStream in, long outStream, long outArr, int outCap) + throws IgniteCheckedException; +}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/apache/ignite/internal/processors/interop/os/GridOsInteropProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/interop/os/GridOsInteropProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/interop/os/GridOsInteropProcessor.java new file mode 100644 index 0000000..6a592d1 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/interop/os/GridOsInteropProcessor.java @@ -0,0 +1,80 @@ +/* + * 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.interop.os; + +import org.apache.ignite.*; +import org.apache.ignite.internal.*; +import org.apache.ignite.internal.processors.interop.*; +import org.jetbrains.annotations.*; + +/** + * OS interop processor. + */ +public class GridOsInteropProcessor extends GridInteropProcessorAdapter { + /** Common error message. */ + private static final String ERR_MSG = "Interop feature is not supported in OS edition."; + + /** + * Constructor. + * + * @param ctx Context. + */ + public GridOsInteropProcessor(GridKernalContext ctx) { + super(ctx); + } + + /** {@inheritDoc} */ + @Override public void releaseStart() { + throw new UnsupportedOperationException(ERR_MSG); + } + + /** {@inheritDoc} */ + @Override public void awaitStart() throws IgniteCheckedException { + throw new UnsupportedOperationException(ERR_MSG); + } + + /** {@inheritDoc} */ + @Override public long environmentPointer() throws IgniteCheckedException { + throw new UnsupportedOperationException(ERR_MSG); + } + + /** {@inheritDoc} */ + @Override public String gridName() { + throw new UnsupportedOperationException(ERR_MSG); + } + + /** {@inheritDoc} */ + @Override public void close(boolean cancel) { + throw new UnsupportedOperationException(ERR_MSG); + } + + /** {@inheritDoc} */ + @Override public GridInteropTarget projection() throws IgniteCheckedException { + throw new UnsupportedOperationException(ERR_MSG); + } + + /** {@inheritDoc} */ + @Override public GridInteropTarget cache(@Nullable String name) throws IgniteCheckedException { + throw new UnsupportedOperationException(ERR_MSG); + } + + /** {@inheritDoc} */ + @Override public GridInteropTarget dataLoader(@Nullable String cacheName) throws IgniteCheckedException { + throw new UnsupportedOperationException(ERR_MSG); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/apache/ignite/internal/processors/interop/os/package.html ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/interop/os/package.html b/modules/core/src/main/java/org/apache/ignite/internal/processors/interop/os/package.html new file mode 100644 index 0000000..20815a0 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/interop/os/package.html @@ -0,0 +1,23 @@ +<!-- + 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. + --> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<body> + <!-- Package description. --> + No-op implementation of interop processor. +</body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/apache/ignite/internal/processors/interop/package.html ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/interop/package.html b/modules/core/src/main/java/org/apache/ignite/internal/processors/interop/package.html new file mode 100644 index 0000000..57a4e47 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/interop/package.html @@ -0,0 +1,23 @@ +<!-- + 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. + --> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<body> + <!-- Package description. --> + Interop processor. +</body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableInputStream.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableInputStream.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableInputStream.java new file mode 100644 index 0000000..8ab16f2 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableInputStream.java @@ -0,0 +1,177 @@ +/* + * 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.portable; + +/** + * Portable input stream. + */ +public interface GridPortableInputStream extends GridPortableStream { + /** + * Read byte value. + * + * @return Byte value. + */ + public byte readByte(); + + /** + * Read byte array. + * + * @param cnt Expected item count. + * @return Byte array. + */ + public byte[] readByteArray(int cnt); + + /** + * Read boolean value. + * + * @return Boolean value. + */ + public boolean readBoolean(); + + /** + * Read boolean array. + * + * @param cnt Expected item count. + * @return Boolean array. + */ + public boolean[] readBooleanArray(int cnt); + + /** + * Read short value. + * + * @return Short value. + */ + public short readShort(); + + /** + * Read short array. + * + * @param cnt Expected item count. + * @return Short array. + */ + public short[] readShortArray(int cnt); + + /** + * Read char value. + * + * @return Char value. + */ + public char readChar(); + + /** + * Read char array. + * + * @param cnt Expected item count. + * @return Char array. + */ + public char[] readCharArray(int cnt); + + /** + * Read int value. + * + * @return Int value. + */ + public int readInt(); + + /** + * Read int value at the given position. + * + * @param pos Position. + * @return Value. + */ + public int readInt(int pos); + + /** + * Read int array. + * + * @param cnt Expected item count. + * @return Int array. + */ + public int[] readIntArray(int cnt); + + /** + * Read float value. + * + * @return Float value. + */ + public float readFloat(); + + /** + * Read float array. + * + * @param cnt Expected item count. + * @return Float array. + */ + public float[] readFloatArray(int cnt); + + /** + * Read long value. + * + * @return Long value. + */ + public long readLong(); + + /** + * Read long array. + * + * @param cnt Expected item count. + * @return Long array. + */ + public long[] readLongArray(int cnt); + + /** + * Read double value. + * + * @return Double value. + */ + public double readDouble(); + + /** + * Read double array. + * + * @param cnt Expected item count. + * @return Double array. + */ + public double[] readDoubleArray(int cnt); + + /** + * Read data to byte array. + * + * @param arr Array. + * @param off Offset. + * @param len Length. + * @return Amount of actual bytes read. + */ + public int read(byte[] arr, int off, int len); + + /** + * Read data to the given address. + * + * @param addr Address. + * @param len Length. + * @return Amount of actual bytes read. + */ + public int read(long addr, int len); + + /** + * Gets amount of remaining data in bytes. + * + * @return Remaining data. + */ + public int remaining(); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableOutputStream.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableOutputStream.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableOutputStream.java new file mode 100644 index 0000000..cfbf8d4 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableOutputStream.java @@ -0,0 +1,172 @@ +/* + * 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.portable; + +/** + * Portable output stream. + */ +public interface GridPortableOutputStream extends GridPortableStream, AutoCloseable { + /** + * Write byte value. + * + * @param val Byte value. + */ + public void writeByte(byte val); + + /** + * Write byte array. + * + * @param val Byte array. + */ + public void writeByteArray(byte[] val); + + /** + * Write boolean value. + * + * @param val Boolean value. + */ + public void writeBoolean(boolean val); + + /** + * Write boolean array. + * + * @param val Boolean array. + */ + public void writeBooleanArray(boolean[] val); + + /** + * Write short value. + * + * @param val Short value. + */ + public void writeShort(short val); + + /** + * Write short array. + * + * @param val Short array. + */ + public void writeShortArray(short[] val); + + /** + * Write char value. + * + * @param val Char value. + */ + public void writeChar(char val); + + /** + * Write char array. + * + * @param val Char array. + */ + public void writeCharArray(char[] val); + + /** + * Write int value. + * + * @param val Int value. + */ + public void writeInt(int val); + + /** + * Write int value to the given position. + * + * @param pos Position. + * @param val Value. + */ + public void writeInt(int pos, int val); + + /** + * Write int array. + * + * @param val Int array. + */ + public void writeIntArray(int[] val); + + /** + * Write float value. + * + * @param val Float value. + */ + public void writeFloat(float val); + + /** + * Write float array. + * + * @param val Float array. + */ + public void writeFloatArray(float[] val); + + /** + * Write long value. + * + * @param val Long value. + */ + public void writeLong(long val); + + /** + * Write long array. + * + * @param val Long array. + */ + public void writeLongArray(long[] val); + + /** + * Write double value. + * + * @param val Double value. + */ + public void writeDouble(double val); + + /** + * Write double array. + * + * @param val Double array. + */ + public void writeDoubleArray(double[] val); + + /** + * Write byte array. + * + * @param arr Array. + * @param off Offset. + * @param len Length. + */ + public void write(byte[] arr, int off, int len); + + /** + * Write data from unmanaged memory. + * + * @param addr Address. + * @param cnt Count. + */ + public void write(long addr, int cnt); + + /** + * Ensure capacity. + * + * @param cnt Required byte count. + */ + public void ensureCapacity(int cnt); + + /** + * Close the stream releasing resources. + */ + @Override public void close(); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableProcessor.java new file mode 100644 index 0000000..272b194 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableProcessor.java @@ -0,0 +1,150 @@ +/* + * 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.portable; + +import org.apache.ignite.internal.processors.*; +import org.apache.ignite.portables.*; +import org.apache.ignite.client.marshaller.*; +import org.jetbrains.annotations.*; + +import java.nio.*; +import java.util.*; + +/** + * Portable processor. + */ +public interface GridPortableProcessor extends GridProcessor { + /** + * @param typeName Type name. + * @return Type ID. + */ + public int typeId(String typeName); + + /** + * @param obj Object to marshal. + * @param trim If {@code true} trims result byte buffer. + * @return Object bytes. + * @throws org.apache.ignite.portables.PortableException In case of error. + */ + public ByteBuffer marshal(@Nullable Object obj, boolean trim) throws PortableException; + + /** + * @param arr Byte array. + * @param off Offset. + * @return Unmarshalled object. + * @throws org.apache.ignite.portables.PortableException In case of error. + */ + public Object unmarshal(byte[] arr, int off) throws PortableException; + + /** + * @param ptr Offheap pointer. + * @param forceHeap If {@code true} creates heap-based object. + * @return Unmarshalled object. + * @throws org.apache.ignite.portables.PortableException In case of error. + */ + public Object unmarshal(long ptr, boolean forceHeap) throws PortableException; + + /** + * Converts temporary offheap object to heap-based. + * + * @param obj Object. + * @return Heap-based object. + * @throws org.apache.ignite.portables.PortableException In case of error. + */ + @Nullable public Object unwrapTemporary(@Nullable Object obj) throws PortableException; + + /** + * @param obj Object to marshal. + * @return Portable object. + * @throws org.apache.ignite.portables.PortableException In case of error. + */ + public Object marshalToPortable(@Nullable Object obj) throws PortableException; + + /** + * @param obj Object (portable or not). + * @return Detached portable object or original object. + */ + public Object detachPortable(@Nullable Object obj); + + /** + * @return Portable marshaller for client connectivity or {@code null} if it's not + * supported (in case of OS edition). + */ + @Nullable public GridClientMarshaller portableMarshaller(); + + /** + * @param marsh Client marshaller. + * @return Whether marshaller is portable. + */ + public boolean isPortable(GridClientMarshaller marsh); + + /** + * @return Builder. + */ + public PortableBuilder builder(int typeId); + + /** + * @return Builder. + */ + public PortableBuilder builder(String clsName); + + /** + * Creates builder initialized by existing portable object. + * + * @param portableObj Portable object to edit. + * @return Portable builder. + */ + public PortableBuilder builder(PortableObject portableObj); + + /** + * @param typeId Type ID. + * @param newMeta New meta data. + * @throws org.apache.ignite.portables.PortableException In case of error. + */ + public void addMeta(int typeId, final PortableMetadata newMeta) throws PortableException; + + /** + * @param typeId Type ID. + * @param typeName Type name. + * @param affKeyFieldName Affinity key field name. + * @param fieldTypeIds Fields map. + * @throws org.apache.ignite.portables.PortableException In case of error. + */ + public void updateMetaData(int typeId, String typeName, @Nullable String affKeyFieldName, + Map<String, Integer> fieldTypeIds) throws PortableException; + + /** + * @param typeId Type ID. + * @return Meta data. + * @throws org.apache.ignite.portables.PortableException In case of error. + */ + @Nullable public PortableMetadata metadata(int typeId) throws PortableException; + + /** + * @param typeIds Type ID. + * @return Meta data. + * @throws org.apache.ignite.portables.PortableException In case of error. + */ + public Map<Integer, PortableMetadata> metadata(Collection<Integer> typeIds) throws PortableException; + + /** + * @return Metadata for all types. + * @throws org.apache.ignite.portables.PortableException In case of error. + */ + public Collection<PortableMetadata> metadata() throws PortableException; +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableStream.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableStream.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableStream.java new file mode 100644 index 0000000..2c3fc78 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableStream.java @@ -0,0 +1,53 @@ +/* + * 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.portable; + +/** + * Portable stream. + */ +public interface GridPortableStream { + /** + * @return Position. + */ + public int position(); + + /** + * @param pos Position. + */ + public void position(int pos); + + /** + * @return Underlying array. + */ + public byte[] array(); + + /** + * @return Copy of data in the stream. + */ + public byte[] arrayCopy(); + + /** + * @return Offheap pointer if stream is offheap based, otherwise {@code 0}. + */ + public long offheapPointer(); + + /** + * @return {@code True} is stream is array based. + */ + public boolean hasArray(); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/os/GridOsPortableProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/os/GridOsPortableProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/os/GridOsPortableProcessor.java new file mode 100644 index 0000000..f2bda46 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/os/GridOsPortableProcessor.java @@ -0,0 +1,125 @@ +/* + * 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.portable.os; + +import org.apache.ignite.internal.*; +import org.apache.ignite.internal.processors.*; +import org.apache.ignite.portables.*; +import org.apache.ignite.client.marshaller.*; +import org.jetbrains.annotations.*; + +import java.nio.*; +import java.util.*; + +/** + * No-op implementation of {@link GridPortableProcessor}. + */ +public class GridOsPortableProcessor extends GridProcessorAdapter implements GridPortableProcessor { + /** + * @param ctx Kernal context. + */ + public GridOsPortableProcessor(GridKernalContext ctx) { + super(ctx); + } + + /** {@inheritDoc} */ + @Override public int typeId(String typeName) { + return 0; + } + + /** {@inheritDoc} */ + @Override public ByteBuffer marshal(@Nullable Object obj, boolean trim) throws PortableException { + return null; + } + + /** {@inheritDoc} */ + @Nullable @Override public Object unmarshal(byte[] arr, int off) throws PortableException { + return null; + } + + /** {@inheritDoc} */ + @Override public Object unmarshal(long ptr, boolean forceHeap) throws PortableException { + return null; + } + + /** {@inheritDoc} */ + @Override public Object unwrapTemporary(Object obj) throws PortableException { + return null; + } + + /** {@inheritDoc} */ + @Nullable @Override public Object marshalToPortable(@Nullable Object obj) throws PortableException { + return obj; + } + + /** {@inheritDoc} */ + @Override public Object detachPortable(@Nullable Object obj) { + return obj; + } + + /** {@inheritDoc} */ + @Nullable @Override public GridClientMarshaller portableMarshaller() { + return null; + } + + /** {@inheritDoc} */ + @Override public boolean isPortable(GridClientMarshaller marsh) { + return false; + } + + /** {@inheritDoc} */ + @Override public PortableBuilder builder(int typeId) { + return null; + } + + /** {@inheritDoc} */ + @Override public PortableBuilder builder(String clsName) { + return null; + } + + /** {@inheritDoc} */ + @Override public PortableBuilder builder(PortableObject portableObj) { + return null; + } + + /** {@inheritDoc} */ + @Override public void addMeta(int typeId, PortableMetadata newMeta) throws PortableException { + // No-op. + } + + /** {@inheritDoc} */ + @Override public void updateMetaData(int typeId, String typeName, String affKeyFieldName, + Map<String, Integer> fieldTypeIds) throws PortableException { + // No-op. + } + + /** {@inheritDoc} */ + @Nullable @Override public PortableMetadata metadata(int typeId) { + return null; + } + + /** {@inheritDoc} */ + @Override public Map<Integer, PortableMetadata> metadata(Collection<Integer> typeIds) { + return null; + } + + /** {@inheritDoc} */ + @Override public Collection<PortableMetadata> metadata() throws PortableException { + return Collections.emptyList(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/os/package.html ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/os/package.html b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/os/package.html new file mode 100644 index 0000000..4febccc --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/os/package.html @@ -0,0 +1,23 @@ +<!-- + 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. + --> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<body> + <!-- Package description. --> + No-op implementation of portable processor. +</body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/package.html ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/package.html b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/package.html new file mode 100644 index 0000000..c3c7e57 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/package.html @@ -0,0 +1,23 @@ +<!-- + 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. + --> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<body> + <!-- Package description. --> + Portable processor. +</body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java index b221c12..3625723 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java @@ -21,7 +21,7 @@ import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.gridgain.grid.kernal.processors.cache.*; import org.gridgain.grid.kernal.processors.cache.distributed.dht.preloader.*; -import org.gridgain.grid.kernal.processors.clock.*; +import org.apache.ignite.internal.processors.clock.*; import org.apache.ignite.internal.util.nio.*; import org.jetbrains.annotations.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java index 39aed58..892464b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java @@ -29,7 +29,7 @@ import org.gridgain.grid.kernal.processors.cache.distributed.dht.atomic.*; import org.gridgain.grid.kernal.processors.cache.distributed.dht.preloader.*; import org.gridgain.grid.kernal.processors.cache.distributed.near.*; import org.gridgain.grid.kernal.processors.cache.query.*; -import org.gridgain.grid.kernal.processors.clock.*; +import org.apache.ignite.internal.processors.clock.*; import org.gridgain.grid.kernal.processors.continuous.*; import org.gridgain.grid.kernal.processors.dataload.*; import org.apache.ignite.internal.processors.rest.handlers.task.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java index e12c154..fe314f0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java @@ -21,7 +21,7 @@ import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.gridgain.grid.kernal.processors.cache.*; import org.gridgain.grid.kernal.processors.cache.distributed.dht.preloader.*; -import org.gridgain.grid.kernal.processors.clock.*; +import org.apache.ignite.internal.processors.clock.*; import org.apache.ignite.internal.util.nio.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.jetbrains.annotations.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/apache/ignite/internal/util/portable/PortableRawWriterEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/portable/PortableRawWriterEx.java b/modules/core/src/main/java/org/apache/ignite/internal/util/portable/PortableRawWriterEx.java index 783a30f..00c989e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/portable/PortableRawWriterEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/portable/PortableRawWriterEx.java @@ -18,7 +18,6 @@ package org.apache.ignite.internal.util.portable; import org.apache.ignite.portables.*; -import org.gridgain.grid.kernal.processors.portable.*; import org.jetbrains.annotations.*; /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java index 3f48e2a..37a9c07 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java @@ -39,7 +39,7 @@ import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; import org.gridgain.grid.kernal.processors.cache.dr.*; import org.gridgain.grid.kernal.processors.cache.query.*; import org.gridgain.grid.kernal.processors.cache.transactions.*; -import org.gridgain.grid.kernal.processors.dr.*; +import org.apache.ignite.internal.processors.dr.*; import org.apache.ignite.internal.processors.task.*; import org.apache.ignite.internal.util.future.*; import org.apache.ignite.internal.util.lang.*; @@ -64,7 +64,7 @@ import static org.apache.ignite.cache.GridCachePeekMode.*; import static org.apache.ignite.transactions.IgniteTxConcurrency.*; import static org.apache.ignite.transactions.IgniteTxIsolation.*; import static org.apache.ignite.internal.GridClosureCallMode.*; -import static org.gridgain.grid.kernal.processors.dr.GridDrType.*; +import static org.apache.ignite.internal.processors.dr.GridDrType.*; import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.*; /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheContext.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheContext.java index 25dda4f..2acb97d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheContext.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheContext.java @@ -44,7 +44,6 @@ import org.gridgain.grid.kernal.processors.cache.query.continuous.*; import org.gridgain.grid.kernal.processors.cache.transactions.*; import org.gridgain.grid.kernal.processors.closure.*; import org.apache.ignite.internal.processors.offheap.*; -import org.gridgain.grid.kernal.processors.portable.*; import org.apache.ignite.internal.processors.timeout.*; import org.apache.ignite.plugin.security.*; import org.apache.ignite.internal.util.typedef.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEntryEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEntryEx.java index 0196772..cbb6e5a 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEntryEx.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEntryEx.java @@ -22,7 +22,7 @@ import org.apache.ignite.cache.*; import org.apache.ignite.lang.*; import org.gridgain.grid.kernal.processors.cache.distributed.*; import org.gridgain.grid.kernal.processors.cache.transactions.*; -import org.gridgain.grid.kernal.processors.dr.*; +import org.apache.ignite.internal.processors.dr.*; import org.apache.ignite.internal.util.lang.*; import org.jetbrains.annotations.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java index ad60828..7b86fee 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java @@ -26,7 +26,7 @@ import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; import org.gridgain.grid.kernal.processors.cache.extras.*; import org.gridgain.grid.kernal.processors.cache.query.*; import org.gridgain.grid.kernal.processors.cache.transactions.*; -import org.gridgain.grid.kernal.processors.dr.*; +import org.apache.ignite.internal.processors.dr.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.offheap.unsafe.*; import org.apache.ignite.internal.util.tostring.*; @@ -47,7 +47,7 @@ import static org.apache.ignite.cache.GridCacheFlag.*; import static org.apache.ignite.transactions.IgniteTxState.*; import static org.apache.ignite.events.IgniteEventType.*; import static org.gridgain.grid.kernal.processors.cache.GridCacheOperation.*; -import static org.gridgain.grid.kernal.processors.dr.GridDrType.*; +import static org.apache.ignite.internal.processors.dr.GridDrType.*; /** * Adapter for cache entry. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java index 80f903a..90433fe 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java @@ -25,7 +25,7 @@ import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.lifecycle.*; import org.apache.ignite.transactions.*; -import org.gridgain.grid.kernal.processors.interop.*; +import org.apache.ignite.internal.processors.interop.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheWriteBehindStore.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheWriteBehindStore.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheWriteBehindStore.java index 957264f..3bf130a 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheWriteBehindStore.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheWriteBehindStore.java @@ -24,7 +24,7 @@ import org.apache.ignite.internal.*; import org.apache.ignite.lang.*; import org.apache.ignite.lifecycle.*; import org.apache.ignite.thread.*; -import org.gridgain.grid.kernal.processors.interop.*; +import org.apache.ignite.internal.processors.interop.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.tostring.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java index 763b25c..319954a 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java @@ -37,7 +37,7 @@ import java.util.concurrent.atomic.*; import static org.apache.ignite.transactions.IgniteTxState.*; import static org.gridgain.grid.kernal.processors.cache.GridCacheOperation.*; -import static org.gridgain.grid.kernal.processors.dr.GridDrType.*; +import static org.apache.ignite.internal.processors.dr.GridDrType.*; /** * Transaction created by system implicitly on remote nodes. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtCacheAdapter.java index e0b8c35..61698fd 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtCacheAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtCacheAdapter.java @@ -40,7 +40,7 @@ import java.util.concurrent.*; import static org.apache.ignite.cache.GridCacheDistributionMode.*; import static org.gridgain.grid.kernal.processors.cache.GridCacheUtils.*; -import static org.gridgain.grid.kernal.processors.dr.GridDrType.*; +import static org.apache.ignite.internal.processors.dr.GridDrType.*; /** * DHT cache adapter. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockFuture.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockFuture.java index b4aff47..ba6dd38 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockFuture.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockFuture.java @@ -40,7 +40,7 @@ import java.util.concurrent.atomic.*; import static org.apache.ignite.events.IgniteEventType.*; import static org.apache.ignite.internal.managers.communication.GridIoPolicy.*; -import static org.gridgain.grid.kernal.processors.dr.GridDrType.*; +import static org.apache.ignite.internal.processors.dr.GridDrType.*; /** * Cache lock future. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java index d6a232d..a458e20 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java @@ -25,7 +25,7 @@ import org.gridgain.grid.kernal.processors.cache.*; import org.gridgain.grid.kernal.processors.cache.distributed.*; import org.gridgain.grid.kernal.processors.cache.distributed.near.*; import org.gridgain.grid.kernal.processors.cache.transactions.*; -import org.gridgain.grid.kernal.processors.dr.*; +import org.apache.ignite.internal.processors.dr.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.future.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java index 81b44dc..2c2040e 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java @@ -55,7 +55,7 @@ import static org.apache.ignite.cache.GridCachePeekMode.*; import static org.apache.ignite.cache.GridCacheWriteSynchronizationMode.*; import static org.gridgain.grid.kernal.processors.cache.GridCacheOperation.*; import static org.gridgain.grid.kernal.processors.cache.GridCacheUtils.*; -import static org.gridgain.grid.kernal.processors.dr.GridDrType.*; +import static org.apache.ignite.internal.processors.dr.GridDrType.*; /** * Non-transactional partitioned cache. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java index 8af69e0..ac474cd 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java @@ -37,7 +37,7 @@ import java.util.concurrent.atomic.*; import static java.util.concurrent.TimeUnit.*; import static org.apache.ignite.events.IgniteEventType.*; import static org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtPartitionState.*; -import static org.gridgain.grid.kernal.processors.dr.GridDrType.*; +import static org.apache.ignite.internal.processors.dr.GridDrType.*; /** * Force keys request future. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandPool.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandPool.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandPool.java index 5c3c25f..e2aec49 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandPool.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandPool.java @@ -43,7 +43,7 @@ import static java.util.concurrent.TimeUnit.*; import static org.apache.ignite.events.IgniteEventType.*; import static org.apache.ignite.internal.GridTopic.*; import static org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtPartitionState.*; -import static org.gridgain.grid.kernal.processors.dr.GridDrType.*; +import static org.apache.ignite.internal.processors.dr.GridDrType.*; /** * Thread pool for requesting partitions from other nodes http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearAtomicCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearAtomicCache.java index 0da781b..2b0b793 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearAtomicCache.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearAtomicCache.java @@ -40,7 +40,7 @@ import java.util.*; import static org.apache.ignite.IgniteSystemProperties.*; import static org.apache.ignite.cache.GridCacheFlag.*; import static org.gridgain.grid.kernal.processors.cache.GridCacheOperation.*; -import static org.gridgain.grid.kernal.processors.dr.GridDrType.*; +import static org.apache.ignite.internal.processors.dr.GridDrType.*; /** * Near cache for atomic cache. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/dr/GridCacheDrManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/dr/GridCacheDrManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/dr/GridCacheDrManager.java index 6e81f36..61880e8 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/dr/GridCacheDrManager.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/dr/GridCacheDrManager.java @@ -20,7 +20,7 @@ package org.gridgain.grid.kernal.processors.cache.dr; import org.apache.ignite.*; import org.gridgain.grid.kernal.processors.cache.*; import org.gridgain.grid.kernal.processors.cache.transactions.*; -import org.gridgain.grid.kernal.processors.dr.*; +import org.apache.ignite.internal.processors.dr.*; import org.jetbrains.annotations.*; /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/dr/os/GridOsCacheDrManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/dr/os/GridOsCacheDrManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/dr/os/GridOsCacheDrManager.java index 5a3eea4..ad3d51c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/dr/os/GridOsCacheDrManager.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/dr/os/GridOsCacheDrManager.java @@ -21,7 +21,7 @@ import org.apache.ignite.*; import org.gridgain.grid.kernal.processors.cache.*; import org.gridgain.grid.kernal.processors.cache.dr.*; import org.gridgain.grid.kernal.processors.cache.transactions.*; -import org.gridgain.grid.kernal.processors.dr.*; +import org.apache.ignite.internal.processors.dr.*; import org.jetbrains.annotations.*; /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalAdapter.java index 9607496..73d8eb9 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalAdapter.java @@ -27,7 +27,7 @@ import org.apache.ignite.transactions.*; import org.gridgain.grid.kernal.processors.cache.*; import org.gridgain.grid.kernal.processors.cache.distributed.near.*; import org.gridgain.grid.kernal.processors.cache.dr.*; -import org.gridgain.grid.kernal.processors.dr.*; +import org.apache.ignite.internal.processors.dr.*; import org.apache.ignite.internal.util.future.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.tostring.*; @@ -44,7 +44,7 @@ import java.util.concurrent.atomic.*; import static org.apache.ignite.events.IgniteEventType.*; import static org.apache.ignite.transactions.IgniteTxState.*; import static org.gridgain.grid.kernal.processors.cache.GridCacheOperation.*; -import static org.gridgain.grid.kernal.processors.dr.GridDrType.*; +import static org.apache.ignite.internal.processors.dr.GridDrType.*; /** * Transaction adapter for cache transactions. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshot.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshot.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshot.java deleted file mode 100644 index 5a588cc..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshot.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * 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.gridgain.grid.kernal.processors.clock; - -import org.apache.ignite.*; -import org.apache.ignite.cluster.*; -import org.apache.ignite.internal.managers.discovery.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.internal.util.tostring.*; - -import java.util.*; - -/** - * Snapshot of time deltas for given topology. - */ -public class GridClockDeltaSnapshot { - /** Time delta version. */ - private final GridClockDeltaVersion ver; - - /** Deltas between coordinator and nodes by node ID. */ - private final Map<UUID, Long> deltas; - - /** Pending delta values. */ - @GridToStringExclude - private final Map<UUID, DeltaAverage> pendingDeltas; - - /** - * @param ver Snapshot version. - * @param locNodeId Local node ID. - * @param discoSnap Discovery snapshot. - * @param avgSize Average size. - */ - public GridClockDeltaSnapshot( - GridClockDeltaVersion ver, - UUID locNodeId, - GridDiscoveryTopologySnapshot discoSnap, - int avgSize - ) { - assert ver.topologyVersion() == discoSnap.topologyVersion(); - - this.ver = ver; - - deltas = new HashMap<>(discoSnap.topologyNodes().size(), 1.0f); - - pendingDeltas = new HashMap<>(discoSnap.topologyNodes().size(), 1.0f); - - for (ClusterNode n : discoSnap.topologyNodes()) { - if (!locNodeId.equals(n.id())) - pendingDeltas.put(n.id(), new DeltaAverage(avgSize)); - } - } - - /** - * @param ver Snapshot version. - * @param deltas Deltas map. - */ - public GridClockDeltaSnapshot(GridClockDeltaVersion ver, Map<UUID, Long> deltas) { - this.ver = ver; - this.deltas = deltas; - - pendingDeltas = Collections.emptyMap(); - } - - /** - * @return Version. - */ - public GridClockDeltaVersion version() { - return ver; - } - - /** - * @return Map of collected deltas. - */ - public Map<UUID, Long> deltas() { - return Collections.unmodifiableMap(deltas); - } - - /** - * Awaits either until snapshot is ready or timeout elapses. - * - * @param timeout Timeout to wait. - * @throws IgniteInterruptedException If wait was interrupted. - */ - public synchronized void awaitReady(long timeout) throws IgniteInterruptedException { - long start = System.currentTimeMillis(); - - try { - while (!ready()) { - long now = System.currentTimeMillis(); - - if (start + timeout - now <= 0) - return; - - wait(start + timeout - now); - } - } - catch (InterruptedException e) { - Thread.currentThread().interrupt(); - - throw new IgniteInterruptedException(e); - } - } - - /** - * Callback invoked when time delta is received from remote node. - * - * @param nodeId Node ID. - * @param timeDelta Calculated time delta. - * @return {@code True} if more samples needed from that node. - */ - public synchronized boolean onDeltaReceived(UUID nodeId, long timeDelta) { - DeltaAverage avg = pendingDeltas.get(nodeId); - - if (avg != null) { - avg.onValue(timeDelta); - - if (avg.ready()) { - pendingDeltas.remove(nodeId); - - deltas.put(nodeId, avg.average()); - - if (ready()) - notifyAll(); - - return false; - } - - return true; - } - - return false; - } - - /** - * Callback invoked when node left. - * - * @param nodeId Left node ID. - */ - public synchronized void onNodeLeft(UUID nodeId) { - pendingDeltas.remove(nodeId); - - deltas.put(nodeId, 0L); - - if (ready()) - notifyAll(); - } - - /** - * @return {@code True} if snapshot is ready. - */ - public synchronized boolean ready() { - return pendingDeltas.isEmpty(); - } - - /** - * @return Collection of node IDs for which response was not received so far. - */ - public synchronized Collection<UUID> pendingNodeIds() { - // Must return copy. - return new HashSet<>(pendingDeltas.keySet()); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(GridClockDeltaSnapshot.class, this); - } - - /** - * Delta average. - */ - private static class DeltaAverage { - /** Delta values. */ - private long[] vals; - - /** Current index. */ - private int idx; - - /** - * @param size Accumulator size. - */ - private DeltaAverage(int size) { - vals = new long[size]; - } - - /** - * Adds value to accumulator. - * - * @param val Value to add. - */ - public void onValue(long val) { - if (idx < vals.length) - vals[idx++] = val; - } - - /** - * Whether this average is complete. - * - * @return {@code True} if enough values is collected. - */ - public boolean ready() { - return idx == vals.length; - } - - /** - * @return Average delta. - */ - public long average() { - long sum = 0; - - for (long val : vals) - sum += val; - - return sum / vals.length; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java deleted file mode 100644 index 7ef0ed7..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * 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.gridgain.grid.kernal.processors.clock; - -import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.internal.util.tostring.*; - -import java.io.*; -import java.nio.*; -import java.util.*; - -/** - * Message containing time delta map for all nodes. - */ -public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAdapter { - /** */ - private static final long serialVersionUID = 0L; - - /** Snapshot version. */ - private GridClockDeltaVersion snapVer; - - /** Grid time deltas. */ - @GridToStringInclude - @GridDirectMap(keyType = UUID.class, valueType = long.class) - private Map<UUID, Long> deltas; - - /** - * Empty constructor required by {@link Externalizable}. - */ - public GridClockDeltaSnapshotMessage() { - // No-op. - } - - /** - * @param snapVer Snapshot version. - * @param deltas Deltas map. - */ - public GridClockDeltaSnapshotMessage(GridClockDeltaVersion snapVer, Map<UUID, Long> deltas) { - this.snapVer = snapVer; - this.deltas = deltas; - } - - /** - * @return Snapshot version. - */ - public GridClockDeltaVersion snapshotVersion() { - return snapVer; - } - - /** - * @return Time deltas map. - */ - public Map<UUID, Long> deltas() { - return deltas; - } - - /** {@inheritDoc} */ - @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { - GridClockDeltaSnapshotMessage _clone = new GridClockDeltaSnapshotMessage(); - - clone0(_clone); - - return _clone; - } - - /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { - GridClockDeltaSnapshotMessage _clone = (GridClockDeltaSnapshotMessage)_msg; - - _clone.snapVer = snapVer; - _clone.deltas = deltas; - } - - /** {@inheritDoc} */ - @SuppressWarnings("all") - @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); - - if (!commState.typeWritten) { - if (!commState.putByte(directType())) - return false; - - commState.typeWritten = true; - } - - switch (commState.idx) { - case 0: - if (deltas != null) { - if (commState.it == null) { - if (!commState.putInt(deltas.size())) - return false; - - commState.it = deltas.entrySet().iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - Map.Entry<UUID, Long> e = (Map.Entry<UUID, Long>)commState.cur; - - if (!commState.keyDone) { - if (!commState.putUuid(e.getKey())) - return false; - - commState.keyDone = true; - } - - if (!commState.putLong(e.getValue())) - return false; - - commState.keyDone = false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(-1)) - return false; - } - - commState.idx++; - - case 1: - if (!commState.putClockDeltaVersion(snapVer)) - return false; - - commState.idx++; - - } - - return true; - } - - /** {@inheritDoc} */ - @SuppressWarnings("all") - @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); - - switch (commState.idx) { - case 0: - if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - - commState.readSize = commState.getInt(); - } - - if (commState.readSize >= 0) { - if (deltas == null) - deltas = U.newHashMap(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - if (!commState.keyDone) { - UUID _val = commState.getUuid(); - - if (_val == UUID_NOT_READ) - return false; - - commState.cur = _val; - commState.keyDone = true; - } - - if (buf.remaining() < 8) - return false; - - long _val = commState.getLong(); - - deltas.put((UUID)commState.cur, _val); - - commState.keyDone = false; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; - commState.cur = null; - - commState.idx++; - - case 1: - GridClockDeltaVersion snapVer0 = commState.getClockDeltaVersion(); - - if (snapVer0 == CLOCK_DELTA_VER_NOT_READ) - return false; - - snapVer = snapVer0; - - commState.idx++; - - } - - return true; - } - - /** {@inheritDoc} */ - @Override public byte directType() { - return 59; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(GridClockDeltaSnapshotMessage.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaVersion.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaVersion.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaVersion.java deleted file mode 100644 index 19049c6..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaVersion.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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.gridgain.grid.kernal.processors.clock; - -import org.apache.ignite.internal.util.typedef.internal.*; - -import java.io.*; - -/** - * Version for time delta snapshot. - */ -public class GridClockDeltaVersion implements Comparable<GridClockDeltaVersion>, Externalizable { - /** */ - private static final long serialVersionUID = 0L; - - /** Snapshot local version. */ - private long ver; - - /** Topology version. */ - private long topVer; - - /** - * Empty constructor required by {@link Externalizable}. - */ - public GridClockDeltaVersion() { - // No-op. - } - - /** - * @param ver Version. - * @param topVer Topology version. - */ - public GridClockDeltaVersion(long ver, long topVer) { - this.ver = ver; - this.topVer = topVer; - } - - /** - * @return Snapshot local version. - */ - public long version() { - return ver; - } - - /** - * @return Snapshot topology version. - */ - public long topologyVersion() { - return topVer; - } - - /** {@inheritDoc} */ - @Override public int compareTo(GridClockDeltaVersion o) { - if (topVer == o.topVer) { - if (ver == o.ver) - return 0; - - return ver > o.ver ? 1 : -1; - } - - return topVer > o.topVer ? 1 : -1; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (!(o instanceof GridClockDeltaVersion)) - return false; - - GridClockDeltaVersion that = (GridClockDeltaVersion)o; - - return topVer == that.topVer && ver == that.ver; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = (int)(ver ^ (ver >>> 32)); - - res = 31 * res + (int)(topVer ^ (topVer >>> 32)); - - return res; - } - - /** {@inheritDoc} */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - out.writeLong(ver); - out.writeLong(topVer); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - ver = in.readLong(); - topVer = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(GridClockDeltaVersion.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c602549a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockMessage.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockMessage.java deleted file mode 100644 index b4aa434..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockMessage.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * 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.gridgain.grid.kernal.processors.clock; - -import org.apache.ignite.*; -import org.apache.ignite.internal.util.typedef.internal.*; - -import java.util.*; - -/** - * Time server message. - */ -public class GridClockMessage { - /** Packet size. */ - public static final int PACKET_SIZE = 48; - - /** Originating node ID. */ - private UUID origNodeId; - - /** Target node ID. */ - private UUID targetNodeId; - - /** Originating timestamp. */ - private long origTs; - - /** Remote node reply ts. */ - private long replyTs; - - /** - * @param origNodeId Originating node ID. - * @param targetNodeId Target node ID. - * @param origTs Originating timestamp. - * @param replyTs Reply timestamp. - */ - public GridClockMessage(UUID origNodeId, UUID targetNodeId, long origTs, long replyTs) { - this.origNodeId = origNodeId; - this.targetNodeId = targetNodeId; - this.origTs = origTs; - this.replyTs = replyTs; - } - - /** - * @return Originating node ID. - */ - public UUID originatingNodeId() { - return origNodeId; - } - - /** - * @param origNodeId Originating node ID. - */ - public void originatingNodeId(UUID origNodeId) { - this.origNodeId = origNodeId; - } - - /** - * @return Target node ID. - */ - public UUID targetNodeId() { - return targetNodeId; - } - - /** - * @param targetNodeId Target node ID. - */ - public void targetNodeId(UUID targetNodeId) { - this.targetNodeId = targetNodeId; - } - - /** - * @return Originating timestamp. - */ - public long originatingTimestamp() { - return origTs; - } - - /** - * @param origTs Originating timestamp. - */ - public void originatingTimestamp(long origTs) { - this.origTs = origTs; - } - - /** - * @return Reply timestamp. - */ - public long replyTimestamp() { - return replyTs; - } - - /** - * @param replyTs Reply timestamp. - */ - public void replyTimestamp(long replyTs) { - this.replyTs = replyTs; - } - - /** - * Converts message to bytes to send over network. - * - * @return Bytes representing this packet. - */ - public byte[] toBytes() { - byte[] buf = new byte[PACKET_SIZE]; - - int off = 0; - - off = U.longToBytes(origNodeId.getLeastSignificantBits(), buf, off); - off = U.longToBytes(origNodeId.getMostSignificantBits(), buf, off); - - off = U.longToBytes(targetNodeId.getLeastSignificantBits(), buf, off); - off = U.longToBytes(targetNodeId.getMostSignificantBits(), buf, off); - - off = U.longToBytes(origTs, buf, off); - - off = U.longToBytes(replyTs, buf, off); - - assert off == PACKET_SIZE; - - return buf; - } - - /** - * Constructs message from bytes. - * - * @param buf Bytes. - * @param off Offset. - * @param len Packet length. - * @return Assembled message. - * @throws IgniteCheckedException If message length is invalid. - */ - public static GridClockMessage fromBytes(byte[] buf, int off, int len) throws IgniteCheckedException { - if (len < PACKET_SIZE) - throw new IgniteCheckedException("Failed to assemble time server packet (message is too short)."); - - long lsb = U.bytesToLong(buf, off); - long msb = U.bytesToLong(buf, off + 8); - - UUID origNodeId = new UUID(msb, lsb); - - lsb = U.bytesToLong(buf, off + 16); - msb = U.bytesToLong(buf, off + 24); - - UUID targetNodeId = new UUID(msb, lsb); - - long origTs = U.bytesToLong(buf, off + 32); - long replyTs = U.bytesToLong(buf, off + 40); - - return new GridClockMessage(origNodeId, targetNodeId, origTs, replyTs); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(GridClockMessage.class, this); - } -}
