Package org.jboss.util.stream

Examples of org.jboss.util.stream.MarshalledValueOutputStream


    * The object has to implement interface Serializable or Externalizable
    */
   private byte[] objectToByteBufferInternal (Object obj) throws Exception
   {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      MarshalledValueOutputStream mvos = new MarshalledValueOutputStream(baos);
      mvos.writeObject(obj);
      mvos.flush();
      return baos.toByteArray();
   }
View Full Code Here


      }

      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      // write a marker to stream to distinguish from null value stream
      baos.write(SERIALIZABLE_VALUE);
      MarshalledValueOutputStream mvos = new MarshalledValueOutputStream(baos);
      mvos.writeObject(obj);
      mvos.flush();
      return baos.toByteArray();
   }
View Full Code Here

               {
                  ((StateTransferStreamProvider) provider).getCurrentState(ostream);
               }
               else
               {
                  MarshalledValueOutputStream mvos = new MarshalledValueOutputStream(ostream);
                  toClose = mvos;
                  mvos.writeObject(state);
               }
            }
            catch (Exception ex)
            {
               CoreGroupCommunicationService.this.log.error("getState failed for service " + serviceName, ex);
View Full Code Here

         CoreGroupCommunicationService.this.log.debug("getState called for service " + serviceName);
        
         StateTransferProvider provider = stateProviders.get(serviceName);
         if (provider != null)
         {
            MarshalledValueOutputStream mvos = null;
            Object state = provider.getCurrentState();
            try
            {
               ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
               mvos = new MarshalledValueOutputStream(baos);
               mvos.writeObject(state);
               mvos.flush();
               mvos.close();
               return baos.toByteArray();
            }
            catch (Exception ex)
            {
               CoreGroupCommunicationService.this.log.error("getState failed for service " + serviceName, ex);
            }
            finally
            {
               if (mvos != null)
               {
                  try
                  {
                     mvos.close();
                  }
                  catch (IOException ignored)
                  {
                     log.debug("Caught exception closing stream used for marshalling state", ignored);
                  }
View Full Code Here

    *         (or null), and element 1 is the persistent state (or null).
    */
   private byte[] generateState(Fqn fqn, long timeout, boolean force) throws Throwable
   {

      MarshalledValueOutputStream out = null;
      byte[] result = null;
      try
      {
         ExposedByteArrayOutputStream baos = new ExposedByteArrayOutputStream(16 * 1024);
         out = new MarshalledValueOutputStream(baos);
         try
         {
            stateTransferManager.getState(out, fqn, timeout, force, false);
         }
         catch (RegionEmptyException ree)
View Full Code Here

   {
   }

   public byte[] getState()
   {
      MarshalledValueOutputStream out = null;
      byte[] result;
      ExposedByteArrayOutputStream baos = new ExposedByteArrayOutputStream(16 * 1024);
      try
      {
         out = new MarshalledValueOutputStream(baos);

         stateTransferManager.getState(out, Fqn.ROOT, configuration.getStateRetrievalTimeout(), true, true);
      }
      catch (Throwable t)
      {
View Full Code Here

      }
   }

   public byte[] getState(String state_id)
   {
      MarshalledValueOutputStream out = null;
      String sourceRoot = state_id;
      byte[] result;

      boolean hasDifferentSourceAndIntegrationRoots = state_id.indexOf(StateTransferManager.PARTIAL_STATE_DELIMITER) > 0;
      if (hasDifferentSourceAndIntegrationRoots)
      {
         sourceRoot = state_id.split(StateTransferManager.PARTIAL_STATE_DELIMITER)[0];
      }

      ExposedByteArrayOutputStream baos = new ExposedByteArrayOutputStream(16 * 1024);
      try
      {
         out = new MarshalledValueOutputStream(baos);

         stateTransferManager.getState(out, Fqn.fromString(sourceRoot),
               configuration.getStateRetrievalTimeout(), true, true);
      }
      catch (Throwable t)
View Full Code Here

      return result;
   }

   public void getState(OutputStream ostream)
   {
      MarshalledValueOutputStream out = null;
      try
      {
         out = new MarshalledValueOutputStream(ostream);
         stateTransferManager.getState(out, Fqn.ROOT, configuration.getStateRetrievalTimeout(), true, true);
      }
      catch (Throwable t)
      {
         stateProducingFailed(t);
View Full Code Here

   }

   public void getState(String state_id, OutputStream ostream)
   {
      String sourceRoot = state_id;
      MarshalledValueOutputStream out = null;
      boolean hasDifferentSourceAndIntegrationRoots = state_id.indexOf(StateTransferManager.PARTIAL_STATE_DELIMITER) > 0;
      if (hasDifferentSourceAndIntegrationRoots)
      {
         sourceRoot = state_id.split(StateTransferManager.PARTIAL_STATE_DELIMITER)[0];
      }
      try
      {
         out = new MarshalledValueOutputStream(ostream);
         stateTransferManager.getState(out, Fqn.fromString(sourceRoot), configuration.getStateRetrievalTimeout(), true, true);
      }
      catch (Throwable t)
      {
         stateProducingFailed(t);
View Full Code Here

    *         (or null), and element 1 is the persistent state (or null).
    */
   private byte[] generateState(Fqn fqn, long timeout, boolean force) throws Throwable
   {

      MarshalledValueOutputStream out = null;
      byte[] result = null;
      try
      {
         ExposedByteArrayOutputStream baos = new ExposedByteArrayOutputStream(16 * 1024);
         out = new MarshalledValueOutputStream(baos);
         try
         {
            stateTransferManager.getState(out, fqn, timeout, force, false);
         }
         catch (RegionEmptyException ree)
View Full Code Here

TOP

Related Classes of org.jboss.util.stream.MarshalledValueOutputStream

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.