newphtmessage.java

来自「High performance DB query」· Java 代码 · 共 101 行

JAVA
101
字号
/*
 * @(#)$Id: NewPHTMessage.java,v 1.1 2005/09/06 04:15:48 burkhart Exp $
 *
 * Copyright (c) 2001-2004 Regents of the University of California.
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached BERKELEY-LICENSE
 * file. If you do not find these files, copies can be found by writing to:
 * Computer Science Division, Database Group, Universite of California,
 * 617 Soda Hall #1776, Berkeley, CA 94720-1776. Attention: Berkeley License
 *
 * Copyright (c) 2003-2004 Intel Corporation. All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE file.
 * If you do not find these files, copies can be found by writing to:
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300,
 * Berkeley, CA, 94704.  Attention:  Intel License Inquiry.
 */


package pier.indexes.prefixhashtree;

import java.net.InetSocketAddress;

import pier.messages.IndexMessage;
import pier.messages.IndexSendMessage;
import services.network.Payload;
import util.BitID;
import util.network.serialization.GenericByteBuffer;
import util.network.serialization.SerializationManager;
import util.network.serialization.SerializeInetSocketAddress;
import util.network.serialization.SerializeString;

/**
 * Class NewPHTMessage
 * 
 * Just the same as IndexMessage, just a different type to make message sorting easier.
 * Only sent when the first item is inserted into the PHT, to let the root of the other
 * subtree know about it.
 */
public class NewPHTMessage extends IndexMessage {

    public static long serialVersionUID =
        SerializationManager.getSerialUID("pier.indexes.prefixhashtree.NewPHTMessage");
	
    /**
     * Constructor QueryForwardRequest
     *
     * @param inputBuffer
     */
    public NewPHTMessage(GenericByteBuffer inputBuffer) {
        super(inputBuffer);
    }

    /**
     * Method serialize
     *
     * @param outputBuffer
     * @return
     */
    public long serialize(GenericByteBuffer outputBuffer) {
        super.serialize(outputBuffer);

        return serialVersionUID;
    }

    /**
     * Constructor QueryForwardRequest
     */
    protected NewPHTMessage() {}

    /**
     * Method toString
     * @return
     */
    public String toString() {
        return "<NewPHTMessage: N:" + indexName + ", T:" + indexType + ", S:"
               + source + ", M:" + messageID + ", A:" + additionalData + ">";
    }

    /**
     * Method allocate
     *
     * @param indexName
     * @param indexType
     * @param source
     * @param messageID
     * @param newNodeKey
     * @return
     */
    public static NewPHTMessage allocate(String indexName, String indexType, InetSocketAddress source, 
    		long messageID, Payload newNodeKey) {
    	
    	NewPHTMessage message = new NewPHTMessage();
    	
    	message.init(indexName, indexType, 0, source, messageID, newNodeKey);
    	
    	return message;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?