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


        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

        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

/*     */       try
/*     */       {
/* 208 */         oos.writeObject(event);
/* 209 */         oos.flush();
/*     */
/* 213 */         oos.reset();
/*     */       }
/*     */       catch (IOException e)
/*     */       {
/* 217 */         this.oosList.removeElementAt(streamCount);
/* 218 */         LogLog.debug("dropped connection");
View Full Code Here

                }
                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

                }
                DataOutputStream dataOut = new DataOutputStream(os);
                ObjectOutputStream objOut = new ObjectOutputStream(dataOut);
                objOut.writeObject(object);
                objOut.flush();
                objOut.reset();
                objOut.close();
                setContent(bytesOut.toBuffer());
            } 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

      }

      ObjectOutputStream out = (ObjectOutputStream) getOutputStream();
      out.writeByte(ACK);
      out.flush();
      out.reset();
   }
}
View Full Code Here

                out.writeObject(engine.getDependencies());
                out.flush();

                //call reset to prevent resource leaks per
                //https://www.securecoding.cert.org/confluence/display/java/SER10-J.+Avoid+memory+and+resource+leaks+during+serialization
                out.reset();

            } catch (IOException ex) {
                LOGGER.log(Level.WARNING, "Unable to create data file used for report aggregation; "
                        + "if report aggregation is being used the results may be incomplete.");
                LOGGER.log(Level.FINE, ex.getMessage(), ex);
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.remove(streamCount);
        LogLog.debug("dropped connection");
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.