Package java.io

Examples of java.io.ObjectOutputStream.reset()


                }
                DataOutputStream dataOut = new DataOutputStream(os);
                ObjectOutputStream objOut = new ObjectOutputStream(dataOut);
                objOut.writeObject(object);
                objOut.flush();
                objOut.reset();
                objOut.close();
                setContent(bytesOut.toByteSequence());
            } catch (IOException ioe) {
                throw new RuntimeException(ioe.getMessage(), ioe);
            }
View Full Code Here


        ObjectOutputStream oout = this.oout;
        if (resetInterval != 0) {
            // Resetting will prevent OOM on the receiving side.
            writtenObjects ++;
            if (writtenObjects % resetInterval == 0) {
                oout.reset();

                // Also discard the byproduct to avoid OOM on the sending side.
                buffer.discardReadBytes();
            }
        }
View Full Code Here

        oos.writeObject(event);
        oos.flush();
      // Failing to reset the object output stream every now and
      // then creates a serious memory leak.
      // right now we always reset. TODO - set up frequency counter per oos?
      oos.reset();
      }
      catch(IOException e) {
        // there was an io exception so just drop the connection
        oosList.removeElementAt(streamCount);
        LogLog.debug("dropped connection");
View Full Code Here

         ObjectOutputStream oos = new ObjectOutputStream(out);
         ObjectInputStream objInputStream = new ObjectInputStream(in);

         oos.writeObject(callback);
         oos.reset();
         oos.writeObject(Boolean.TRUE);
         oos.flush();
         oos.reset();

         Object obj = objInputStream.readObject();
View Full Code Here

         oos.writeObject(callback);
         oos.reset();
         oos.writeObject(Boolean.TRUE);
         oos.flush();
         oos.reset();

         Object obj = objInputStream.readObject();
         objInputStream.readObject();
      }
      catch(IOException e)
View Full Code Here

            debug("Sending command " + command + " on position " + position);
            ObjectOutputStream out =outArray[position];
            try {
              out.writeObject(command);
              out.flush();
              out.reset();
            } catch (IOException e) {
                // The outputStream must be down
                debug("Position " + position + " removed");
                outputStreams.remove(position);
                inputStreams.remove(position);
View Full Code Here

        oos.flush();

        // Failing to reset the object output stream every now and
        // then creates a serious memory leak.
        // right now we always reset. TODO - set up frequency counter per oos?
        oos.reset();
      } catch (IOException e) {
        // there was an io exception so just drop the connection
        oosList.removeElementAt(streamCount);
        getLogger().debug("dropped connection");
View Full Code Here

    bout.reset();
    oout.writeObject(p1);
    oout.flush();
    byte[] b1 = bout.toByteArray();
   
    oout.reset();
    bout.reset();
    oout.writeObject(p2);
    oout.flush();
    byte[] b2 = bout.toByteArray();
   
View Full Code Here

        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            final ObjectOutputStream oos = new PrivateObjectOutputStream(baos);
            try {
                oos.writeObject(event);
                oos.reset();
            } finally {
                oos.close();
            }
        } catch (final IOException ioe) {
            LOGGER.error("Serialization of LogEvent failed.", ioe);
View Full Code Here

        oos.writeObject(serEvent);
        oos.flush();
        if (++counter >= CoreConstants.OOS_RESET_FREQUENCY) {
          // Failing to reset the object output stream every now and
          // then creates a serious memory leak.
          oos.reset();
          counter = 0;
        }
      }
    } catch (IOException ex) {
      addInfo(peerId + "connection failed: " + ex);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.