KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > dream > message > codec > MessageCodecObjectStreamAttributeController


1 /**
2  * Dream
3  * Copyright (C) 2003-2004 INRIA Rhone-Alpes
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact: dream@objectweb.org
20  *
21  * Initial developer(s): Matthieu Leclercq
22  * Contributor(s):
23  */

24
25 package org.objectweb.dream.message.codec;
26
27 import org.objectweb.fractal.api.control.AttributeController;
28
29 /**
30  * Attribute controller interface for codec using Object stream (ie. sub class
31  * of {@link AbstractMessageCodecObjectStream}). Defines a
32  * <code>reuseObjectStream</code> boolean attribute that control the "life
33  * cycle" of the object streams used by the codec. If <code>false</code>, the
34  * codec will open a new Object stream for each encoding or decoding operation.
35  * Else, the codec resuse the already opened Object stream (see
36  * {@link CodecInputOutput#setInput(Object) }and
37  * {@link CodecInputOutput#setOutput(Object)}).<br>
38  * Warning : if <code>true</code>, you must be sure that the
39  * {@link java.io.ObjectOutputStream#writeObject(Object) }(respectivly
40  * <code>readObject</code>) method is never used, unless a memory leak can
41  * happen. Inded, the <code>writeObject</code> method keep a reference to each
42  * serialized object. You must use the
43  * {@link org.objectweb.dream.util.Util#writeObject(java.io.ObjectOutput, Object)}
44  * (respectivly,
45  * {@link org.objectweb.dream.util.Util#readObject(java.io.ObjectInput)})
46  * instead. This method will use the
47  * {@link java.io.ObjectOutputStream#writeUnshared(Object) }method
48  * (respectivly, {@link java.io.ObjectInputStream#readUnshared()}).<br>
49  * To do so, you must implements specialized serialization method in your chunk
50  * and message implementations, and in any serialized object.
51  *
52  * @see java.io.Serializable
53  * @see java.io.Externalizable
54  * @see java.io.ObjectOutputStream
55  * @see java.io.ObjectInputStream
56  */

57 public interface MessageCodecObjectStreamAttributeController
58     extends
59       AttributeController
60 {
61   /**
62    * Returns the <code>reuseObjectStream</code> attribute value.
63    *
64    * @return the <code>reuseObjectStream</code> attribute value.
65    */

66   boolean getReuseObjectStream();
67
68   /**
69    * Sets the <code>reuseObjectStream</code> attribute.
70    *
71    * @param reuseObjectStream the new <code>reuseObjectStream</code> attribute
72    * value.
73    */

74   void setReuseObjectStream(boolean reuseObjectStream);
75 }
Popular Tags