1717
1818package org .apache .ignite .internal ;
1919
20- import java .nio .ByteBuffer ;
2120import java .util .Collection ;
2221import org .apache .ignite .IgniteCheckedException ;
2322import org .apache .ignite .compute .ComputeJobSibling ;
2423import org .apache .ignite .internal .util .typedef .internal .S ;
2524import org .apache .ignite .internal .util .typedef .internal .U ;
2625import org .apache .ignite .marshaller .Marshaller ;
2726import org .apache .ignite .plugin .extensions .communication .Message ;
28- import org .apache .ignite .plugin .extensions .communication .MessageReader ;
29- import org .apache .ignite .plugin .extensions .communication .MessageWriter ;
3027import org .jetbrains .annotations .Nullable ;
3128
3229/**
3330 * Job siblings response.
3431 */
3532public class GridJobSiblingsResponse implements Message {
3633 /** */
37- @ GridDirectTransient
38- private Collection <ComputeJobSibling > siblings ;
34+ private @ Nullable Collection <ComputeJobSibling > siblings ;
3935
4036 /** */
37+ @ Order (0 )
4138 private byte [] siblingsBytes ;
4239
4340 /**
@@ -49,70 +46,56 @@ public GridJobSiblingsResponse() {
4946
5047 /**
5148 * @param siblings Siblings.
52- * @param siblingsBytes Serialized siblings.
5349 */
54- public GridJobSiblingsResponse (@ Nullable Collection <ComputeJobSibling > siblings , @ Nullable byte [] siblingsBytes ) {
50+ public GridJobSiblingsResponse (@ Nullable Collection <ComputeJobSibling > siblings ) {
5551 this .siblings = siblings ;
56- this .siblingsBytes = siblingsBytes ;
5752 }
5853
5954 /**
6055 * @return Job siblings.
6156 */
62- public Collection <ComputeJobSibling > jobSiblings () {
57+ public @ Nullable Collection <ComputeJobSibling > jobSiblings () {
6358 return siblings ;
6459 }
6560
6661 /**
67- * @param marsh Marshaller.
68- * @throws IgniteCheckedException In case of error.
62+ * @return Serialized siblings.
6963 */
70- public void unmarshalSiblings (Marshaller marsh ) throws IgniteCheckedException {
71- assert marsh != null ;
72-
73- if (siblingsBytes != null )
74- siblings = U .unmarshal (marsh , siblingsBytes , null );
64+ public byte [] siblingsBytes () {
65+ return siblingsBytes ;
7566 }
7667
77- /** {@inheritDoc} */
78- @ Override public boolean writeTo (ByteBuffer buf , MessageWriter writer ) {
79- writer .setBuffer (buf );
80-
81- if (!writer .isHeaderWritten ()) {
82- if (!writer .writeHeader (directType ()))
83- return false ;
84-
85- writer .onHeaderWritten ();
86- }
87-
88- switch (writer .state ()) {
89- case 0 :
90- if (!writer .writeByteArray (siblingsBytes ))
91- return false ;
92-
93- writer .incrementState ();
94-
95- }
96-
97- return true ;
68+ /**
69+ * @param siblingsBytes Serialized siblings.
70+ */
71+ public void siblingsBytes (byte [] siblingsBytes ) {
72+ this .siblingsBytes = siblingsBytes ;
9873 }
9974
100- /** {@inheritDoc} */
101- @ Override public boolean readFrom (ByteBuffer buf , MessageReader reader ) {
102- reader .setBuffer (buf );
103-
104- switch (reader .state ()) {
105- case 0 :
106- siblingsBytes = reader .readByteArray ();
75+ /**
76+ * Marshals siblings to byte array.
77+ *
78+ * @param marsh Marshaller.
79+ * @throws IgniteCheckedException In case of error.
80+ */
81+ public void marshalSiblings (Marshaller marsh ) throws IgniteCheckedException {
82+ siblingsBytes = U .marshal (marsh , siblings );
83+ }
10784
108- if (!reader .isLastRead ())
109- return false ;
85+ /**
86+ * Unmarshals siblings from byte array.
87+ *
88+ * @param marsh Marshaller.
89+ * @throws IgniteCheckedException In case of error.
90+ */
91+ public void unmarshalSiblings (Marshaller marsh ) throws IgniteCheckedException {
92+ assert marsh != null ;
11093
111- reader .incrementState ();
94+ if (siblingsBytes != null ) {
95+ siblings = U .unmarshal (marsh , siblingsBytes , null );
11296
97+ siblingsBytes = null ;
11398 }
114-
115- return true ;
11699 }
117100
118101 /** {@inheritDoc} */
0 commit comments