src/java.corba/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -150,13 +150,15 @@
defaultWriteObjectDelegate();
}
public abstract void defaultWriteObjectDelegate();
- public ObjectOutputStream.PutField putFields()
+ public synchronized ObjectOutputStream.PutField putFields()
throws IOException {
+ if (putFields == null) {
putFields = new HookPutFields();
+ }
return putFields;
}
// Stream format version, saved/restored during recursive calls
protected byte streamFormatVersion = 1;
@@ -173,13 +175,16 @@
// See java.io.ObjectOutputStream.PutFields
public void writeFields()
throws IOException {
writeObjectState.defaultWriteObject(this);
-
+ synchronized (this) {
+ if (putFields != null) {
putFields.write(this);
}
+ }
+ }
abstract org.omg.CORBA_2_3.portable.OutputStream getOrbStream();
protected abstract void beginOptionalCustomData();