Package org.jboss.util.stream

Examples of org.jboss.util.stream.MarshalledValueInputStream


      {
         log.debug("transferred state is null (may be first member in cluster)");
         return;
      }
      ByteArrayInputStream bais = new ByteArrayInputStream(new_state);
      MarshalledValueInputStream in = null;
      try
      {
         in = new MarshalledValueInputStream(bais);
         stateTransferManager.setState(in, Fqn.ROOT);
         stateReceivedSuccess();
      }
      catch (Throwable t)
      {
View Full Code Here


      if (istream == null)
      {
         log.debug("stream is null (may be first member in cluster)");
         return;
      }
      MarshalledValueInputStream in = null;
      try
      {
         in = new MarshalledValueInputStream(istream);
         stateTransferManager.setState(in, Fqn.ROOT);
         stateReceivedSuccess();
      }
      catch (Throwable t)
      {
View Full Code Here

      {
         log.debug("partial transferred state is null");
         return;
      }

      MarshalledValueInputStream in = null;
      String targetRoot = state_id;
      boolean hasDifferentSourceAndIntegrationRoots = state_id.indexOf(StateTransferManager.PARTIAL_STATE_DELIMITER) > 0;
      if (hasDifferentSourceAndIntegrationRoots)
      {
         targetRoot = state_id.split(StateTransferManager.PARTIAL_STATE_DELIMITER)[1];
      }
      try
      {
         log.debug("Setting received partial state for subroot " + state_id);
         Fqn subroot = Fqn.fromString(targetRoot);
//            Region region = regionManager.getRegion(subroot, false);
//            ClassLoader cl = null;
//            if (region != null)
//            {
//               // If a classloader is registered for the node's region, use it
//               cl = region.getClassLoader();
//            }
         ByteArrayInputStream bais = new ByteArrayInputStream(state);
         in = new MarshalledValueInputStream(bais);
         //getStateTransferManager().setState(in, subroot, cl);
         stateTransferManager.setState(in, subroot);
         stateReceivedSuccess();
      }
      catch (Throwable t)
View Full Code Here

   public void setState(String stateId, InputStream istream)
   {
      if (log.isTraceEnabled()) log.trace("**** Receiving state for " + stateId);
      String targetRoot = stateId;
      MarshalledValueInputStream in = null;
      boolean hasDifferentSourceAndIntegrationRoots = stateId.indexOf(StateTransferManager.PARTIAL_STATE_DELIMITER) > 0;
      if (hasDifferentSourceAndIntegrationRoots)
      {
         targetRoot = stateId.split(StateTransferManager.PARTIAL_STATE_DELIMITER)[1];
      }
      if (istream == null)
      {
         log.debug("stream is null (may be first member in cluster). State is not set");
         return;
      }

      try
      {
         log.debug("Setting received partial state for subroot " + stateId);
         in = new MarshalledValueInputStream(istream);
         Fqn subroot = Fqn.fromString(targetRoot);
//            Region region = regionManager.getRegion(subroot, false);
//            ClassLoader cl = null;
//            if (region != null)
//            {
View Full Code Here

               if (trace) log.trace("Integrating state for region " + fqn);
               //ClassLoader cl = (marshaller == null) ? null : marshaller.getClassLoader(fqnS);
               Fqn integrationRoot = Fqn.fromRelativeFqn(integrationBase, fqn);

               byte[] stateBuffer = entry.getValue();
               MarshalledValueInputStream in = null;
               try
               {
                  ByteArrayInputStream bais = new ByteArrayInputStream(stateBuffer);
                  in = new MarshalledValueInputStream(bais);
                  //stateMgr.setState(in, integrationRoot, cl);
                  stateTransferManager.setState(in, integrationRoot);
               }
               catch (Throwable t)
               {
                  if (t instanceof CacheException)
                  {
                     //excepected/common and can happen due to inactive regions and so on
                     log.debug(t);
                  }
                  else
                  {
                     //something has gone wrong
                     log.error("State for fqn " + fqn
                           + " could not be transferred to a buddy at "
                           + cache.getLocalAddress(), t);
                  }
               }
               finally
               {
                  if (in != null)
                  {
                     in.close();
                  }
               }
            }
            else
            {
View Full Code Here

               if (trace) log.trace("Integrating state for region " + fqn);
               //ClassLoader cl = (marshaller == null) ? null : marshaller.getClassLoader(fqnS);
               Fqn integrationRoot = Fqn.fromRelativeFqn(integrationBase, fqn);

               byte[] stateBuffer = entry.getValue();
               MarshalledValueInputStream in = null;
               try
               {
                  ByteArrayInputStream bais = new ByteArrayInputStream(stateBuffer);
                  in = new MarshalledValueInputStream(bais);
                  //stateMgr.setState(in, integrationRoot, cl);
                  stateTransferManager.setState(in, integrationRoot);
               }
               catch (Throwable t)
               {
                  if (t instanceof CacheException)
                  {
                     //excepected/common and can happen due to inactive regions and so on
                     log.debug(t);
                  }
                  else
                  {
                     //something has gone wrong
                     log.error("State for fqn " + fqn
                           + " could not be transferred to a buddy at "
                           + cache.getLocalAddress(), t);
                  }
               }
               finally
               {
                  if (in != null)
                  {
                     in.close();
                  }
               }
            }
            else
            {
View Full Code Here

public class MarshalledValueObjectStreamSource implements ObjectStreamSource
{
   @Override
   public ObjectInput getObjectInput(InputStream source) throws IOException
   {     
      return new MarshalledValueInputStream(source);
   }
View Full Code Here

   @Override
   protected Object doUnmarshall(Fqn fqn, Object fromFile) throws Exception
   {
      FileInputStream fileIn = new FileInputStream((File) fromFile);
      ObjectInputStream input = new MarshalledValueInputStream(fileIn);
      Object unmarshalledObj = getMarshaller().objectFromObjectStream(input);
      input.close();
      return unmarshalledObj;
   }
View Full Code Here

public class MarshalledValueObjectStreamSource implements ObjectStreamSource
{

   public ObjectInput getObjectInput(InputStream source) throws IOException
   {     
      return new MarshalledValueInputStream(source);
   }
View Full Code Here

      {
         return null;
      }

      ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
      MarshalledValueInputStream input = new MarshalledValueInputStream(bais);
      Object result = input.readObject();
      input.close();
      return result;
   }
View Full Code Here

TOP

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

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.