All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.objectweb.dream.protocol.channel.CloseChunk Maven / Gradle / Ivy

/**
 * Dream
 * Copyright (C) 2003-2004 INRIA Rhone-Alpes
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Contact: [email protected]
 *
 * Initial developer(s): Matthieu Leclercq
 * Contributor(s): 
 */

package org.objectweb.dream.protocol.channel;

import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

import org.objectweb.dream.message.AbstractChunk;

/**
 * Chunk used by multiplex protocol.
 */
public class CloseChunk extends AbstractChunk {

    /** Default name for chunks of this type. */
    public static final String DEFAULT_NAME = "close-chunk";

    private static final long serialVersionUID = -2320614282445671602L;

    private short routeId;

    /**
     * @return Returns the routeId.
     */
    public final short getRouteId() {
        return routeId;
    }

    /**
     * @param routeId
     *      The routeId to set.
     */
    public final void setRouteId(short routeId) {
        this.routeId = routeId;
    }

    // ------------------------------------------------------------------------
    // ---
    // Implementation of the Chunk interface
    // ------------------------------------------------------------------------
    // ---

    /**
     * @see AbstractChunk#newChunk()
     */
    public CloseChunk newChunk() {
        return new CloseChunk();
    }

    /**
     * @see AbstractChunk#transfertStateTo(AbstractChunk)
     */
    public void transfertStateTo(CloseChunk newInstance) {
        newInstance.routeId = routeId;
    }

    /**
     * @see org.objectweb.dream.pool.Recyclable#recycle()
     */
    public void recycle() {
        routeId = 0;
    }

    // ------------------------------------------------------------------------
    // ---
    // Implementation of the Externalizable interface
    // ------------------------------------------------------------------------
    // ---

    /**
     * @see java.io.Externalizable#readExternal(ObjectInput)
     */
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        routeId = in.readShort();
    }

    /**
     * @see java.io.Externalizable#writeExternal(ObjectOutput)
     */
    public void writeExternal(ObjectOutput out) throws IOException {
        out.writeShort(routeId);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy