Package org.jboss.util.stream

Examples of org.jboss.util.stream.MarshalledValueInputStream


   public void setState(String stateId, InputStream istream)
   {
      if (trace) log.trace("Receiving state on stream for " + stateId);
      String targetRoot = stateId;
      MarshalledValueInputStream in = null;
      boolean hasDifferentSourceAndIntegrationRoots = stateId.indexOf(DefaultStateTransferManager.PARTIAL_STATE_DELIMITER) > 0;
      if (hasDifferentSourceAndIntegrationRoots)
      {
         targetRoot = stateId.split(DefaultStateTransferManager.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


      {
         return null;
      }

      ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
      MarshalledValueInputStream mvis = new MarshalledValueInputStream(bais);
      return mvis.readObject();
   }
View Full Code Here

      }

      ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
      // read past the null/serializable byte
      bais.read();
      MarshalledValueInputStream mvis = new MarshalledValueInputStream(bais);
      return mvis.readObject();
   }
View Full Code Here

      {
         ClassLoader cl = getStateTransferClassLoader();
         SwitchContext switchContext = CoreGroupCommunicationService.this.classLoaderSwitcher.getSwitchContext(cl);
         try
         {
            MarshalledValueInputStream mvis = new MarshalledValueInputStream(is);
            this.state = (Serializable) mvis.readObject();
         }
         finally
         {
            switchContext.reset();
         }
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

   @Override
   public Object objectFromByteBuffer(byte[] bytes, int offset, int len) throws Exception
   {
      Marshaller marshaller;
      int versionId;
      ObjectInputStream in = new MarshalledValueInputStream(new ByteArrayInputStream(bytes, offset, len));

      try
      {
         versionId = in.readShort();
         if (trace) log.trace("Read version " + versionId);
      }
      catch (Exception e)
      {
         log.error("Unable to read version id from first two bytes of stream, barfing.");
View Full Code Here

   @Override
   public RegionalizedMethodCall regionalizedMethodCallFromByteBuffer(byte[] buf) throws Exception
   {
      Marshaller marshaller;
      int versionId;
      ObjectInputStream in = new MarshalledValueInputStream(new ByteArrayInputStream(buf));

      try
      {
         versionId = in.readShort();
         if (trace) log.trace("Read version " + versionId);
      }
      catch (Exception e)
      {
         log.error("Unable to read version id from first two bytes of stream, barfing.");
View Full Code Here

         // actually attempt to "stream" this stuff.  We need to revert to an old-fashioned Object Input Stream since
         // we don't have a reusable implementation for non-byte-backed streams as yet.
         short versionId;
         Marshaller marshaller;

         ObjectInputStream in = new MarshalledValueInputStream(is);

         try
         {
            versionId = in.readShort();
            if (trace) log.trace("Read version " + versionId);
         }
         catch (Exception e)
         {
            log.error("Unable to read version id from first two bytes of stream, barfing.");
View Full Code Here

   public synchronized void deserialize() {
      if (instance == null) {
         try {
            ByteArrayInputStream bais = new ByteArrayInputStream(raw);
            // use a MarshalledValueInputStream since it needs to be aware of any context class loaders on the current thread.
            ObjectInputStream ois = new MarshalledValueInputStream(bais);
            instance = ois.readObject();
            ois.close();
            bais.close();
         }
         catch (Exception e) {
            throw new CacheException("Unable to unmarshall value", e);
         }
View Full Code Here

      // and return bytes.
      return new ByteBuffer(baos.getRawBuffer(), 0, baos.size());
   }

   public Object objectFromByteBuffer(byte[] buf, int offset, int length) throws IOException, ClassNotFoundException {
      ObjectInput in = new MarshalledValueInputStream(new ByteArrayInputStream(buf, offset, length));
      return objectFromObjectStream(in);
   }
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.