Package org.infinispan.remoting.responses

Examples of org.infinispan.remoting.responses.ExtendedResponse$Externalizer


               for (Map.Entry<Address, Rsp> entry : retval.entrySet()) {
                  Object value = entry.getValue().getValue();
                  if (value instanceof RequestIgnoredResponse) {
                     ignorers.add(entry.getKey());
                  } else if (value instanceof ExtendedResponse) {
                     ExtendedResponse extended = (ExtendedResponse) value;
                     replay |= extended.isReplayIgnoredRequests();
                     entry.getValue().setValue(extended.getResponse());
                  }
               }

               if (replay && ignorers.size() > 0) {
                  Message msg = constructMessage(buf, null);
View Full Code Here


      Response resp = handleInternal(cmd);

      // A null response is valid and OK ...
      if (resp == null || resp.isValid()) {
         if (replayIgnored) resp = new ExtendedResponse(resp, true);
      } else {
         // invalid response
         if (trace) log.trace("Unable to execute command, got invalid response");
      }
View Full Code Here

               for (Map.Entry<Address, Rsp<Object>> entry : retval.entrySet()) {
                  Object value = entry.getValue().getValue();
                  if (value instanceof RequestIgnoredResponse) {
                     ignorers.add(entry.getKey());
                  } else if (value instanceof ExtendedResponse) {
                     ExtendedResponse extended = (ExtendedResponse) value;
                     replay |= extended.isReplayIgnoredRequests();
                     entry.getValue().setValue(extended.getResponse());
                  }
               }

               if (replay && !ignorers.isEmpty()) {
                  Message msg = constructMessage(buf, null);
View Full Code Here

*/
@Immutable
public class ExtendedResponseExternalizer implements Externalizer {

   public void writeObject(ObjectOutput output, Object subject) throws IOException {
      ExtendedResponse er = (ExtendedResponse) subject;
      output.writeBoolean(er.isReplayIgnoredRequests());
      output.writeObject(er.getResponse());
   }
View Full Code Here

   }

   public Object readObject(ObjectInput input) throws IOException, ClassNotFoundException {
      boolean replayIgnoredRequests = input.readBoolean();
      Response response = (Response) input.readObject();
      return new ExtendedResponse(response, replayIgnoredRequests);
   }
View Full Code Here

      marshallAndAssertEquality(UnsuccessfulResponse.INSTANCE);
   }

   public void testExtendedResponseMarshalling() throws Exception {
      SuccessfulResponse sr = new SuccessfulResponse("Blah");
      ExtendedResponse extended = new ExtendedResponse(sr, false);
      byte[] bytes = marshaller.objectToByteBuffer(extended);
      ExtendedResponse readObj = (ExtendedResponse) marshaller.objectFromByteBuffer(bytes);
      assert extended.getResponse().equals(readObj.getResponse()) :
            "Writen[" + extended.getResponse() + "] and read[" + readObj.getResponse() + "] objects should be the same";
      assert extended.isReplayIgnoredRequests() == readObj.isReplayIgnoredRequests() :
            "Writen[" + extended.isReplayIgnoredRequests() + "] and read[" + readObj.isReplayIgnoredRequests() + "] objects should be the same";
   }
View Full Code Here

      checkEqualityAndSize(UnsuccessfulResponse.INSTANCE);
   }

   public void testExtendedResponseMarshalling() throws Exception {
      SuccessfulResponse sr = new SuccessfulResponse("Blah");
      ExtendedResponse extended = new ExtendedResponse(sr, false);

      List<Integer> sizes = new ArrayList<Integer>(2);
      for (Marshaller marshaller : marshallers) {
         byte[] bytes = marshaller.objectToByteBuffer(extended);
         ExtendedResponse readObj = (ExtendedResponse) marshaller.objectFromByteBuffer(bytes);
         assert extended.getResponse().equals(readObj.getResponse()) :
               "Writen[" + extended.getResponse() + "] and read[" + readObj.getResponse() + "] objects should be the same";
         assert extended.isReplayIgnoredRequests() == readObj.isReplayIgnoredRequests() :
               "Writen[" + extended.isReplayIgnoredRequests() + "] and read[" + readObj.isReplayIgnoredRequests() + "] objects should be the same";
         sizes.add(bytes.length);
      }
      assert sizes.get(1) < sizes.get(0) : "JBoss Marshaller should write less bytes: bytesJBoss=" + sizes.get(1) + ", bytesHome=" + sizes.get(0);
   }
View Full Code Here

               for (Map.Entry<Address, Rsp> entry : retval.entrySet()) {
                  Object value = entry.getValue().getValue();
                  if (value instanceof RequestIgnoredResponse) {
                     ignorers.add(entry.getKey());
                  } else if (value instanceof ExtendedResponse) {
                     ExtendedResponse extended = (ExtendedResponse) value;
                     replay |= extended.isReplayIgnoredRequests();
                     entry.getValue().setValue(extended.getResponse());
                  }
               }

               if (replay && !ignorers.isEmpty()) {
                  Message msg = constructMessage(buf, null);
View Full Code Here

      Response resp = handleInternal(cmd);

      // A null response is valid and OK ...
      if (resp == null || resp.isValid()) {
         if (replayIgnored) resp = new ExtendedResponse(resp, true);
      } else {
         // invalid response
         if (trace) log.trace("Unable to execute command, got invalid response");
      }
View Full Code Here

      Response resp = handleInternal(cmd);

      // A null response is valid and OK ...
      if (resp == null || resp.isValid()) {
         if (replayIgnored) resp = new ExtendedResponse(resp, true);
      } else {
         // invalid response
         if (trace) log.trace("Unable to execute command, got invalid response");
      }
View Full Code Here

TOP

Related Classes of org.infinispan.remoting.responses.ExtendedResponse$Externalizer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.